feat: improve first-turn and delayed-image replies
This commit is contained in:
@@ -256,6 +256,15 @@ class SystemOrchestrator:
|
||||
sanitized.append(normalized)
|
||||
return sanitized
|
||||
|
||||
@staticmethod
|
||||
def _ensure_first_reply_presence(text: str) -> str:
|
||||
cleaned = str(text or "").strip()
|
||||
if not cleaned:
|
||||
return "在呢"
|
||||
if cleaned.startswith(("在呢", "在哈", "在的", "在哦", "在")):
|
||||
return cleaned
|
||||
return f"在呢,{cleaned}"
|
||||
|
||||
@staticmethod
|
||||
def _extract_designer_name(transfer_cmd: str) -> str:
|
||||
text = str(transfer_cmd or "").strip()
|
||||
@@ -625,12 +634,19 @@ class SystemOrchestrator:
|
||||
total_elapsed = time.time() - process_start
|
||||
logger.info(f"[计时] user={user_id} AI思考: {ai_elapsed:.1f}s | 总耗时: {total_elapsed:.1f}s")
|
||||
|
||||
is_new_customer_first_turn = len(ai_history) == 0
|
||||
|
||||
# F. 发送并记录时间
|
||||
if std_res.should_reply:
|
||||
std_res.reply_content = self._sanitize_outbound_text(std_res.reply_content)
|
||||
meta = dict(std_res.metadata or {})
|
||||
meta.update({"acc_id": acc_id, "acc_type": acc_type})
|
||||
if is_new_customer_first_turn and "[转移会话]" in std_res.reply_content:
|
||||
if not str(meta.get("transfer_prelude") or "").strip():
|
||||
meta["transfer_prelude"] = "在呢,我叫设计师看下哈"
|
||||
std_res.metadata = meta
|
||||
if is_new_customer_first_turn and "[转移会话]" not in std_res.reply_content and int(std_res.msg_type or 0) == 0:
|
||||
std_res.reply_content = self._ensure_first_reply_presence(std_res.reply_content)
|
||||
|
||||
# 转接场景:先发一句安抚话,再发转接指令
|
||||
if "[转移会话]" in std_res.reply_content:
|
||||
|
||||
Reference in New Issue
Block a user