perf: 优化 AI 设置
This commit is contained in:
@@ -1359,18 +1359,19 @@ class DialogController extends AbstractController
|
||||
if (Base::isError($result)) {
|
||||
return $result;
|
||||
}
|
||||
if (strlen($result['data']) < 1) {
|
||||
if (strlen($result['data']['text']) < 1) {
|
||||
return Base::retError('转文字失败');
|
||||
}
|
||||
// 翻译
|
||||
if ($translate) {
|
||||
$result = Extranet::openAItranslations($result['data'], Doo::getLanguages($translate));
|
||||
if (Base::isError($result)) {
|
||||
return $result;
|
||||
}
|
||||
// 不翻译
|
||||
if (!$translate) {
|
||||
return Base::retSuccess('success', $result['data']['text']);
|
||||
}
|
||||
// 返回
|
||||
return $result;
|
||||
// 需要翻译
|
||||
$result = Extranet::openAItranslations($result['data']['text'], Doo::getLanguages($translate));
|
||||
if (Base::isError($result)) {
|
||||
return $result;
|
||||
}
|
||||
return Base::retSuccess('success', $result['data']['translated_text']);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1939,13 +1940,16 @@ class DialogController extends AbstractController
|
||||
}
|
||||
WebSocketDialog::checkDialog($msg->dialog_id);
|
||||
//
|
||||
$res = Extranet::openAItranscriptions(public_path($msgData['path']));
|
||||
if (Base::isError($res)) {
|
||||
return $res;
|
||||
$result = Extranet::openAItranscriptions(public_path($msgData['path']));
|
||||
if (Base::isError($result)) {
|
||||
return $result;
|
||||
}
|
||||
//
|
||||
$msg->updateInstance([
|
||||
'msg' => array_merge($msgData, ['text' => $res['data'], 'text_userid' => [$user->userid]]),
|
||||
'msg' => array_merge($msgData, [
|
||||
'text' => $result['data']['text'],
|
||||
'text_userid' => [$user->userid]
|
||||
]),
|
||||
]);
|
||||
$msg->save();
|
||||
return Base::retSuccess("success", $msg);
|
||||
@@ -2005,15 +2009,15 @@ class DialogController extends AbstractController
|
||||
if ($msg->type === 'text' && $msgData['type'] === 'md') {
|
||||
$msgData['text'] = preg_replace('/:::\s*reasoning.*?:::/s', '', $msgData['text']);
|
||||
}
|
||||
$res = Extranet::openAItranslations($msgData['text'], $targetLanguage);
|
||||
if (Base::isError($res)) {
|
||||
return $res;
|
||||
$result = Extranet::openAItranslations($msgData['text'], $targetLanguage);
|
||||
if (Base::isError($result)) {
|
||||
return $result;
|
||||
}
|
||||
$row = WebSocketDialogMsgTranslate::createInstance([
|
||||
'dialog_id' => $msg->dialog_id,
|
||||
'msg_id' => $msg_id,
|
||||
'language' => $language,
|
||||
'content' => $res['data'],
|
||||
'content' => $result['data']['translated_text'],
|
||||
]);
|
||||
$row->save();
|
||||
//
|
||||
|
||||
@@ -921,8 +921,6 @@ class SystemController extends AbstractController
|
||||
}
|
||||
return Base::retSuccess('success', [
|
||||
'ip' => Base::getIp(),
|
||||
'ip-info' => Extranet::getIpInfo(Base::getIp()),
|
||||
'ip-gcj02' => Extranet::getIpGcj02(Base::getIp()),
|
||||
'ip-iscn' => Base::isCnIp(Base::getIp()),
|
||||
'header' => Request::header(),
|
||||
'token' => Doo::userToken(),
|
||||
@@ -962,40 +960,6 @@ class SystemController extends AbstractController
|
||||
return Base::isCnIp(Request::input('ip'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @api {get} api/system/get/ipgcj02 18. 获取IP地址经纬度
|
||||
*
|
||||
* @apiVersion 1.0.0
|
||||
* @apiGroup system
|
||||
* @apiName get__ipgcj02
|
||||
*
|
||||
* @apiParam {String} ip IP值
|
||||
*
|
||||
* @apiSuccess {Number} ret 返回状态码(1正确、0错误)
|
||||
* @apiSuccess {String} msg 返回信息(错误描述)
|
||||
* @apiSuccess {Object} data 返回数据
|
||||
*/
|
||||
public function get__ipgcj02() {
|
||||
return Extranet::getIpGcj02(Request::input("ip"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @api {get} api/system/get/ipinfo 19. 获取IP地址详细信息
|
||||
*
|
||||
* @apiVersion 1.0.0
|
||||
* @apiGroup system
|
||||
* @apiName get__ipinfo
|
||||
*
|
||||
* @apiParam {String} ip IP值
|
||||
*
|
||||
* @apiSuccess {Number} ret 返回状态码(1正确、0错误)
|
||||
* @apiSuccess {String} msg 返回信息(错误描述)
|
||||
* @apiSuccess {Object} data 返回数据
|
||||
*/
|
||||
public function get__ipinfo() {
|
||||
return Extranet::getIpInfo(Request::input("ip"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @api {post} api/system/imgupload 20. 上传图片
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user