From f194e8b4c43b6db3c94b78249196f3d1f5ea0791 Mon Sep 17 00:00:00 2001 From: balibabu Date: Mon, 1 Jun 2026 17:56:41 +0800 Subject: [PATCH] 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) --- web/public/iconfont.js | 19 +++++++++------ web/src/components/svg-icon.tsx | 2 ++ web/src/hooks/use-llm-request.tsx | 9 +++++++ .../modal/next-tencent-modal/index.tsx | 2 +- .../modal/ollama-modal/index.tsx | 24 ++++++++++++------- 5 files changed, 40 insertions(+), 16 deletions(-) diff --git a/web/public/iconfont.js b/web/public/iconfont.js index bd97aeb5a8..0f84c0258c 100644 --- a/web/public/iconfont.js +++ b/web/public/iconfont.js @@ -1,4 +1,5 @@ -(window._iconfont_svg_string_4909832 = +/* eslint-disable */ +((window._iconfont_svg_string_4909832 = '' + ` @@ -71,6 +72,10 @@ + + + + ` + '' + '' + @@ -175,10 +180,10 @@ console && console.log(a); } } - (c = function () { + ((c = function () { var a, l = document.createElement('div'); - (l.innerHTML = h._iconfont_svg_string_4909832), + ((l.innerHTML = h._iconfont_svg_string_4909832), (l = l.getElementsByTagName('svg')[0]) && (l.setAttribute('aria-hidden', 'true'), (l.style.position = 'absolute'), @@ -188,13 +193,13 @@ (l = l), (a = document.body).firstChild ? z(l, a.firstChild) - : a.appendChild(l)); + : a.appendChild(l))); }), document.addEventListener ? ~['complete', 'loaded', 'interactive'].indexOf(document.readyState) ? setTimeout(c, 0) : ((t = function () { - document.removeEventListener('DOMContentLoaded', t, !1), c(); + (document.removeEventListener('DOMContentLoaded', t, !1), c()); }), document.addEventListener('DOMContentLoaded', t, !1)) : document.attachEvent && @@ -205,7 +210,7 @@ (v.onreadystatechange = function () { 'complete' == v.readyState && ((v.onreadystatechange = null), p()); - })); + }))); } function p() { o || ((o = !0), i()); @@ -218,4 +223,4 @@ } p(); } - })(window); + })(window)); diff --git a/web/src/components/svg-icon.tsx b/web/src/components/svg-icon.tsx index 95a8732366..3e3ee85cb3 100644 --- a/web/src/components/svg-icon.tsx +++ b/web/src/components/svg-icon.tsx @@ -72,6 +72,8 @@ const themeIcons = [ LLMFactory.Meituan, LLMFactory.Longcat, LLMFactory.MinerU, + LLMFactory.JiekouAI, + LLMFactory.Perplexity, ]; const svgIcons = [ diff --git a/web/src/hooks/use-llm-request.tsx b/web/src/hooks/use-llm-request.tsx index b7038f697a..5cf69deb60 100644 --- a/web/src/hooks/use-llm-request.tsx +++ b/web/src/hooks/use-llm-request.tsx @@ -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(), }); diff --git a/web/src/pages/user-setting/setting-model/modal/next-tencent-modal/index.tsx b/web/src/pages/user-setting/setting-model/modal/next-tencent-modal/index.tsx index 2f080684ec..e3c6592157 100644 --- a/web/src/pages/user-setting/setting-model/modal/next-tencent-modal/index.tsx +++ b/web/src/pages/user-setting/setting-model/modal/next-tencent-modal/index.tsx @@ -153,7 +153,7 @@ const TencentCloudModal = ({ open={visible || false} onOpenChange={(open) => !open && hideModal?.()} maskClosable={false} - footer={null} + footer={
} > > = { [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]);