Merge pull request #1402 from trheyi/main

Enhance Message Filtering in LLM Context Conversion
This commit is contained in:
Max 2025-12-30 18:15:40 +08:00 committed by GitHub
commit 1564f50074
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -161,6 +161,14 @@ func (ast *Assistant) convertStoreMessageToContext(msg *storetypes.Message) *age
return nil return nil
} }
// Skip internal message types that should not be included in LLM context
// These types are for UI/internal use only and can confuse the LLM
// Note: "error" is kept so LLM can help troubleshoot issues
switch msg.Type {
case "tool_call", "loading", "action", "event":
return nil
}
// Extract content from Props // Extract content from Props
content := ast.extractContentFromProps(msg.Props, msg.Type) content := ast.extractContentFromProps(msg.Props, msg.Type)
if content == nil { if content == nil {