Commit a6c5059
committed
Allow code generation with local models that require no API key
In local mode the OpenAI-compatible endpoint (Ollama, LM Studio, ...)
ignores auth, but two things blocked submitting a query without a key:
the Generate Code button was gated on a non-empty api_token, so it never
appeared, and the client refuses to construct an OpenAI client with an
empty key.
Show the button whenever a key is not required (local mode) or one is
present (cloud), and fall back to a placeholder key in local mode that a
real key typed into the field overrides. Cloud providers (OpenAI,
Anthropic, Gemini, NIM) still require a real key, so an empty key there
still surfaces the "Set API Key" prompt as before.1 parent 95e4d0d commit a6c5059
2 files changed
Lines changed: 13 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
15 | 21 | | |
16 | | - | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
17 | 27 | | |
18 | 28 | | |
19 | 29 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
119 | | - | |
| 119 | + | |
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
| |||
0 commit comments