mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-09-22 03:16:38 +08:00
feat: Map channel model changes to ability mappings
Fix: Add model mappings to a channel's abilities - Add model mappings to a channel's abilities. - Add model mapping unit tests.
This commit is contained in:
parent
3da0f62055
commit
6ee7281a0a
@ -55,6 +55,21 @@ func (channel *Channel) AddAbilities() error {
|
|||||||
abilities = append(abilities, ability)
|
abilities = append(abilities, ability)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// add model mappings
|
||||||
|
for model := range channel.GetModelMapping() {
|
||||||
|
for _, group := range groups_ {
|
||||||
|
ability := Ability{
|
||||||
|
Group: group,
|
||||||
|
Model: model,
|
||||||
|
ChannelId: channel.Id,
|
||||||
|
Enabled: channel.Status == common.ChannelStatusEnabled,
|
||||||
|
Priority: channel.Priority,
|
||||||
|
}
|
||||||
|
abilities = append(abilities, ability)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return DB.Create(&abilities).Error
|
return DB.Create(&abilities).Error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user