Repository navigation
fix(web): preselect the LLM_PROVIDER from .env in the provider picker - #318
Open
Danielgfonseca wants to merge 1 commit into
Open
Danielgfonseca wants to merge 1 commit into
Danielgfonseca wants to merge 1 commit into
Conversation
The web UI never received LLM_PROVIDER, so in a browser with no saved choice the provider select kept its first option (Ollama) even when the server is configured for another provider, and the page reported "Ollama is not accessible at http://localhost:11434/api/generate". - /api/config now returns llm_provider. - ProviderManager applies it once the default config is loaded, before loading models, only when the browser has no saved lastProvider. A provider the user picked before still wins. Same family as hydropix#108 (DEFAULT_TARGET_LANGUAGE) and hydropix#153 (DEFAULT_MODEL).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
LLM_PROVIDERis read by the server and the CLI, but it never reaches the web UI. In a browser with no saved choice (new device, private window, cleared storage) the provider select keeps its first option, Ollama, even when the server is configured for another provider. With no local Ollama the page then reports:Translations started after switching the select by hand work fine, so this is only the initial selection. The choice is only saved to localStorage on
beforeunloador when saving settings, and mobile Safari rarely firesbeforeunload, so on an iPhone the page falls back to Ollama on every visit.This is the same family as #108 (
DEFAULT_TARGET_LANGUAGE) and #153 (DEFAULT_MODEL).Change
/api/confignow returnsllm_provider(_config.LLM_PROVIDER)./api/settingsalready exposed it, but the page builds its defaults from/api/config.ProviderManager.applyServerDefaultProvider()runs when the default config is loaded, right beforetoggleProviderSettings(true), so models are loaded for the right provider. It only applies when the browser has no savedlastProvider, which means a provider the user picked before always wins. It also skips unknown values, and keeps the searchable select and its logo in sync.Tests
tests/unit/test_default_provider_exposed.py:/api/configreturns the configured provider, andollamawhenLLM_PROVIDERis unset. Both fail without the fix and pass with it.pytest tests/unit: 1897 passed, 1 skipped, 1 failed. The failure istest_path_validator.py::test_reject_path_separator_backslash, which also fails onmainon Linux and is unrelated.LLM_PROVIDER=openai. There/api/configreturns"llm_provider": "openai"and the patchedprovider-manager.jsis served.node --checkpasses on the file.