fix(agent): honor suggested-questions limit parameter

Treat limit as the authoritative upper bound instead of clamping it down
to the agent's Starters.Count, so ?limit=N no longer always returns 6.

Fixes #2238
This commit is contained in:
Jack Wang
2026-07-23 21:23:31 +08:00
committed by lyingbug
parent e0b6a71503
commit 43839f7830
10 changed files with 152 additions and 19 deletions
@@ -322,9 +322,8 @@ func (s *embedChannelService) SuggestedQuestions(
if ch == nil || !ch.ShowSuggestedQuestions {
return nil, nil
}
if limit <= 0 {
limit = 6
}
// A non-positive limit is forwarded as "unspecified" so GetSuggestedQuestions
// falls back to the agent's configured starter count rather than a fixed 6.
kbIDs := s.resolveKnowledgeBaseIDs(ctx, ch)
return s.agentService.GetSuggestedQuestions(ctx, ch.AgentID, kbIDs, nil, nil, limit)
}