feat: Integrate web search configuration and enhance input field functionality

- Added logic to load and manage web search configuration in the InputField component, ensuring proper handling of web search states.
- Implemented user notifications for unconfigured web search settings, guiding users to the appropriate settings page.
- Enhanced the AgentStreamDisplay component to improve tooltip content rendering for knowledge base citations.
- Updated event data structures to include total duration in milliseconds for better precision in agent completion events.
- Refactored citation handling to ensure inline citations are displayed correctly, improving user experience in content rendering.
This commit is contained in:
wizardchen
2025-11-12 01:18:12 +08:00
parent 14d0e663cc
commit a28c0f8b01
6 changed files with 288 additions and 183 deletions
+6 -6
View File
@@ -376,12 +376,12 @@ func (e *AgentEngine) executeLoop(
Type: event.EventAgentComplete,
SessionID: sessionID,
Data: event.AgentCompleteData{
FinalAnswer: state.FinalAnswer,
KnowledgeRefs: knowledgeRefsInterface,
AgentSteps: state.RoundSteps, // Include detailed execution steps for message storage
TotalSteps: len(state.RoundSteps),
TotalDuration: time.Since(startTime).Milliseconds(),
MessageID: messageID, // Include message ID for proper message update
FinalAnswer: state.FinalAnswer,
KnowledgeRefs: knowledgeRefsInterface,
AgentSteps: state.RoundSteps, // Include detailed execution steps for message storage
TotalSteps: len(state.RoundSteps),
TotalDurationMs: time.Since(startTime).Milliseconds(),
MessageID: messageID, // Include message ID for proper message update
},
})
+10 -4
View File
@@ -209,13 +209,19 @@ Your pretraining data may be outdated or incorrect. Do NOT rely on any internal
<Citations_and_Evidence>
- Within the Answer section (not in intermediate tool steps), place citations inline near the content they support. Use one or more HTML blocks, each on its own line immediately after the relevant paragraph/section. Do NOT aggregate all citations at the end of the answer.
- Within the Answer section (not in intermediate tool steps), place citations inline near the content they support. Citations must appear within the same line as the supported sentence, preferably immediately after the relevant clause or at the end of the sentence; do NOT place citations on a separate line. Do NOT aggregate all citations at the end of the answer.
Include only sources actually used in the answer.
Item formats (compact attributes for easy parsing):
- Knowledge Base: <kb kb_id="<kb_id>" doc="<doc_name>" chunk_id="<chunk_id>" />
- Web Page: <web url="<url>" title="<title>" />
Example:
Paragraph explaining concept A...<kb kb_id="kb_123" doc="spec.md" chunk_id="c_42" />
Paragraph summarizing current news...<web url="https://example.com" title="Example" />
Good Example:
Paragraph explaining concept A... <kb kb_id="kb_123" doc="spec.md" chunk_id="c_42" />...
Statement supported by multiple sources... <kb kb_id="kb_456" doc="design.md" chunk_id="c_7" /> <web url="https://example.com" title="Example" />
Bad Example:
Paragraph explaining concept A...
<kb kb_id="kb_123" doc="spec.md" chunk_id="c_42" />
Paragraph summarizing current news...
<web url="https://example.com" title="Example" />
</Citations_and_Evidence>
`