mateclaw/mateclaw-ui
倪程伟 fbfb8982cc
fix(agents): keep each (provider, model) unique in the preference chain
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
2026-07-15 14:56:16 +08:00
..
public feat(ui): add the xAI (Grok) provider brand icon 2026-05-18 10:01:05 +08:00
src fix(agents): keep each (provider, model) unique in the preference chain 2026-07-15 14:56:16 +08:00
test feat(ui): add agent binding search (#106) 2026-05-12 18:18:39 +08:00
.npmrc fix(ui-build): invoke node directly with heap flag + .npmrc fallback for workers 2026-05-10 21:17:09 +08:00
eslint.config.mjs chore(ui): ESLint 9 flat config, lint script fix, and lint error cleanup 2026-07-14 21:11:58 +08:00
index.html feat(ui): design system upgrade — responsive layout, collapsible panels, and unified tokens 2026-04-10 18:14:23 +08:00
package.json chore(ui): ESLint 9 flat config, lint script fix, and lint error cleanup 2026-07-14 21:11:58 +08:00
pnpm-lock.yaml chore(ui): ESLint 9 flat config, lint script fix, and lint error cleanup 2026-07-14 21:11:58 +08:00
pnpm-workspace.yaml chore(ui): ESLint 9 flat config, lint script fix, and lint error cleanup 2026-07-14 21:11:58 +08:00
TEST_CASES.md fix(deploy): drop DASHSCOPE_API_KEY requirement so Docker boots with no LLM key configured (#99) 2026-05-11 20:44:31 +08:00
tsconfig.json Initial commit: MateClaw — Java + Vue 3 AI Assistant System 2026-04-04 19:03:49 +08:00
vite.config.ts perf(ui): on-demand Element Plus, tree-shake unused components 2026-07-08 15:54:18 +08:00
vitest.config.ts feat(wiki): slug-first wikilink resolution and safe DOM postprocess 2026-05-28 08:16:56 +08:00