fix: update web_search_tavily handling for webchat platform (#4633)

* fix: update web_search_tavily handling for webchat platform

* chore: style consistent
This commit is contained in:
Soulter
2026-01-23 19:52:31 +08:00
committed by GitHub
parent 90b57eb5cb
commit eebe31f69d
2 changed files with 4 additions and 1 deletions
+3 -1
View File
@@ -56,8 +56,10 @@ class MainAgentHooks(BaseAgentRunHooks[AstrAgentContext]):
)
# special handle web_search_tavily
platform_name = run_context.context.event.get_platform_name()
if (
tool.name == "web_search_tavily"
platform_name == "webchat"
and tool.name == "web_search_tavily"
and len(run_context.messages) > 0
and tool_result
and len(tool_result.content)
@@ -41,6 +41,7 @@ TOOL_CALL_PROMPT = (
"You MUST NOT return an empty response, especially after invoking a tool."
"Before calling any tool, provide a brief explanatory message to the user stating the purpose of the tool call."
"After the tool call is completed, you must briefly summarize the results returned by the tool for the user."
"Keep the role-play and style consistent throughout the conversation."
)
CHATUI_SPECIAL_DEFAULT_PERSONA_PROMPT = (