feat(webui): improve model and provider settings UX (#6145)

* feat(webui): improve model and provider settings UX

* refactor(webui): organize provider forms and model picker interactions

* fix(webui): separate OAuth credentials from provider configuration

* fix(webui): stabilize shared combobox navigation

* refactor(config): store provider connections as sparse entries

* fix(webui): preserve provider validation and isolate catalog tests

* refactor(config): manage explicit provider connections

* refactor(webui): decouple settings UX from provider removal

* fix(webui): select current combobox options during rapid input

* feat(webui): refine model preset and provider management

* style(webui): refine preset footer actions

* fix(webui): align model settings with responsive layout rules

* refactor(webui): finalize preset dialogs and simplify provider state

* fix(webui): keep fallback heading stable while sorting presets

Animate card dimensions without changing layout height and keep the section heading outside sortable cards. Remove proxy normalization from this PR.

* docs: update WebUI model and provider setup instructions

* docs: start model setup from new preset

* docs: remove duplicate WebUI model setup instructions
This commit is contained in:
chengyongru authored and GitHub committed 2026-10-11 04:30:43 +08:00
1 parent 8080ea843a
commit 9261e731ce
88 files changed
+2854 -1734

No files matched your search

@@ -378,6 +378,35 @@ def test_github_copilot_catalog_routes_advertised_model_apis(
assert len(captured) == 4
def test_explicit_refresh_bypasses_cached_models_and_retry_delay() -> None:
calls = 0
def fetch(_proxy):
nonlocal calls
calls += 1
if calls == 2:
request = httpx.Request("GET", "https://example.com/models")
raise httpx.HTTPStatusError("expired", request=request, response=httpx.Response(401))
return (ProviderModelSpec(id=f"provider/model-{calls}"),)
catalog = OAuthModelCatalog(fallback_models=(), fetch=fetch)
assert catalog.get(cache_key="account").models[0].id == "provider/model-1"
assert catalog.get(cache_key="account").source == "cache"
assert calls == 1
failed = catalog.get(cache_key="account", refresh=True)
assert failed.source == "stale"
assert failed.error_kind == "auth_required"
assert catalog.get(cache_key="account").error_kind == "auth_required"
assert calls == 2
refreshed = catalog.get(cache_key="account", refresh=True)
assert refreshed.source == "remote"
assert refreshed.error_kind is None
assert refreshed.models[0].id == "provider/model-3"
assert calls == 3
def test_catalog_single_flights_concurrent_refreshes() -> None:
calls = 0
calls_lock = threading.Lock()
+20
View File
@@ -8,6 +8,7 @@ from nanobot.config.schema import Config
from nanobot.webui.settings_models import (
WebUISettingsError,
model_settings_payload,
provider_models_payload,
update_agent_model_settings,
update_provider_settings,
)
@@ -83,3 +84,22 @@ def test_default_context_window_rejects_invalid_tokens(value: str) -> None:
config, {"context_window_tokens": [value]}, oauth_status=_oauth_status,
)
assert config.agents.defaults.context_window_tokens == 200_000
@pytest.mark.parametrize("provider", ["openai_codex", "xai_grok", "github_copilot"])
@pytest.mark.parametrize("refresh", [False, True])
def test_provider_model_refresh_reaches_oauth_catalog(monkeypatch, provider, refresh):
from unittest.mock import Mock
from nanobot.providers.oauth_model_catalog import OAuthModelCatalogSnapshot
catalog = Mock(return_value=OAuthModelCatalogSnapshot(models=(), source="remote", fetched_at=123))
monkeypatch.setattr("nanobot.webui.settings_models.get_oauth_model_catalog", catalog)
query = {"provider": [provider]}
if refresh:
query["refresh"] = ["1"]
config = Config.model_validate({"providers": {provider: {}}})
provider_models_payload(config, query, http_get=Mock())
catalog.assert_called_once_with(provider, proxy=None, refresh=refresh)