diff --git a/astrbot/core/astr_agent_hooks.py b/astrbot/core/astr_agent_hooks.py index 1213c418ad..b3d82a0d29 100644 --- a/astrbot/core/astr_agent_hooks.py +++ b/astrbot/core/astr_agent_hooks.py @@ -94,12 +94,14 @@ async def on_tool_end( and isinstance(first_part.content, str) ): # we assume system part is str - first_part.content += ( + citation_prompt = ( "Always cite web search results you rely on. " "Index is a unique identifier for each search result. " "Use the exact citation format index (e.g. abcd.3) " "after the sentence that uses the information. Do not invent citations." ) + if citation_prompt not in first_part.content: + first_part.content += citation_prompt class EmptyAgentHooks(BaseAgentRunHooks[AstrAgentContext]):