feat:添加对话情景功能

This commit is contained in:
2026-06-14 20:32:30 +08:00
parent c3118dd72a
commit b60e513317
20 changed files with 438 additions and 59 deletions

View File

@@ -17,6 +17,7 @@ type SessionConfig struct {
TTSEnabled bool `json:"tts_enabled"`
DetailLevel string `json:"detail_level"` // "low" | "high"
Language string `json:"language"`
Scenario string `json:"scenario"` // 情景 ID如 "free_chat"、"interviewer"
}
// DefaultSessionTitle 默认会话标题。
@@ -24,7 +25,7 @@ const DefaultSessionTitle = "新对话"
// DefaultConfig 默认会话配置。
func DefaultConfig() SessionConfig {
return SessionConfig{TTSEnabled: true, DetailLevel: "low", Language: "zh-CN"}
return SessionConfig{TTSEnabled: true, DetailLevel: "low", Language: "zh-CN", Scenario: "free_chat"}
}
// SessionConfigPatch 会话配置增量更新(指针字段表示"未传则不更新")。
@@ -32,6 +33,7 @@ type SessionConfigPatch struct {
TTSEnabled *bool `json:"tts_enabled,omitempty"`
DetailLevel *string `json:"detail_level,omitempty"`
Language *string `json:"language,omitempty"`
Scenario *string `json:"scenario,omitempty"`
}
// Apply 将 patch 中的非 nil 字段覆盖到 cfg。
@@ -45,6 +47,9 @@ func (p SessionConfigPatch) Apply(cfg *SessionConfig) {
if p.Language != nil {
cfg.Language = *p.Language
}
if p.Scenario != nil {
cfg.Scenario = *p.Scenario
}
}
// User 用户。
@@ -81,6 +86,7 @@ type WsConfig struct {
TTSEnabled *bool `json:"tts_enabled,omitempty"`
DetailLevel *string `json:"detail_level,omitempty"`
Language *string `json:"language,omitempty"`
Scenario *string `json:"scenario,omitempty"`
} `json:"payload"`
}