-
Notifications
You must be signed in to change notification settings - Fork 2k
Description
Bug Description
In the Settings panel, when testing connectivity for a language model provider, the provider-level "Test Connection" button works correctly — it sends the request to the server, which can use server-side configured API keys (e.g. via environment variables). However, the model-level "Test Connection" button (inside the model edit dialog) has a client-side guard that immediately rejects the request if the client-side API key field is empty, even when the server has a valid API key configured.
Root cause: In components/settings/model-edit-dialog.tsx line 62, handleTestModel checks if (!editingModel || !apiKey) and short-circuits with an "API Key is required" error before ever sending the request to /api/verify-model. The provider-level test in components/settings/provider-config-panel.tsx does not have this guard and correctly delegates the check to the server.
Steps to Reproduce
- Configure an API key for a provider only on the server side (e.g., set
OPENAI_API_KEYin.env.localor server environment variables) - Do not enter an API key in the client-side Settings panel for that provider
- Open Settings → select the provider → click "Test Connection" → ✅ Success
- Click on a specific model under that provider to open the model edit dialog
- Click "Test Connection" in the model edit dialog → ❌ Shows "API Key is required"
Expected Behavior
The model-level "Test Connection" should behave consistently with the provider-level test: send the request to the server and let the server-side API route handle API key resolution (falling back to server-configured keys when client-side key is empty).
Actual Behavior
The model-level test connection immediately shows "API Key is required" error without sending any request to the server, even though the server has a valid API key configured and the provider-level test works fine.
Deployment Method
Local development (pnpm dev)
Additional Context
The fix should remove or adjust the !apiKey guard in model-edit-dialog.tsx handleTestModel to match the provider-level behavior — letting the server handle API key validation.