|
...
|
...
|
@@ -2,13 +2,19 @@ |
|
|
|
|
|
|
|
namespace App\Http\Logic\Aside\Optimize;
|
|
|
|
|
|
|
|
use App\Helper\Common;
|
|
|
|
use App\Helper\Gpt;
|
|
|
|
use App\Helper\Translate;
|
|
|
|
use App\Http\Logic\Aside\BaseLogic;
|
|
|
|
use App\Models\Ai\AiCommand;
|
|
|
|
use App\Models\Inquiry\InquiryInfo;
|
|
|
|
use App\Models\Inquiry\InquiryProject;
|
|
|
|
use App\Models\Inquiry\InquiryProjectRoute;
|
|
|
|
use App\Models\Inquiry\InquiryRelayDetail;
|
|
|
|
use Illuminate\Support\Arr;
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
use Illuminate\Support\Facades\Log;
|
|
|
|
use Illuminate\Support\Str;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :询盘中心
|
|
...
|
...
|
@@ -200,6 +206,38 @@ class InquiryForwardLogic extends BaseLogic |
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return array_slice($lists, 0, $num, true);
|
|
|
|
return $this->success(array_slice($lists, 0, $num, true));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* AI重写询盘文案
|
|
|
|
* @return array
|
|
|
|
* @throws \App\Exceptions\AsideGlobalException
|
|
|
|
* @throws \App\Exceptions\BsideGlobalException
|
|
|
|
* @author Akun
|
|
|
|
* @date 2025/02/27 10:40
|
|
|
|
*/
|
|
|
|
public function aiRewrite()
|
|
|
|
{
|
|
|
|
$ai_command = AiCommand::where('key', ' inquiry_text_rewrite')->value('ai');
|
|
|
|
if (!$ai_command) {
|
|
|
|
$this->fail('AI重写指令未配置');
|
|
|
|
}
|
|
|
|
|
|
|
|
$in_content = $this->param['message'];
|
|
|
|
$translateSl = Translate::translateSl($in_content);
|
|
|
|
$lang = $translateSl['texts']['sl'] ?? 'en';
|
|
|
|
if ($lang == 'en' || $lang == 'ja' || $lang == 'ko' || Str::contains($lang, 'zh')) {
|
|
|
|
$lang = 'en';
|
|
|
|
}
|
|
|
|
|
|
|
|
$ai_command = str_replace('{incontent}', Arr::random(explode("\r\n", $in_content)), $ai_command);
|
|
|
|
|
|
|
|
$text = Gpt::instance()->openai_chat_qqs($ai_command);
|
|
|
|
if ($lang != 'en' && !Str::contains($lang, 'zh')) {
|
|
|
|
$text = Translate::tran($text, $lang);
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this->success(['ai_message' => Common::deal_str($text)]);
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|