Fix: model selection format compat and provider api_key wrapping (#17112)

This commit is contained in:
chanx
2026-07-20 19:12:59 +08:00
committed by GitHub
parent 9a2a3c0459
commit b3f731d4de
7 changed files with 76 additions and 34 deletions

View File

@@ -29,7 +29,7 @@ import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
import { useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import { parseModelValue } from '@/utils/llm-util';
import { buildModelValue, parseModelValue } from '@/utils/llm-util';
import { useWarnEmptyModel } from './use-warn-empty-model';
export const enum LLMApiAction {
@@ -629,7 +629,17 @@ export const useFetchDefaultModelDictionary = (showEmptyModelWarn = false) => {
const dict: Record<string, string> = {};
Object.entries(ModelTypeToField).forEach(([key, field]) => {
const model = defaultModels.find((m) => m.model_type === key);
dict[field] = model && model.enable ? model.model_id : '';
if (!model || !model.enable) {
dict[field] = '';
return;
}
dict[field] =
model.model_id ||
buildModelValue({
model_name: model.model_name,
model_instance: model.model_instance,
model_provider: model.model_provider,
});
});
return dict;
}, [defaultModels]);