feat(agent): add tool result persistence trimming for large outputs

Introduce display_type-based output stripping for SSE/DB storage and
add knowledge_chunks_list display type for list_knowledge_chunks.
This commit is contained in:
wizardchen
2026-06-16 00:49:38 +08:00
committed by lyingbug
parent 16f2a46465
commit efe8b6f41d
6 changed files with 360 additions and 7 deletions
@@ -9,6 +9,7 @@ import (
"strings"
"time"
agenttools "github.com/Tencent/WeKnora/internal/agent/tools"
"github.com/Tencent/WeKnora/internal/models/chat"
"github.com/Tencent/WeKnora/internal/types"
"github.com/Tencent/WeKnora/internal/types/interfaces"
@@ -227,7 +228,7 @@ func toolCallOutput(tc types.ToolCall) string {
}
return "Error: tool call failed"
}
return tc.Result.Output
return agenttools.CompactToolOutputForHistory(tc.Name, tc.Result)
}
// extractImageCaptionsFromMessage concatenates non-empty Caption fields from