diff --git a/web/app/components/workflow/hooks/use-config-vision.ts b/web/app/components/workflow/hooks/use-config-vision.ts index 7c36ed939a..a3cddbc47c 100644 --- a/web/app/components/workflow/hooks/use-config-vision.ts +++ b/web/app/components/workflow/hooks/use-config-vision.ts @@ -1,5 +1,6 @@ import produce from 'immer' import { useCallback } from 'react' +import { useIsChatMode } from './use-workflow' import type { ModelConfig, VisionSetting } from '@/app/components/workflow/types' import { useTextGenerationCurrentProviderAndModelAndModelList } from '@/app/components/header/account-setting/model-provider-page/hooks' import { @@ -31,6 +32,8 @@ const useConfigVision = (model: ModelConfig, { }, ) + const isChatMode = useIsChatMode() + const getIsVisionModel = useCallback(() => { return !!currModel?.features?.includes(ModelFeatureEnum.vision) }, [currModel]) @@ -40,9 +43,15 @@ const useConfigVision = (model: ModelConfig, { const handleVisionResolutionEnabledChange = useCallback((enabled: boolean) => { const newPayload = produce(payload, (draft) => { draft.enabled = enabled + if (enabled && isChatMode) { + draft.configs = { + detail: Resolution.high, + variable_selector: ['sys', 'files'], + } + } }) onChange(newPayload) - }, [onChange, payload]) + }, [isChatMode, onChange, payload]) const handleVisionResolutionChange = useCallback((config: VisionSetting) => { const newPayload = produce(payload, (draft) => { diff --git a/web/app/components/workflow/nodes/_base/components/config-vision.tsx b/web/app/components/workflow/nodes/_base/components/config-vision.tsx index ac7a9b7563..56cd1a5dbb 100644 --- a/web/app/components/workflow/nodes/_base/components/config-vision.tsx +++ b/web/app/components/workflow/nodes/_base/components/config-vision.tsx @@ -9,7 +9,7 @@ import Field from '@/app/components/workflow/nodes/_base/components/field' import Switch from '@/app/components/base/switch' import { type ValueSelector, type Var, VarType, type VisionSetting } from '@/app/components/workflow/types' import { Resolution } from '@/types/app' -import TooltipPlus from '@/app/components/base/tooltip' +import Tooltip from '@/app/components/base/tooltip' const i18nPrefix = 'workflow.nodes.llm' type Props = { @@ -58,13 +58,12 @@ const ConfigVision: FC = ({ title={t(`${i18nPrefix}.vision`)} tooltip={t('appDebug.vision.description')!} operations={ - - + } > {(enabled && isVisionModel)