mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-08-12 03:33:33 +08:00
Fix: The newly added model did not appear in the drop-down menu. (#15476)
### What problem does this PR solve? Fix: The newly added model did not appear in the drop-down menu. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@@ -72,6 +72,8 @@ const themeIcons = [
|
||||
LLMFactory.Meituan,
|
||||
LLMFactory.Longcat,
|
||||
LLMFactory.MinerU,
|
||||
LLMFactory.JiekouAI,
|
||||
LLMFactory.Perplexity,
|
||||
];
|
||||
|
||||
const svgIcons = [
|
||||
|
||||
@@ -227,6 +227,9 @@ export const useAddProviderInstance = () => {
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: LlmKeys.addedProviders(),
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: LlmKeys.allModels(),
|
||||
});
|
||||
}
|
||||
return data;
|
||||
},
|
||||
@@ -254,6 +257,9 @@ export const useAddInstanceModel = () => {
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: LlmKeys.addedProviders(),
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: LlmKeys.allModels(),
|
||||
});
|
||||
}
|
||||
return data;
|
||||
},
|
||||
@@ -281,6 +287,9 @@ export const useDeleteProviderInstance = () => {
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: LlmKeys.providerInstances(params.provider_name),
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: LlmKeys.allModels(),
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: LlmKeys.defaultModels(),
|
||||
});
|
||||
|
||||
@@ -153,7 +153,7 @@ const TencentCloudModal = ({
|
||||
open={visible || false}
|
||||
onOpenChange={(open) => !open && hideModal?.()}
|
||||
maskClosable={false}
|
||||
footer={null}
|
||||
footer={<div className="p-4"></div>}
|
||||
>
|
||||
<DynamicForm.Root
|
||||
fields={fields}
|
||||
|
||||
@@ -42,6 +42,19 @@ const llmFactoryToUrlMap: Partial<Record<LLMFactory, string>> = {
|
||||
[LLMFactory.TokenPony]: 'https://docs.tokenpony.cn/#/',
|
||||
};
|
||||
|
||||
function buildModelTypesWithVision(
|
||||
modelType: string[] | string,
|
||||
vision = false,
|
||||
): string[] {
|
||||
const modelTypeArray = Array.isArray(modelType) ? modelType : [modelType];
|
||||
|
||||
if (modelTypeArray.includes('chat') && vision) {
|
||||
return [...modelTypeArray, 'image2text'];
|
||||
}
|
||||
|
||||
return modelTypeArray;
|
||||
}
|
||||
|
||||
const OllamaModal = ({
|
||||
visible,
|
||||
hideModal,
|
||||
@@ -251,7 +264,7 @@ const OllamaModal = ({
|
||||
instance_name: initialValues.instance_name || '',
|
||||
llm_name: initialValues.llm_name || '',
|
||||
model_type: initialValues.model_type
|
||||
? initialValues.model_type.split(',').filter(Boolean)
|
||||
? initialValues.model_type
|
||||
: ['chat'],
|
||||
api_base: initialValues.api_base || '',
|
||||
max_tokens: initialValues.max_tokens || 8192,
|
||||
@@ -279,9 +292,6 @@ const OllamaModal = ({
|
||||
const handleOk = async (values?: FieldValues) => {
|
||||
if (!values) return;
|
||||
|
||||
const modelType = values.model_type.map((t: string) =>
|
||||
t === 'chat' && values.vision ? 'image2text' : t,
|
||||
);
|
||||
const modelTypeArray: string[] = Array.isArray(values.model_type)
|
||||
? values.model_type
|
||||
: [values.model_type];
|
||||
@@ -293,7 +303,7 @@ const OllamaModal = ({
|
||||
instance_name: values.instance_name as string,
|
||||
llm_factory: llmFactory,
|
||||
llm_name: values.llm_name as string,
|
||||
model_type: modelType,
|
||||
model_type: buildModelTypesWithVision(values.model_type, values.vision),
|
||||
api_base: values.api_base as string,
|
||||
api_key: values.api_key as string,
|
||||
max_tokens: values.max_tokens as number,
|
||||
@@ -314,9 +324,7 @@ const OllamaModal = ({
|
||||
const values = formRef.current?.getValues();
|
||||
return {
|
||||
llm_factory: llmFactory,
|
||||
model_type: values.model_type.map((t: string) =>
|
||||
t === 'chat' && values.vision ? 'image2text' : t,
|
||||
),
|
||||
model_type: buildModelTypesWithVision(values.model_type, values.vision),
|
||||
};
|
||||
}, [llmFactory]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user