diff --git a/web/app/components/app/configuration/debug/index.tsx b/web/app/components/app/configuration/debug/index.tsx index c16c98b7d..6d4401e41 100644 --- a/web/app/components/app/configuration/debug/index.tsx +++ b/web/app/components/app/configuration/debug/index.tsx @@ -673,7 +673,7 @@ const Debug: FC = ({ } const handleVisionConfigInMultipleModel = () => { - if (debugWithMultipleModel && !visionConfig.enabled) { + if (debugWithMultipleModel && mode) { const supportedVision = multipleModelConfigs.some((modelConfig) => { const currentProvider = textGenerationModelList.find(modelItem => modelItem.provider === modelConfig.provider) const currentModel = currentProvider?.models.find(model => model.model === modelConfig.model) @@ -698,7 +698,7 @@ const Debug: FC = ({ useEffect(() => { handleVisionConfigInMultipleModel() - }, [multipleModelConfigs]) + }, [multipleModelConfigs, mode]) const allToolIcons = (() => { const icons: Record = {} modelConfig.agentConfig.tools?.forEach((item: any) => { diff --git a/web/app/components/app/configuration/index.tsx b/web/app/components/app/configuration/index.tsx index 1f4c4c418..08a3ea358 100644 --- a/web/app/components/app/configuration/index.tsx +++ b/web/app/components/app/configuration/index.tsx @@ -284,6 +284,23 @@ const Configuration: FC = () => { doSetPromptMode(mode) } + const [visionConfig, doSetVisionConfig] = useState({ + enabled: false, + number_limits: 2, + detail: Resolution.low, + transfer_methods: [TransferMethod.local_file], + }) + + const handleSetVisionConfig = (config: VisionSettings, notNoticeFormattingChanged?: boolean) => { + doSetVisionConfig({ + enabled: config.enabled || false, + number_limits: config.number_limits || 2, + detail: config.detail || Resolution.low, + transfer_methods: config.transfer_methods || [TransferMethod.local_file], + }) + if (!notNoticeFormattingChanged) + setFormattingChanged(true) + } const { chatPromptConfig, @@ -309,7 +326,6 @@ const Configuration: FC = () => { setCompletionParams, setStop: setTempStop, }) - const setModel = async ({ modelId, provider, @@ -342,9 +358,8 @@ const Configuration: FC = () => { setModelConfig(newModelConfig) const supportVision = features && features.includes(ModelFeatureEnum.vision) - // eslint-disable-next-line @typescript-eslint/no-use-before-define - setVisionConfig({ - // eslint-disable-next-line @typescript-eslint/no-use-before-define + + handleSetVisionConfig({ ...visionConfig, enabled: supportVision, }, true) @@ -352,18 +367,6 @@ const Configuration: FC = () => { } const isShowVisionConfig = !!currModel?.features?.includes(ModelFeatureEnum.vision) - const [visionConfig, doSetVisionConfig] = useState({ - enabled: false, - number_limits: 2, - detail: Resolution.low, - transfer_methods: [TransferMethod.local_file], - }) - - const setVisionConfig = (config: VisionSettings, notNoticeFormattingChanged?: boolean) => { - doSetVisionConfig(config) - if (!notNoticeFormattingChanged) - setFormattingChanged(true) - } useEffect(() => { (async () => { @@ -484,7 +487,7 @@ const Configuration: FC = () => { } if (modelConfig.file_upload) - setVisionConfig(modelConfig.file_upload.image, true) + handleSetVisionConfig(modelConfig.file_upload.image, true) syncToPublishedConfig(config) setPublishedConfig(config) @@ -727,7 +730,7 @@ const Configuration: FC = () => { hasSetContextVar, isShowVisionConfig, visionConfig, - setVisionConfig, + setVisionConfig: handleSetVisionConfig, }} > <> diff --git a/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/index.tsx b/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/index.tsx index 1089c0dd4..b5e80f6fd 100644 --- a/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/index.tsx +++ b/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/index.tsx @@ -26,7 +26,6 @@ import { PortalToFollowElemContent, PortalToFollowElemTrigger, } from '@/app/components/base/portal-to-follow-elem' -import { CubeOutline } from '@/app/components/base/icons/src/vender/line/shapes' import { fetchModelParameterRules } from '@/service/common' import Loading from '@/app/components/base/loading' import { useProviderContext } from '@/context/provider-context' @@ -198,14 +197,10 @@ const ModelParameterModal: FC = ({
-
- - {t('common.modelProvider.modelAndParameters')} -
-
+
-
- {t('common.modelProvider.model')} +
+ {t('common.modelProvider.model').toLocaleUpperCase()}