feat: 定义 SessionManager 接口 + SessionConfigPatch 模型
This commit is contained in:
@@ -21,6 +21,26 @@ func DefaultConfig() SessionConfig {
|
||||
return SessionConfig{TTSEnabled: true, DetailLevel: "low", Language: "zh-CN"}
|
||||
}
|
||||
|
||||
// SessionConfigPatch 会话配置增量更新(指针字段表示"未传则不更新")。
|
||||
type SessionConfigPatch struct {
|
||||
TTSEnabled *bool `json:"tts_enabled,omitempty"`
|
||||
DetailLevel *string `json:"detail_level,omitempty"`
|
||||
Language *string `json:"language,omitempty"`
|
||||
}
|
||||
|
||||
// Apply 将 patch 中的非 nil 字段覆盖到 cfg。
|
||||
func (p SessionConfigPatch) Apply(cfg *SessionConfig) {
|
||||
if p.TTSEnabled != nil {
|
||||
cfg.TTSEnabled = *p.TTSEnabled
|
||||
}
|
||||
if p.DetailLevel != nil {
|
||||
cfg.DetailLevel = *p.DetailLevel
|
||||
}
|
||||
if p.Language != nil {
|
||||
cfg.Language = *p.Language
|
||||
}
|
||||
}
|
||||
|
||||
// Message 对话消息。
|
||||
type Message struct {
|
||||
Role string `json:"role"` // "user" | "assistant"
|
||||
|
||||
Reference in New Issue
Block a user