fix: fix cannot select stream-tool-call in agent modal (#17015)

This commit is contained in:
Good Wood 2025-03-29 14:47:28 +08:00 committed by GitHub
parent 87034e26ae
commit 42968cb945
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 14 additions and 12 deletions

View File

@ -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(() => {

View File

@ -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',

View File

@ -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<PopupProps> = ({
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)
})
})

View File

@ -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)

6
web/utils/tool-call.ts Normal file
View File

@ -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))
}