Skip to content

feat(providers): validate model connectivity before save#284

Open
slicenferqin wants to merge 5 commits intoValueCell-ai:mainfrom
slicenferqin:feat/provider-model-connectivity-check
Open

feat(providers): validate model connectivity before save#284
slicenferqin wants to merge 5 commits intoValueCell-ai:mainfrom
slicenferqin:feat/provider-model-connectivity-check

Conversation

@slicenferqin
Copy link
Contributor

@slicenferqin slicenferqin commented Mar 4, 2026

Summary

This PR adds a save-time connectivity validation path for provider setup/edit flows, so users can catch provider/model misconfiguration before returning to chat.

  • Extend provider:validateKey to accept optional model and validate model connectivity for OpenAI-compatible providers.
  • Reuse stored API key when editing provider base URL/model without entering a new key.
  • In Setup and Provider Settings, pass model into validation calls so we test both key + model before save.
  • Add explicit Test Connection button and gate saving on successful connectivity test:
    • Setup: users must run test and pass before save is enabled.
    • Settings/Add Provider: same gating behavior for consistency.
  • For OpenRouter, run auth check first, then model connectivity check (when model provided).

Why

Users can currently save provider config successfully, but only discover model/baseURL issues after sending a chat message. This adds an earlier fail-fast check in config flows.

Validation

  • pnpm -s typecheck
  • JSON parse check for updated locale files

@slicenferqin
Copy link
Contributor Author

已同步最新 main 并解决冲突,相关更新已经推送到当前 PR 分支。\n\n本次合并主要处理了 src/components/settings/ProvidersSettings.tsxsrc/pages/Setup/index.tsx 的冲突,并保留了这条 PR 原本的“保存前做连接测试 / 模型连通性校验”逻辑,同时兼容了 main 上后续引入的 provider UI/鉴权模式调整。\n\n本地验证已通过:\n- pnpm run lint\n- pnpm run typecheck\n- pnpm run test\n\nIf helpful, I can also split or further simplify any part of this PR for easier review.\n\nI’ve merged the latest main into this branch and resolved the conflicts.\n\nThe conflict resolution mainly covered src/components/settings/ProvidersSettings.tsx and src/pages/Setup/index.tsx. The PR’s original behavior is preserved: provider/model connectivity must be validated before save, while also staying compatible with the newer provider UI and auth-mode changes from main.\n\nLocal validation passed:\n- pnpm run lint\n- pnpm run typecheck\n- pnpm run test\nEOF

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant