Skip to content

Commit 4d1b427

Browse files
committed
Enhance Message Filtering in LLM Context Conversion
- Added logic to skip internal message types ("tool_call", "loading", "action", "event") during LLM context conversion to prevent confusion, while retaining "error" messages for troubleshooting purposes. - Improved clarity in the handling of message types to ensure only relevant content is processed for LLM interactions.
1 parent 195391a commit 4d1b427

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

agent/assistant/history.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,14 @@ func (ast *Assistant) convertStoreMessageToContext(msg *storetypes.Message) *age
161161
return nil
162162
}
163163

164+
// Skip internal message types that should not be included in LLM context
165+
// These types are for UI/internal use only and can confuse the LLM
166+
// Note: "error" is kept so LLM can help troubleshoot issues
167+
switch msg.Type {
168+
case "tool_call", "loading", "action", "event":
169+
return nil
170+
}
171+
164172
// Extract content from Props
165173
content := ast.extractContentFromProps(msg.Props, msg.Type)
166174
if content == nil {

0 commit comments

Comments
 (0)