fix(provider): support unversioned API roots in model fetch

This commit is contained in:
zhefox
2026-05-26 15:39:56 +08:00
parent c4927162b7
commit d28a389a93
11 changed files with 525 additions and 41 deletions
@@ -322,7 +322,7 @@ const emit = defineEmits<{
'saved': []
}>()
const { error: showError, success: showSuccess } = useToast()
const { error: showError, success: showSuccess, warning: showWarning } = useToast()
const { fetchModels: fetchCachedModels } = useUpstreamModelsCache()
type EndpointOption = {
@@ -565,7 +565,11 @@ async function fetchUpstreamModels() {
allCustomNames.value = Array.from(mergedCustom).filter(name => !upstreamIds.has(name))
}
if (result.error) {
showError(result.error, '获取上游模型失败')
if (result.models.length > 0) {
showWarning(result.error, '部分格式获取失败')
} else {
showError(result.error, '获取上游模型失败')
}
}
} catch (err: unknown) {
showError(parseApiError(err, '获取上游模型列表失败'), '错误')