diff --git a/web/app/components/app/configuration/index.tsx b/web/app/components/app/configuration/index.tsx index 4b60fc80de..cc6909d151 100644 --- a/web/app/components/app/configuration/index.tsx +++ b/web/app/components/app/configuration/index.tsx @@ -77,6 +77,7 @@ import { correctToolProvider, } from '@/utils' import PluginDependency from '@/app/components/workflow/plugin-dependency' +import { supportFunctionCall } from '@/utils/tool-call' type PublishConfig = { modelConfig: ModelConfig @@ -347,12 +348,7 @@ const Configuration: FC = () => { }, ) - const isFunctionCall = (() => { - const features = currModel?.features - if (!features) - return false - return features.includes(ModelFeatureEnum.toolCall) || features.includes(ModelFeatureEnum.multiToolCall) - })() + const isFunctionCall = supportFunctionCall(currModel?.features) // Fill old app data missing model mode. useEffect(() => { diff --git a/web/app/components/header/account-setting/model-provider-page/declarations.ts b/web/app/components/header/account-setting/model-provider-page/declarations.ts index 486a1e44f5..39e229cd54 100644 --- a/web/app/components/header/account-setting/model-provider-page/declarations.ts +++ b/web/app/components/header/account-setting/model-provider-page/declarations.ts @@ -55,6 +55,7 @@ export enum ModelFeatureEnum { toolCall = 'tool-call', multiToolCall = 'multi-tool-call', agentThought = 'agent-thought', + streamToolCall = 'stream-tool-call', vision = 'vision', video = 'video', document = 'document', diff --git a/web/app/components/header/account-setting/model-provider-page/model-selector/popup.tsx b/web/app/components/header/account-setting/model-provider-page/model-selector/popup.tsx index 88d52e7c7d..6a336fb6f7 100644 --- a/web/app/components/header/account-setting/model-provider-page/model-selector/popup.tsx +++ b/web/app/components/header/account-setting/model-provider-page/model-selector/popup.tsx @@ -15,6 +15,7 @@ import { useLanguage } from '../hooks' import PopupItem from './popup-item' import { XCircle } from '@/app/components/base/icons/src/vender/solid/general' import { useModalContext } from '@/context/modal-context' +import { supportFunctionCall } from '@/utils/tool-call' type PopupProps = { defaultModel?: DefaultModel @@ -50,7 +51,7 @@ const Popup: FC = ({ return true return scopeFeatures.every((feature) => { if (feature === ModelFeatureEnum.toolCall) - return modelItem.features?.some(featureItem => featureItem === ModelFeatureEnum.toolCall || featureItem === ModelFeatureEnum.multiToolCall) + return supportFunctionCall(modelItem.features) return modelItem.features?.some(featureItem => featureItem === feature) }) }) diff --git a/web/app/components/workflow/nodes/parameter-extractor/use-config.ts b/web/app/components/workflow/nodes/parameter-extractor/use-config.ts index 3875d9e59b..045737b230 100644 --- a/web/app/components/workflow/nodes/parameter-extractor/use-config.ts +++ b/web/app/components/workflow/nodes/parameter-extractor/use-config.ts @@ -12,13 +12,11 @@ import useOneStepRun from '../_base/hooks/use-one-step-run' import useConfigVision from '../../hooks/use-config-vision' import type { Param, ParameterExtractorNodeType, ReasoningModeType } from './types' import { useModelListAndDefaultModelAndCurrentProviderAndModel, useTextGenerationCurrentProviderAndModelAndModelList } from '@/app/components/header/account-setting/model-provider-page/hooks' -import { - ModelFeatureEnum, - ModelTypeEnum, -} from '@/app/components/header/account-setting/model-provider-page/declarations' +import { ModelTypeEnum } from '@/app/components/header/account-setting/model-provider-page/declarations' import useNodeCrud from '@/app/components/workflow/nodes/_base/hooks/use-node-crud' import { checkHasQueryBlock } from '@/app/components/base/prompt-editor/constants' import useAvailableVarList from '@/app/components/workflow/nodes/_base/hooks/use-available-var-list' +import { supportFunctionCall } from '@/utils/tool-call' const useConfig = (id: string, payload: ParameterExtractorNodeType) => { const { nodesReadOnly: readOnly } = useNodesReadOnly() @@ -159,7 +157,7 @@ const useConfig = (id: string, payload: ParameterExtractorNodeType) => { }, ) - const isSupportFunctionCall = currModel?.features?.includes(ModelFeatureEnum.toolCall) || currModel?.features?.includes(ModelFeatureEnum.multiToolCall) + const isSupportFunctionCall = supportFunctionCall(currModel?.features) const filterInputVar = useCallback((varPayload: Var) => { return [VarType.number, VarType.string].includes(varPayload.type) diff --git a/web/utils/tool-call.ts b/web/utils/tool-call.ts new file mode 100644 index 0000000000..8735cc5d81 --- /dev/null +++ b/web/utils/tool-call.ts @@ -0,0 +1,6 @@ +import { ModelFeatureEnum } from '@/app/components/header/account-setting/model-provider-page/declarations' + +export const supportFunctionCall = (features: ModelFeatureEnum[] = []): boolean => { + if (!features || !features.length) return false + return features.some(feature => [ModelFeatureEnum.toolCall, ModelFeatureEnum.multiToolCall, ModelFeatureEnum.streamToolCall].includes(feature)) +}