|
...
|
...
|
@@ -284,12 +284,23 @@ class InquiryForwardLogic extends BaseLogic |
|
|
|
*/
|
|
|
|
public function aiRewrite()
|
|
|
|
{
|
|
|
|
$ai_command = AiCommand::where('key', 'inquiry_text_rewrite')->value('ai');
|
|
|
|
if (!$ai_command) {
|
|
|
|
$ai_info = AiCommand::select(['ai', 'not_use_probability'])->where('key', 'inquiry_text_rewrite')->first();
|
|
|
|
if (!$ai_info) {
|
|
|
|
$this->fail('AI重写指令未配置');
|
|
|
|
}
|
|
|
|
|
|
|
|
$ai_command = $ai_info['inquiry_text_rewrite'];
|
|
|
|
$not_use_probability = $ai_info['not_use_probability'];
|
|
|
|
$in_content = $this->param['message'];
|
|
|
|
|
|
|
|
// 当原始询盘内容长度大于15个字符, 60%几率直接发送原始内容。
|
|
|
|
if (strlen($in_content) >= 15) {
|
|
|
|
$randomNumber = rand(0, 100);
|
|
|
|
if ($randomNumber < $not_use_probability) {
|
|
|
|
return $this->success(['ai_message' => $in_content]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$translateSl = Translate::translateSl($in_content);
|
|
|
|
$lang = $translateSl['texts']['sl'] ?? 'en';
|
|
|
|
if ($lang == 'en' || $lang == 'ja' || $lang == 'ko' || Str::contains($lang, 'zh')) {
|
...
|
...
|
|