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:
1 parent
8080ea843a
commit
9261e731ce
88 files changed
+2854
-1734
No files matched your search
@@ -8,7 +8,7 @@ import { SETTINGS_SEARCH_INPUT_CLASS, SettingsGroup, SettingsRow } from "@/compo
|
||||
import { SettingsHint } from "@/components/settings/shared/SettingsHint";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { DisclosureContent } from "@/components/ui/disclosure";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { SearchInput } from "@/components/ui/input";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { useClient } from "@/providers/ClientProvider";
|
||||
|
||||
@@ -72,7 +72,7 @@ export function LinearMemberAccess({ organizationId, configScope = "", disabled
|
||||
<div className="settings-list-inset flex items-center gap-2">
|
||||
<div className="relative min-w-0 flex-1">
|
||||
<Search className="pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" aria-hidden />
|
||||
<Input value={search} onChange={(event) => setSearch(event.target.value)}
|
||||
<SearchInput value={search} onChange={(event) => setSearch(event.target.value)}
|
||||
aria-label={tx("members.search", "Search members")}
|
||||
placeholder={tx("members.search", "Search members")}
|
||||
className={cn(SETTINGS_SEARCH_INPUT_CLASS, "pl-9 text-[13px]")} />
|
||||
|
||||
@@ -355,9 +355,11 @@ def cached_github_copilot_model_api(
|
||||
|
||||
def get_github_copilot_model_catalog(
|
||||
proxy: str | None = None,
|
||||
*,
|
||||
refresh: bool = False,
|
||||
) -> OAuthModelCatalogSnapshot:
|
||||
return _GITHUB_COPILOT_MODEL_CATALOG.get(
|
||||
cache_key=_copilot_catalog_cache_key(proxy), proxy=proxy,
|
||||
cache_key=_copilot_catalog_cache_key(proxy), proxy=proxy, refresh=refresh,
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -113,17 +113,21 @@ class OAuthModelCatalog:
|
||||
self._inflight: set[str] = set()
|
||||
self._generation = 0
|
||||
|
||||
def get(self, *, cache_key: str, proxy: str | None = None) -> OAuthModelCatalogSnapshot:
|
||||
"""Return a fresh catalog, sharing concurrent work and retaining a fallback."""
|
||||
def get(
|
||||
self, *, cache_key: str, proxy: str | None = None, refresh: bool = False,
|
||||
) -> OAuthModelCatalogSnapshot:
|
||||
"""Reuse cached discovery unless explicitly refreshed, retaining fallback models."""
|
||||
with self._condition:
|
||||
generation = self._generation
|
||||
cached = self._cached_result(cache_key)
|
||||
if cached is not None:
|
||||
return cached
|
||||
while cache_key in self._inflight:
|
||||
self._condition.wait()
|
||||
if generation != self._generation:
|
||||
return self._stale_or_fallback(None, self._monotonic())
|
||||
if not refresh:
|
||||
cached = self._cached_result(cache_key)
|
||||
if cached is not None:
|
||||
return cached
|
||||
if cache_key in self._inflight:
|
||||
while cache_key in self._inflight:
|
||||
self._condition.wait()
|
||||
if generation != self._generation:
|
||||
return self._stale_or_fallback(None, self._monotonic())
|
||||
cached = self._cached_result(cache_key)
|
||||
if cached is not None:
|
||||
return cached
|
||||
@@ -179,13 +183,13 @@ class OAuthModelCatalog:
|
||||
def _cached_result(self, cache_key: str) -> OAuthModelCatalogSnapshot | None:
|
||||
now = self._monotonic()
|
||||
entry = self._entries.get(cache_key)
|
||||
if entry is not None and now - entry.stored_at < self._fresh_ttl_s:
|
||||
return replace(entry.snapshot, source="cache")
|
||||
failure = self._failures.get(cache_key)
|
||||
if failure is not None and failure.retry_at <= now:
|
||||
self._failures.pop(cache_key, None)
|
||||
elif failure is not None:
|
||||
return self._stale_or_fallback(entry, now, failure.error_kind)
|
||||
if entry is not None and now - entry.stored_at < self._fresh_ttl_s:
|
||||
return replace(entry.snapshot, source="cache")
|
||||
return None
|
||||
|
||||
def _failure_result(
|
||||
@@ -241,20 +245,21 @@ def get_oauth_model_catalog(
|
||||
provider_name: str,
|
||||
*,
|
||||
proxy: str | None = None,
|
||||
refresh: bool = False,
|
||||
) -> OAuthModelCatalogSnapshot:
|
||||
"""Discover models through the owning provider module."""
|
||||
if provider_name == "openai_codex":
|
||||
from nanobot.providers.openai_codex_provider import get_openai_codex_model_catalog
|
||||
|
||||
return get_openai_codex_model_catalog(proxy)
|
||||
return get_openai_codex_model_catalog(proxy, refresh=refresh)
|
||||
if provider_name == "xai_grok":
|
||||
from nanobot.providers.xai_grok_provider import get_xai_grok_model_catalog
|
||||
|
||||
return get_xai_grok_model_catalog(proxy)
|
||||
return get_xai_grok_model_catalog(proxy, refresh=refresh)
|
||||
if provider_name == "github_copilot":
|
||||
from nanobot.providers.github_copilot_provider import get_github_copilot_model_catalog
|
||||
|
||||
return get_github_copilot_model_catalog(proxy)
|
||||
return get_github_copilot_model_catalog(proxy, refresh=refresh)
|
||||
raise ValueError(f"OAuth model discovery is not available for {provider_name}")
|
||||
|
||||
|
||||
|
||||
@@ -626,13 +626,15 @@ def _should_retry_status(
|
||||
|
||||
def get_openai_codex_model_catalog(
|
||||
proxy: str | None = None,
|
||||
*,
|
||||
refresh: bool = False,
|
||||
) -> OAuthModelCatalogSnapshot:
|
||||
storage = FileTokenStorage(token_filename=OPENAI_CODEX_PROVIDER.token_filename)
|
||||
token = storage.load()
|
||||
account_id = getattr(token, "account_id", None)
|
||||
account_key = _catalog_account_key(account_id)
|
||||
cache_key = f"{storage.get_token_path()}\0{account_key}\0{proxy or ''}"
|
||||
return _OPENAI_CODEX_MODEL_CATALOG.get(cache_key=cache_key, proxy=proxy)
|
||||
return _OPENAI_CODEX_MODEL_CATALOG.get(cache_key=cache_key, proxy=proxy, refresh=refresh)
|
||||
|
||||
|
||||
def invalidate_openai_codex_model_catalog() -> None:
|
||||
|
||||
@@ -652,11 +652,13 @@ def _should_retry_status(
|
||||
return status_code in LLMProvider._RETRYABLE_STATUS_CODES or status_code >= 500 # pyright: ignore[reportPrivateUsage]
|
||||
|
||||
|
||||
def get_xai_grok_model_catalog(proxy: str | None = None) -> OAuthModelCatalogSnapshot:
|
||||
def get_xai_grok_model_catalog(
|
||||
proxy: str | None = None, *, refresh: bool = False,
|
||||
) -> OAuthModelCatalogSnapshot:
|
||||
token = get_xai_oauth_login_status()
|
||||
account_key = _catalog_account_key(getattr(token, "account_id", None))
|
||||
cache_key = f"{get_xai_oauth_storage_path()}\0{account_key}\0{proxy or ''}"
|
||||
return _XAI_GROK_MODEL_CATALOG.get(cache_key=cache_key, proxy=proxy)
|
||||
return _XAI_GROK_MODEL_CATALOG.get(cache_key=cache_key, proxy=proxy, refresh=refresh)
|
||||
|
||||
|
||||
def invalidate_xai_grok_model_catalog() -> None:
|
||||
|
||||
@@ -690,7 +690,9 @@ def provider_models_payload(
|
||||
}
|
||||
if catalog_kind == "hybrid":
|
||||
proxy = _resolve_env_placeholders(provider_config.proxy)
|
||||
catalog = get_oauth_model_catalog(spec.name, proxy=proxy)
|
||||
catalog = get_oauth_model_catalog(
|
||||
spec.name, proxy=proxy, refresh=query_first(query, "refresh") == "1",
|
||||
)
|
||||
rows = [
|
||||
{
|
||||
"id": model.id,
|
||||
|
||||
Reference in new issue
Block a user