mirror of
https://gitee.com/mateos/mateclaw.git
synced 2026-09-13 11:13:43 +08:00
In the "Edit Agent → Preferred Providers" tab the same (provider, model) combination could be selected repeatedly — e.g. two rows of the same provider both pointing at the same model, or two "provider default" rows. This is unintended: a provider may repeat across the fallback chain, but each (provider, model) should stay unique. Root cause: addProviderEntry() pushed unconditionally (the code comment even said "we never dedup here") and the model <option>s had no disabled state, so already-chosen models remained selectable. Fix (Agents.vue): - isProviderChoiceTaken(): detect whether a (provider, model) slot — or the provider-default slot (modelId === null) — is already used in another row. - Model <option> + the default-model option are :disabled when already taken; the current row's own value stays selectable (exceptIdx). - addProviderEntry(): take the default slot if free, else the first unused model; do nothing if every option is taken. - The "+ Provider" pool button is disabled once the provider has no free (provider, model) slot left, so the click is never a silent no-op. The existing unique index uk_agent_provider_model(agent_id, provider_id, model_id) already guards non-null duplicates at the DB level, but it cannot catch model_id IS NULL rows (SQL treats NULLs as distinct); the UI is now the single source of truth for that. Fixes #530 |
||
|---|---|---|
| .. | ||
| public | ||
| src | ||
| test | ||
| .npmrc | ||
| eslint.config.mjs | ||
| index.html | ||
| package.json | ||
| pnpm-lock.yaml | ||
| pnpm-workspace.yaml | ||
| TEST_CASES.md | ||
| tsconfig.json | ||
| vite.config.ts | ||
| vitest.config.ts | ||