Refactor assistant greeting logic to conditionally use system prompt for generated openers. Update related tests to verify new behavior and ensure correct metadata handling in API responses. Enhance UI to reflect changes in opener management based on generated opener settings.

This commit is contained in:
Xin Wang
2026-03-02 02:38:45 +08:00
parent 31b3969b96
commit 4d553de34d
5 changed files with 98 additions and 51 deletions

View File

@@ -780,7 +780,6 @@ class DuplexPipeline:
if not self.llm_service:
return None
prompt_hint = (self._runtime_greeting or "").strip()
system_context = (self.conversation.system_prompt or self._runtime_system_prompt or "").strip()
# Keep context concise to avoid overloading greeting generation.
if len(system_context) > 1200:
@@ -793,8 +792,6 @@ class DuplexPipeline:
user_prompt = "请生成一句中文开场白不超过25个汉字"
if system_context:
user_prompt += f"\n\n以下是该助手的系统提示词,请据此决定语气、角色和边界:\n{system_context}"
if prompt_hint:
user_prompt += f"\n\n额外风格提示:{prompt_hint}"
try:
generated = await self.llm_service.generate(