fix: add seedance vendor rule and improve vendor_id auto-mapping for existing records
This commit is contained in:
parent
46819578de
commit
06aa707141
|
|
@ -32,6 +32,7 @@ var defaultVendorRules = map[string]string{
|
||||||
"grok": "xAI",
|
"grok": "xAI",
|
||||||
"llama": "Meta",
|
"llama": "Meta",
|
||||||
"doubao": "字节跳动",
|
"doubao": "字节跳动",
|
||||||
|
"seedance": "字节跳动",
|
||||||
"kling": "快手",
|
"kling": "快手",
|
||||||
"jimeng": "即梦",
|
"jimeng": "即梦",
|
||||||
"vidu": "Vidu",
|
"vidu": "Vidu",
|
||||||
|
|
@ -71,8 +72,12 @@ var defaultVendorIcons = map[string]string{
|
||||||
func initDefaultVendorMapping(metaMap map[string]*Model, vendorMap map[int]*Vendor, enableAbilities []AbilityWithChannel) {
|
func initDefaultVendorMapping(metaMap map[string]*Model, vendorMap map[int]*Vendor, enableAbilities []AbilityWithChannel) {
|
||||||
for _, ability := range enableAbilities {
|
for _, ability := range enableAbilities {
|
||||||
modelName := ability.Model
|
modelName := ability.Model
|
||||||
if _, exists := metaMap[modelName]; exists {
|
if existing, exists := metaMap[modelName]; exists {
|
||||||
continue
|
// 已有记录但 vendor_id 已赋值 → 跳过
|
||||||
|
if existing.VendorID != 0 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
// vendor_id=0 → 继续尝试匹配(修复已有 DB 记录但缺供应商的场景)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 匹配供应商
|
// 匹配供应商
|
||||||
|
|
@ -85,12 +90,21 @@ func initDefaultVendorMapping(metaMap map[string]*Model, vendorMap map[int]*Vend
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 创建模型元数据
|
if vendorID == 0 {
|
||||||
metaMap[modelName] = &Model{
|
// 仍未匹配到供应商 → 跳过(不给未匹配的模型写入 vendor_id=0 覆盖已有记录)
|
||||||
ModelName: modelName,
|
continue
|
||||||
VendorID: vendorID,
|
}
|
||||||
Status: 1,
|
|
||||||
NameRule: NameRuleExact,
|
// 写入或更新供应商 ID
|
||||||
|
if existing, exists := metaMap[modelName]; exists {
|
||||||
|
existing.VendorID = vendorID
|
||||||
|
} else {
|
||||||
|
metaMap[modelName] = &Model{
|
||||||
|
ModelName: modelName,
|
||||||
|
VendorID: vendorID,
|
||||||
|
Status: 1,
|
||||||
|
NameRule: NameRuleExact,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -324,6 +324,7 @@ var vendorKeywordAliases = []struct {
|
||||||
{"moonshot", []string{"moonshot"}},
|
{"moonshot", []string{"moonshot"}},
|
||||||
{"kimi", []string{"moonshot"}},
|
{"kimi", []string{"moonshot"}},
|
||||||
{"doubao", []string{"bytedance", "volcengine", "volcano"}},
|
{"doubao", []string{"bytedance", "volcengine", "volcano"}},
|
||||||
|
{"seedance", []string{"bytedance", "volcengine", "volcano", "doubao"}},
|
||||||
{"ernie", []string{"baidu"}},
|
{"ernie", []string{"baidu"}},
|
||||||
{"wenxin", []string{"baidu"}},
|
{"wenxin", []string{"baidu"}},
|
||||||
{"hunyuan", []string{"tencent"}},
|
{"hunyuan", []string{"tencent"}},
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue