Commit a5a30cf
committed
fix(config): add per-provider api_base storage to survive provider switches
Problem: Custom api_base URLs were stored as a single global value. When
switching providers, set_provider() deleted api_base from user_set (correct
for the new provider's defaults), which meant the previous provider's custom
base URL was lost on save(). Switching from llama.cpp back to github_copilot
and then back would lose the llama.cpp custom endpoint entirely.
Solution: Added per-provider api_bases storage, mirroring the existing
api_keys pattern. Config now saves {"api_bases":{"llama.cpp":"http://..."}}
alongside {"api_keys":{"llama.cpp":"1234"}}. set_provider() saves the
outgoing provider's custom base before switching and loads the incoming
provider's stored base. All cross-provider routing paths in APIManager,
Models, and Config now check per-provider stored bases before falling back
to static provider defaults.
Changes:
- Config.pm: api_bases in DEFAULT_CONFIG, get/set_provider_base() methods,
set_provider() preserves outgoing base and loads incoming, load() checks
stored bases before provider defaults
- API/Config.pm: _set_base() stores per-provider, _set_provider() uses
stored bases for session-only and global paths, display shows source
- APIManager.pm: both cross-provider routing paths check stored bases
- API/Models.pm: _fetch_provider_models() uses stored bases
Testing: All 4 files pass perl -c syntax checks"1 parent 8eba2c3 commit a5a30cf
4 files changed
Lines changed: 120 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
906 | 906 | | |
907 | 907 | | |
908 | 908 | | |
909 | | - | |
910 | | - | |
911 | | - | |
912 | | - | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
913 | 918 | | |
914 | 919 | | |
915 | 920 | | |
| |||
1513 | 1518 | | |
1514 | 1519 | | |
1515 | 1520 | | |
1516 | | - | |
1517 | | - | |
1518 | | - | |
| 1521 | + | |
| 1522 | + | |
| 1523 | + | |
| 1524 | + | |
| 1525 | + | |
| 1526 | + | |
| 1527 | + | |
| 1528 | + | |
| 1529 | + | |
1519 | 1530 | | |
1520 | 1531 | | |
1521 | 1532 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
| |||
170 | 171 | | |
171 | 172 | | |
172 | 173 | | |
173 | | - | |
174 | | - | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
175 | 182 | | |
176 | 183 | | |
177 | 184 | | |
| |||
320 | 327 | | |
321 | 328 | | |
322 | 329 | | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
323 | 342 | | |
324 | 343 | | |
325 | 344 | | |
326 | 345 | | |
327 | 346 | | |
328 | | - | |
329 | | - | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
330 | 355 | | |
331 | 356 | | |
332 | 357 | | |
| |||
353 | 378 | | |
354 | 379 | | |
355 | 380 | | |
356 | | - | |
| 381 | + | |
357 | 382 | | |
358 | 383 | | |
359 | 384 | | |
| |||
433 | 458 | | |
434 | 459 | | |
435 | 460 | | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
436 | 516 | | |
437 | 517 | | |
438 | 518 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
249 | 249 | | |
250 | 250 | | |
251 | 251 | | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
252 | 260 | | |
253 | 261 | | |
254 | 262 | | |
| |||
360 | 368 | | |
361 | 369 | | |
362 | 370 | | |
363 | | - | |
| 371 | + | |
364 | 372 | | |
| 373 | + | |
365 | 374 | | |
366 | 375 | | |
367 | | - | |
| 376 | + | |
368 | 377 | | |
369 | 378 | | |
370 | 379 | | |
| |||
378 | 387 | | |
379 | 388 | | |
380 | 389 | | |
| 390 | + | |
| 391 | + | |
381 | 392 | | |
382 | 393 | | |
383 | 394 | | |
384 | | - | |
| 395 | + | |
385 | 396 | | |
386 | 397 | | |
387 | 398 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
210 | 210 | | |
211 | 211 | | |
212 | 212 | | |
213 | | - | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
214 | 216 | | |
215 | 217 | | |
216 | 218 | | |
| |||
0 commit comments