fixed
This commit is contained in:
@@ -204,13 +204,23 @@ class Events extends \think\worker\Events
|
|||||||
// 将音频数据转换为文件,以便传递给iFLYTEK SDK
|
// 将音频数据转换为文件,以便传递给iFLYTEK SDK
|
||||||
$tempFile = tempnam(sys_get_temp_dir(), 'audio');
|
$tempFile = tempnam(sys_get_temp_dir(), 'audio');
|
||||||
file_put_contents($tempFile, $audioData);
|
file_put_contents($tempFile, $audioData);
|
||||||
|
// 设置请求参数
|
||||||
|
//$params = [
|
||||||
|
// 'sample_rate' => 16000, // 采样率
|
||||||
|
// 'language' => 'zh_cn', // 语言
|
||||||
|
//];
|
||||||
// 设置转写参数
|
// 设置转写参数
|
||||||
$lfasrConfig = [
|
$lfasrConfig = [
|
||||||
'hasParticiple' => 'true'
|
'hasParticiple' => 'true',
|
||||||
|
'sample_rate' => 16000, // 采样率
|
||||||
|
'language' => 'zh_cn', // 语言
|
||||||
//...
|
//...
|
||||||
];
|
];
|
||||||
$app_id = 'de02da3d';
|
$xunfei_record_config = config('xunfei_record_config');
|
||||||
$secret_key = 'MjcyOGE5ODg3ODM2ZWU5MTNiODc0M2Zl';
|
$app_id = $xunfei_record_config['appid'];
|
||||||
|
$secret_key = $xunfei_record_config['secretKey'];
|
||||||
|
|
||||||
|
|
||||||
$filePath = $tempFile;//'/Users/wh/Desktop/test.wav';
|
$filePath = $tempFile;//'/Users/wh/Desktop/test.wav';
|
||||||
// 这里的$app_id、$secret_key是在开放平台控制台获得
|
// 这里的$app_id、$secret_key是在开放平台控制台获得
|
||||||
$client = new LfasrClient($app_id, $secret_key, $lfasrConfig);
|
$client = new LfasrClient($app_id, $secret_key, $lfasrConfig);
|
||||||
@@ -227,6 +237,10 @@ class Events extends \think\worker\Events
|
|||||||
// 清理临时文件
|
// 清理临时文件
|
||||||
unlink($tempFile);
|
unlink($tempFile);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 处理翻译结果,例如保存到数据库或返回给前端
|
||||||
Gateway::sendToClient($client_id, $result);
|
Gateway::sendToClient($client_id, $result);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -196,6 +196,11 @@ return [
|
|||||||
'base_url'=>'https://serverfastgpt.excn.top/api/v1/chat/completions',
|
'base_url'=>'https://serverfastgpt.excn.top/api/v1/chat/completions',
|
||||||
'APIKey'=>'fastgpt-e5wq9u6phvyfq4znrXfOuTHKHQHGjpcVBYay602ai5zv4HeOJRMDwT3ptm6',
|
'APIKey'=>'fastgpt-e5wq9u6phvyfq4znrXfOuTHKHQHGjpcVBYay602ai5zv4HeOJRMDwT3ptm6',
|
||||||
],
|
],
|
||||||
|
//讯飞录音接口
|
||||||
|
'xunfei_record_config'=>[
|
||||||
|
'secretKey'=>'MjcyOGE5ODg3ODM2ZWU5MTNiODc0M2Zl',
|
||||||
|
'appid'=>'de02da3d'
|
||||||
|
],
|
||||||
//业务基础架构配置
|
//业务基础架构配置
|
||||||
'service_framework_config'=>[
|
'service_framework_config'=>[
|
||||||
//内网访问架构中放行的端口
|
//内网访问架构中放行的端口
|
||||||
|
|||||||
Reference in New Issue
Block a user