🐛 fix(ability): keep case-sensitive (group, model) keys during deduplication

The previous patch lower-cased `group` and `model` when building the
temporary `abilitySet` used to prevent duplicate inserts.
This merged models that differ only by letter case, e.g.
`GPT-3.5-turbo` vs `gpt-3.5-turbo`, causing them to disappear from the
user’s available-models list and pricing page.

Change:
• ability.go – removed all `strings.ToLower` calls when composing the
  deduplication key (`group|model`), so duplicates are checked in a
  case-sensitive manner while preserving the original data.

Result:
• `GPT-3.5-turbo` and `gpt-3.5-turbo` are now treated as distinct
  models throughout the system.
This commit is contained in:
Apple\Apple
2025-06-13 13:03:06 +08:00
parent 927cd07a3f
commit 034cc7f118

View File

@@ -137,7 +137,7 @@ func (channel *Channel) AddAbilities() error {
abilities := make([]Ability, 0, len(models_))
for _, model := range models_ {
for _, group := range groups_ {
key := strings.ToLower(group) + "|" + strings.ToLower(model)
key := group + "|" + model
if _, exists := abilitySet[key]; exists {
continue
}
@@ -204,7 +204,7 @@ func (channel *Channel) UpdateAbilities(tx *gorm.DB) error {
abilities := make([]Ability, 0, len(models_))
for _, model := range models_ {
for _, group := range groups_ {
key := strings.ToLower(group) + "|" + strings.ToLower(model)
key := group + "|" + model
if _, exists := abilitySet[key]; exists {
continue
}