@@ -783,17 +783,23 @@ async def _handle_webchat(
783783 if not user_prompt or not chatui_session_id or not session or session .display_name :
784784 return
785785
786- llm_resp = await prov .text_chat (
787- system_prompt = (
788- "You are a conversation title generator. "
789- "Generate a concise title in the same language as the user’s input, "
790- "no more than 10 words, capturing only the core topic."
791- "If the input is a greeting, small talk, or has no clear topic, "
792- "(e.g., “hi”, “hello”, “haha”), return <None>. "
793- "Output only the title itself or <None>, with no explanations."
794- ),
795- prompt = f"Generate a concise title for the following user query:\n { user_prompt } " ,
796- )
786+ try :
787+ llm_resp = await prov .text_chat (
788+ system_prompt = (
789+ "You are a conversation title generator. "
790+ "Generate a concise title in the same language as the user’s input, "
791+ "no more than 10 words, capturing only the core topic."
792+ "If the input is a greeting, small talk, or has no clear topic, "
793+ "(e.g., “hi”, “hello”, “haha”), return <None>. "
794+ "Output only the title itself or <None>, with no explanations."
795+ ),
796+ prompt = f"Generate a concise title for the following user query:\n { user_prompt } " ,
797+ )
798+ except Exception :
799+ logger .exception (
800+ "Failed to generate webchat title for session %s" , chatui_session_id
801+ )
802+ return
797803 if llm_resp and llm_resp .completion_text :
798804 title = llm_resp .completion_text .strip ()
799805 if not title or "<None>" in title :
@@ -836,7 +842,7 @@ def _apply_sandbox_tools(
836842 req .func_tool .add_tool (PYTHON_TOOL )
837843 req .func_tool .add_tool (FILE_UPLOAD_TOOL )
838844 req .func_tool .add_tool (FILE_DOWNLOAD_TOOL )
839- req .system_prompt + = f"\n { SANDBOX_MODE_PROMPT } \n "
845+ req .system_prompt = f"{ req . system_prompt or '' } \n { SANDBOX_MODE_PROMPT } \n "
840846
841847
842848def _proactive_cron_job_tools (req : ProviderRequest ) -> None :
0 commit comments