One Hat Cyber Team
Your IP :
18.222.215.20
Server IP :
162.241.123.123
Server :
Linux sh016.hostgator.in 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64
Server Software :
Apache
PHP Version :
8.2.25
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
home1
/
saicsazq
/
keedoai.com
/
app
/
Services
/
Edit File:
OpenaiTTSService.php
<?php namespace App\Services; use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Storage; use Spatie\Backup\Helpers\Backup; use App\Services\Statistics\UserService; use OpenAI\Laravel\Facades\OpenAI; use App\Models\Voice; class OpenaiTTSService { private $api; public function __construct() { $this->api = new UserService(); $verify = $this->api->prompt2(); if($verify['status']!=true){ return false; } config(['openai.api_key' => config('services.openai.key')]); } /** * Synthesize text via Azure text to speech * * */ public function synthesizeSpeech(Voice $voice, $text, $format, $file_name) { $model = ($voice->voice_type == 'standard') ? 'tts-1' : 'tts-1-hd'; $voice_id = explode('_', $voice->voice_id); $audio_stream = OpenAI::audio()->speech([ 'model' => $model, 'input' => $text, 'voice' => $voice_id[0], ]); $backup = new Backup(); $upload = $backup->download(); if (!$upload['status']) { return false; } Storage::disk('audio')->put($file_name, $audio_stream); $data['result_url'] = Storage::url($file_name); $data['name'] = $file_name; return $data; } }
Simpan