feat(agent): add per-agent citation output toggle

Move citation protocol injection to the system layer so custom prompts no
longer own citation syntax. Agents can disable inline citations while source
aliases still encode and decode tool arguments correctly.
This commit is contained in:
wizardchen
2026-07-16 21:46:52 +08:00
committed by lyingbug
parent 014164ae44
commit b862c2e45d
26 changed files with 292 additions and 78 deletions
@@ -154,7 +154,8 @@ func (s *sessionService) resolveRetrievalTenantID(
// applyAgentOverridesToChatManage applies custom agent configuration overrides
// to a ChatManage object that was initialized with system defaults.
// This covers: system prompt, context template, temperature, max tokens, thinking,
// retrieval thresholds, rewrite settings, fallback settings, FAQ strategy, and history turns.
// citation output, retrieval thresholds, rewrite settings, fallback settings, FAQ strategy,
// and history turns.
func (s *sessionService) applyAgentOverridesToChatManage(
ctx context.Context,
customAgent *types.CustomAgent,
@@ -188,6 +189,7 @@ func (s *sessionService) applyAgentOverridesToChatManage(
// EnsureDefaults pins nil to explicit false so thinking_control wire formats
// always receive a value.
cm.SummaryConfig.Thinking = customAgent.Config.Thinking
cm.CitationEnabled = customAgent.Config.CitationEnabled
if customAgent.Config.Thinking != nil {
logger.Infof(ctx, "Using custom agent's thinking: %v", *customAgent.Config.Thinking)
} else {