合并分支 'akun' 到 'master'
Akun 查看合并请求 !1286
正在显示
1 个修改的文件
包含
13 行增加
和
2 行删除
| @@ -284,12 +284,23 @@ class InquiryForwardLogic extends BaseLogic | @@ -284,12 +284,23 @@ class InquiryForwardLogic extends BaseLogic | ||
| 284 | */ | 284 | */ |
| 285 | public function aiRewrite() | 285 | public function aiRewrite() |
| 286 | { | 286 | { |
| 287 | - $ai_command = AiCommand::where('key', 'inquiry_text_rewrite')->value('ai'); | ||
| 288 | - if (!$ai_command) { | 287 | + $ai_info = AiCommand::select(['ai', 'not_use_probability'])->where('key', 'inquiry_text_rewrite')->first(); |
| 288 | + if (!$ai_info) { | ||
| 289 | $this->fail('AI重写指令未配置'); | 289 | $this->fail('AI重写指令未配置'); |
| 290 | } | 290 | } |
| 291 | 291 | ||
| 292 | + $ai_command = $ai_info['inquiry_text_rewrite']; | ||
| 293 | + $not_use_probability = $ai_info['not_use_probability']; | ||
| 292 | $in_content = $this->param['message']; | 294 | $in_content = $this->param['message']; |
| 295 | + | ||
| 296 | + // 当原始询盘内容长度大于15个字符, 60%几率直接发送原始内容。 | ||
| 297 | + if (strlen($in_content) >= 15) { | ||
| 298 | + $randomNumber = rand(0, 100); | ||
| 299 | + if ($randomNumber < $not_use_probability) { | ||
| 300 | + return $this->success(['ai_message' => $in_content]); | ||
| 301 | + } | ||
| 302 | + } | ||
| 303 | + | ||
| 293 | $translateSl = Translate::translateSl($in_content); | 304 | $translateSl = Translate::translateSl($in_content); |
| 294 | $lang = $translateSl['texts']['sl'] ?? 'en'; | 305 | $lang = $translateSl['texts']['sl'] ?? 'en'; |
| 295 | if ($lang == 'en' || $lang == 'ja' || $lang == 'ko' || Str::contains($lang, 'zh')) { | 306 | if ($lang == 'en' || $lang == 'ja' || $lang == 'ko' || Str::contains($lang, 'zh')) { |
-
请 注册 或 登录 后发表评论