作者 刘锟

update

@@ -260,7 +260,7 @@ class SyncInquiryRelay extends Command @@ -260,7 +260,7 @@ class SyncInquiryRelay extends Command
260 //重写询盘内容 260 //重写询盘内容
261 $ai_message_list = []; 261 $ai_message_list = [];
262 for ($i = 0; $i < count($forward_list); $i++) { 262 for ($i = 0; $i < count($forward_list); $i++) {
263 - $message_re = $inquiryForwardLogic->aiRewrite($data['message']); 263 + $message_re = $inquiryForwardLogic->aiRewrite($data['message'], $data['title'], $keywords);
264 if (isset($message_re['ai_message']) && $message_re['ai_message']) { 264 if (isset($message_re['ai_message']) && $message_re['ai_message']) {
265 $ai_message_list[] = $message_re['ai_message']; 265 $ai_message_list[] = $message_re['ai_message'];
266 } 266 }
@@ -328,15 +328,22 @@ class InquiryForwardLogic extends BaseLogic @@ -328,15 +328,22 @@ class InquiryForwardLogic extends BaseLogic
328 /** 328 /**
329 * AI重写询盘文案 329 * AI重写询盘文案
330 * @param $in_content 330 * @param $in_content
  331 + * @param $title
  332 + * @param $keywords
331 * @return array 333 * @return array
332 * @throws \App\Exceptions\AsideGlobalException 334 * @throws \App\Exceptions\AsideGlobalException
333 * @throws \App\Exceptions\BsideGlobalException 335 * @throws \App\Exceptions\BsideGlobalException
334 * @author Akun 336 * @author Akun
335 * @date 2025/02/27 10:40 337 * @date 2025/02/27 10:40
336 */ 338 */
337 - public function aiRewrite($in_content) 339 + public function aiRewrite($in_content, $title = '', $keywords = '')
338 { 340 {
339 - $ai_info = AiCommand::select(['ai', 'not_use_probability'])->where('key', 'inquiry_text_rewrite')->first(); 341 + if ($title && $keywords) {
  342 + $command_key = 'inquiry_text_rewrite_v2';
  343 + } else {
  344 + $command_key = 'inquiry_text_rewrite';
  345 + }
  346 + $ai_info = AiCommand::select(['ai', 'not_use_probability'])->where('key', $command_key)->first();
340 if (!$ai_info) { 347 if (!$ai_info) {
341 $this->fail('AI重写指令未配置'); 348 $this->fail('AI重写指令未配置');
342 } 349 }
@@ -358,6 +365,10 @@ class InquiryForwardLogic extends BaseLogic @@ -358,6 +365,10 @@ class InquiryForwardLogic extends BaseLogic
358 $lang = 'en'; 365 $lang = 'en';
359 } 366 }
360 367
  368 + if ($title && $keywords) {
  369 + $ai_command = str_replace('{title}', $title, $ai_command);
  370 + $ai_command = str_replace('{keywords}', $keywords, $ai_command);
  371 + }
361 $ai_command = str_replace('{incontent}', Arr::random(explode("\r\n", $in_content)), $ai_command); 372 $ai_command = str_replace('{incontent}', Arr::random(explode("\r\n", $in_content)), $ai_command);
362 373
363 $text = Gpt::instance()->openai_chat_qqs($ai_command); 374 $text = Gpt::instance()->openai_chat_qqs($ai_command);