package console // yunyan 自管 Agent 配置数据模型(表:agent)。 // // 不同于 modules/agents 旧实现(仅代理转发 polychat 的 /open/v1),这是 yunyan 自己的一套 agents: // 在 console 编排已配置的第三方服务(ThirdSvcConfig),配置最终「下发客户端」,由客户端调各服务完成 // 对话/翻译等能力。借鉴 polychat-agent 的「agent 通过 service_id 引用 service」配置模型,精简为 // 「服务编排 + 系统提示词 + 语言/性别/开场白 + 音色覆盖」,MCP/指令/Hook/变量等后续按需再加。 // // 四种类型引用的服务(均引用 ThirdSvcConfig.Id): // chat 对话: SttSvcId + LlmSvcId + TtsSvcId // translate 翻译: SttSvcId + MtSvcId + TtsSvcId // sts-chat 端到端对话: StsSvcId // ast-translate 端到端翻译: AstSvcId // Agent 类型取值(与前端一致)。 const ( AgentTypeChat = "chat" AgentTypeTranslate = "translate" AgentTypeStsChat = "sts-chat" AgentTypeAstTranslate = "ast-translate" ) // AgentVoice 音色覆盖项(语言+性别 → 具体音色名,覆盖所引用 TTS 服务的默认音色)。 type AgentVoice struct { Language string `json:"language"` // BCP-47,如 zh-CN Gender int32 `json:"gender"` // 1 男 2 女(0 不限) Voice string `json:"voice"` // provider 特定音色名,如 zh-CN-XiaoxiaoNeural } // AgentConfig console 自管的 agent 配置(表:agent_config,按应用分离)。一行 = 某应用作用域下一个可下发客户端的智能体。 // voice_map 借助 gorm serializer:json 存 jsonb 列;support_langs 逗号分隔 BCP-47(同第三方服务 languages 约定)。 // // 按应用分离:AppName=''为全局默认、'X'为应用X覆盖;业务字符串 Id 改用代理主键 RowId + 唯一索引(app_name,id)。 // 引用的第三方服务(SttSvcId 等)在同一应用作用域内解析、无则回退全局。 type AgentConfig struct { RowId uint64 `gorm:"primaryKey;autoIncrement;column:row_id" json:"row_id"` AppName string `gorm:"column:app_name;size:64;uniqueIndex:uidx_agent_config,priority:1" json:"app_name"` // ''=全局默认 Id string `gorm:"column:id;size:64;uniqueIndex:uidx_agent_config,priority:2" json:"id"` Name string `gorm:"column:name;size:64" json:"name"` Type string `gorm:"column:type;size:32" json:"type"` // chat|translate|sts-chat|ast-translate Description string `gorm:"column:description" json:"description"` AvatarUrl string `gorm:"column:avatar_url" json:"avatar_url"` Enable bool `gorm:"column:enable" json:"enable"` // 服务编排:均引用 ThirdSvcConfig.Id,按 Type 用其中若干(见文件头映射)。 SttSvcId string `gorm:"column:stt_svc_id;size:64" json:"stt_svc_id"` LlmSvcId string `gorm:"column:llm_svc_id;size:64" json:"llm_svc_id"` TtsSvcId string `gorm:"column:tts_svc_id;size:64" json:"tts_svc_id"` MtSvcId string `gorm:"column:mt_svc_id;size:64" json:"mt_svc_id"` StsSvcId string `gorm:"column:sts_svc_id;size:64" json:"sts_svc_id"` AstSvcId string `gorm:"column:ast_svc_id;size:64" json:"ast_svc_id"` // 逻辑配置 SystemPrompt string `gorm:"column:system_prompt" json:"system_prompt"` Gender int32 `gorm:"column:gender" json:"gender"` // 0 未定 1 男 2 女 GreetingEnabled bool `gorm:"column:greeting_enabled" json:"greeting_enabled"` GreetingText string `gorm:"column:greeting_text" json:"greeting_text"` SupportLangs string `gorm:"column:support_langs;size:255" json:"support_langs"` // 逗号分隔 BCP-47 DefaultLang string `gorm:"column:default_lang;size:32" json:"default_lang"` VoiceMap []AgentVoice `gorm:"column:voice_map;type:jsonb;serializer:json" json:"voice_map"` Sort int32 `gorm:"column:sort" json:"sort"` Createtime int64 `gorm:"column:createtime" json:"createtime"` Updatetime int64 `gorm:"column:updatetime" json:"updatetime"` }