You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
4.5 KiB
62 lines
4.5 KiB
package console
|
|
|
|
// 会议记录服务编排 (echomeet orchestration)。
|
|
//
|
|
// 与旧的 echomeet_svc_config(每应用一份、在业务库、自己存凭据)不同:
|
|
// 编排**不存凭据**,只引用「第三方服务配置」(svc_config) 里配好的服务 id,按
|
|
// 作用域 = (app_name, region) 分层:app_name='' 且 region=0 是「全局默认」兜底,
|
|
// 越具体越优先。凭据、区域覆盖都由 svc_config / svc_region_override 那一套负责。
|
|
//
|
|
// 三类(Kind)各自映射到服务池的服务类别,管理端选服务时按此过滤:
|
|
// 识别 → svcCatASRFile(8);翻译 → svcCatMT(3);总结 → svcCatLLM(5) + svcCatLLMVision(9)。
|
|
// 识别/翻译按 Priority 升序选路,总结按 IsDefault + ClientVisible + 应用级开关。
|
|
//
|
|
// 存 console 共享库(postgres),与 svc_config 同库,便于 join 服务名/解析下发。
|
|
//
|
|
// ⚠️ 回调地址契约(下发时必须遵守):录音文件识别服务的 callback_path 字段存的是**相对路径**
|
|
// (如 /api/home/echomeet_backcall),不是完整 URL——同一个服务会被所有应用共用,而各应用/部署
|
|
// 的对外地址不同,写死完整 URL 只对一个应用有效。
|
|
// 完整回调 = 该部署的对外地址(AppRegistry.BaseUrl) + callback_path,**由 console 在下发时拼接**
|
|
// (console 才有注册表里的 base_url;业务服务未必知道自己的对外地址,尤其多区域部署)。
|
|
// 下发解析顺序:(app,region) → (app,0) → ('',region) → ('',0) 全局默认兜底,越具体越优先。
|
|
|
|
// 编排类别(会议记录三段)。
|
|
const (
|
|
echoKindASR int32 = 1 // 识别(录音文件转写)
|
|
echoKindMT int32 = 2 // 翻译
|
|
echoKindLLM int32 = 3 // 总结(大模型)
|
|
)
|
|
|
|
// echoKindSvcCats 各编排类别对应的服务池类别(前端选服务时按此过滤,后端校验 svc_id 归属用)。
|
|
var echoKindSvcCats = map[int32][]int32{
|
|
echoKindASR: {svcCatASRFile},
|
|
echoKindMT: {svcCatMT},
|
|
echoKindLLM: {svcCatLLM, svcCatLLMVision},
|
|
}
|
|
|
|
// EchoOrchestration 一行 = 某作用域(app_name,region) 下某类别选中的一个服务引用 + 排序/标记。
|
|
// 唯一:(app_name, region, kind, svc_id)。svc_id 引用 ThirdSvcConfig.Id(同作用域解析凭据)。
|
|
type EchoOrchestration struct {
|
|
RowId uint64 `gorm:"primaryKey;autoIncrement;column:row_id" json:"row_id"`
|
|
AppName string `gorm:"column:app_name;size:64;uniqueIndex:uidx_echo_orch,priority:1" json:"app_name"` // ''=全局默认兜底
|
|
Region int32 `gorm:"column:region;uniqueIndex:uidx_echo_orch,priority:2" json:"region"` // 0=全区域兜底,>0=特定区域
|
|
Kind int32 `gorm:"column:kind;uniqueIndex:uidx_echo_orch,priority:3" json:"kind"` // 1识别/2翻译/3总结
|
|
SvcId string `gorm:"column:svc_id;size:64;uniqueIndex:uidx_echo_orch,priority:4" json:"svc_id"` // 引用 svc_config 的服务 id
|
|
Priority int32 `gorm:"column:priority" json:"priority"` // 同类内升序,小=优先
|
|
IsDefault bool `gorm:"column:is_default" json:"is_default"` // 总结用:默认模型,同作用域内至多一条
|
|
ClientVisible bool `gorm:"column:client_visible" json:"client_visible"` // 总结用:是否允许客户端选择
|
|
CostHint float64 `gorm:"column:cost_hint" json:"cost_hint"` // 参考单价,仅排序/展示;识别元/时、翻译元/百万字符、总结元/百万token
|
|
Enabled bool `gorm:"column:enabled" json:"enabled"`
|
|
Createtime int64 `gorm:"column:createtime" json:"createtime"`
|
|
Updatetime int64 `gorm:"column:updatetime" json:"updatetime"`
|
|
}
|
|
|
|
// EchoOrchSetting 会议记录编排的作用域级开关。每 (app_name, region) 一行。
|
|
type EchoOrchSetting struct {
|
|
RowId uint64 `gorm:"primaryKey;autoIncrement;column:row_id" json:"row_id"`
|
|
AppName string `gorm:"column:app_name;size:64;uniqueIndex:uidx_echo_orch_set,priority:1" json:"app_name"`
|
|
Region int32 `gorm:"column:region;uniqueIndex:uidx_echo_orch_set,priority:2" json:"region"`
|
|
// LLMClientChoice 是否允许客户端指定总结模型。false=强制默认模型;true=客户端可在 ClientVisible 且 Enabled 里选。
|
|
LLMClientChoice bool `gorm:"column:llm_client_choice" json:"llm_client_choice"`
|
|
Updatetime int64 `gorm:"column:updatetime" json:"updatetime"`
|
|
}
|
|
|