feat(web): refine model availability states and preserve API key preview placeholder (#2226)

* feat(web): clarify model availability and status display

- Rename model availability field from configured to available across backend API and frontend usage

- Keep status as reason classification (configured/unconfigured/unreachable) and show unreachable in UI

- Preserve API key preview even when local service is unreachable

- Update backend tests to assert both availability and status semantics

* fix(web): clarify unreachable model status and wording

- Show unreachable status in model cards instead of API key preview when service is down

- Keep API key placeholder preview in model settings whenever an API key is already saved

- Rename model status wording from configured to available across backend, frontend, and i18n

- Update backend model status tests to match renamed status semantics

* style(web): standardize formatting in handleListModels function

* refactor(web): enforce status field as required to follow backend behavior
This commit is contained in:
LC authored and GitHub committed 2026-03-31 22:52:04 +08:00
1 parent 2bf842e460
commit 3b3f95c44c
12 files changed
+161 -69

No files matched your search

+6 -6
View File
@@ -65,32 +65,32 @@ export function useChatModels({ isConnected }: UseChatModelsOptions) {
[defaultModelName],
)
const hasConfiguredModels = useMemo(
() => modelList.some((m) => m.configured),
const hasAvailableModels = useMemo(
() => modelList.some((m) => m.available),
[modelList],
)
const oauthModels = useMemo(
() => modelList.filter((m) => m.configured && m.auth_method === "oauth"),
() => modelList.filter((m) => m.available && m.auth_method === "oauth"),
[modelList],
)
const localModels = useMemo(
() => modelList.filter((m) => m.configured && isLocalModel(m)),
() => modelList.filter((m) => m.available && isLocalModel(m)),
[modelList],
)
const apiKeyModels = useMemo(
() =>
modelList.filter(
(m) => m.configured && m.auth_method !== "oauth" && !isLocalModel(m),
(m) => m.available && m.auth_method !== "oauth" && !isLocalModel(m),
),
[modelList],
)
return {
defaultModelName,
hasConfiguredModels,
hasAvailableModels,
apiKeyModels,
oauthModels,
localModels,