feat(agent): add intent prompt customization in agent editor

Allow per-intent system prompt overrides for non-retrieval intents in normal mode.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
helloandyzhang
2026-05-26 18:06:43 +08:00
committed by lyingbug
parent 09892ef763
commit e6a469631b
13 changed files with 322 additions and 29 deletions
+5
View File
@@ -59,6 +59,10 @@ type PipelineRequest struct {
// File attachments support
Attachments MessageAttachments `json:"-"`
// IntentPromptOverrides holds agent-level intent prompt overrides for the
// query-understanding stage. Empty values fall back to tenant/global defaults.
IntentPromptOverrides map[string]string `json:"-"`
// Misc request-scoped config
TenantID uint64 `json:"-"`
WebSearchEnabled bool `json:"-"`
@@ -221,6 +225,7 @@ func (c *ChatManage) Clone() *ChatManage {
WebFetchEnabled: c.WebFetchEnabled,
WebFetchTopN: c.WebFetchTopN,
Language: c.Language,
IntentPromptOverrides: maps.Clone(c.IntentPromptOverrides),
},
PipelineState: PipelineState{
RewriteQuery: c.RewriteQuery,
+4
View File
@@ -256,6 +256,10 @@ type CustomAgentConfig struct {
FallbackResponse string `yaml:"fallback_response" json:"fallback_response"`
// Fallback prompt (when FallbackStrategy is "model")
FallbackPrompt string `yaml:"fallback_prompt" json:"fallback_prompt"`
// IntentPrompts holds per-intent system prompt overrides for non-retrieval
// intents (greeting, chitchat, etc.). Empty values fall back to templates
// under config/prompt_templates/intent_prompts.yaml.
IntentPrompts map[string]string `yaml:"intent_prompts" json:"intent_prompts,omitempty"`
// ===== Suggested Prompts =====
// 推荐问题列表,用于在前端对话面板展示快捷提问