更新
This commit is contained in:
parent
7b89e9bea2
commit
2e933457b9
@ -74,6 +74,8 @@ class Pusher
|
||||
if ($tts_type == 1) {
|
||||
if (count($arr) == 2) {
|
||||
$resp['payload']['choices']['tts_text'] = $text . $arr[0];
|
||||
$text = '';
|
||||
// $this->tts( $text . $arr[0]);
|
||||
unset($arr[0]);
|
||||
$tt='';
|
||||
$pattern = "/[,.?!;:]/";
|
||||
@ -83,10 +85,7 @@ class Pusher
|
||||
}
|
||||
if ($tt!=''||preg_match($pattern, $tt)) {
|
||||
$text.=$tt;
|
||||
} else {
|
||||
$text = '';
|
||||
}
|
||||
|
||||
$response = json_encode($resp, true);
|
||||
} else {
|
||||
$resp['payload']['choices']['tts_text'] = '';
|
||||
@ -103,9 +102,12 @@ class Pusher
|
||||
$resp['payload']['choices']['tts_text'] = $text;
|
||||
} else {
|
||||
$resp['payload']['choices']['tts_text'] = $text.$a;
|
||||
// $this->tts($text.$a);
|
||||
|
||||
}
|
||||
}else{
|
||||
$resp['payload']['choices']['tts_text'] = $text.$a;
|
||||
// $this->tts($text.$a);
|
||||
}
|
||||
$text = '';
|
||||
$response = json_encode($resp, true);
|
||||
@ -206,9 +208,14 @@ class Pusher
|
||||
|
||||
function tts($text)
|
||||
{
|
||||
$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;
|
||||
$client = new AsyncTcpConnection('ws://0.0.0.0:8484');
|
||||
$data = $this->getBody($this->app_id, ["content"=> "你好"]);
|
||||
|
||||
$client->send($data);
|
||||
var_dump(22222);
|
||||
// $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;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user