This commit is contained in:
mkm 2023-10-12 16:33:49 +08:00
parent fb7941acd6
commit 5b55620e75

View File

@ -83,8 +83,6 @@ class Pusher
$response=json_encode($resp,true);
}
$this->tts($resp['payload']['choices']['text'][0]['content']);
$connection->send($response);
// $total_tokens = $resp['payload']['usage']['text']['total_tokens'];
@ -180,7 +178,7 @@ class Pusher
}
function tts($text){
$name=time().'.mp3';
$name=time().rand(1,100000).'.mp3';
$tts=new extend\IFlytek\Xfyun\Speech\TtsClient($this->app_id,$this->api_key,$this->api_secret,$this->ttsConfig);
file_put_contents(public_path('tts').'/'.$name,$tts->request($text)->getBody()->getContents());
return 'https://chat.lihaink.cn/tts/'.$name;