๐ fix(ability): prevent duplicate (group, model) pairs when saving channels
When importing large model lists (โ700+) an attempt to save a channel
could fail with:
Error 1062 (23000): Duplicate entry 'default-DeepSeek-1' for key 'abilities.PRIMARY'
Root cause: AddAbilities / UpdateAbilities inserted the same
(group, model) pair multiple times if the input list contained
duplicates or case-variants (e.g. `default` vs `Default`).
Changes:
โข ability.go
โ AddAbilities: introduced `abilitySet` to deduplicate by
lower-cased `group|model` key before batch-inserting.
โ UpdateAbilities: applied the same deduplication logic when
rebuilding abilities inside a transaction.
Notes:
โข The lower-casing is only for set comparison; the original
`group` and `model` values are preserved when persisting to DB,
so case sensitivity of stored data is unchanged.
โข Batch chunking logic (lo.Chunk) and performance characteristics
remain unaffected.
Fixes #1215
Showing
Please
register
or
sign in
to comment