更新
This commit is contained in:
parent
fb7941acd6
commit
5b55620e75
@ -83,8 +83,6 @@ class Pusher
|
|||||||
$response=json_encode($resp,true);
|
$response=json_encode($resp,true);
|
||||||
|
|
||||||
}
|
}
|
||||||
$this->tts($resp['payload']['choices']['text'][0]['content']);
|
|
||||||
|
|
||||||
$connection->send($response);
|
$connection->send($response);
|
||||||
|
|
||||||
// $total_tokens = $resp['payload']['usage']['text']['total_tokens'];
|
// $total_tokens = $resp['payload']['usage']['text']['total_tokens'];
|
||||||
@ -180,7 +178,7 @@ class Pusher
|
|||||||
}
|
}
|
||||||
|
|
||||||
function tts($text){
|
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);
|
$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());
|
file_put_contents(public_path('tts').'/'.$name,$tts->request($text)->getBody()->getContents());
|
||||||
return 'https://chat.lihaink.cn/tts/'.$name;
|
return 'https://chat.lihaink.cn/tts/'.$name;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user