From 77950e48c76f4a3b29d01831d43039caba29888a Mon Sep 17 00:00:00 2001
From: wwf <1971391498@qq.com>
Date: 星期二, 18 十一月 2025 14:12:42 +0800
Subject: [PATCH] 修改
---
app/components/workflow/nodes/llm/use-config.ts | 49 +++++++++----------------------------------------
1 files changed, 9 insertions(+), 40 deletions(-)
diff --git a/app/components/workflow/nodes/llm/use-config.ts b/app/components/workflow/nodes/llm/use-config.ts
index 13db9e4..ee9f2ca 100644
--- a/app/components/workflow/nodes/llm/use-config.ts
+++ b/app/components/workflow/nodes/llm/use-config.ts
@@ -9,10 +9,9 @@
} from '../../hooks'
import useAvailableVarList from '../_base/hooks/use-available-var-list'
import useConfigVision from '../../hooks/use-config-vision'
-import type { LLMNodeType, StructuredOutput } from './types'
-import { useModelList, useModelListAndDefaultModelAndCurrentProviderAndModel } from '@/app/components/header/account-setting/model-provider-page/hooks'
+import type { LLMNodeType } from './types'
+import { useModelListAndDefaultModelAndCurrentProviderAndModel } from '@/app/components/header/account-setting/model-provider-page/hooks'
import {
- ModelFeatureEnum,
ModelTypeEnum,
} from '@/app/components/header/account-setting/model-provider-page/declarations'
import useNodeCrud from '@/app/components/workflow/nodes/_base/hooks/use-node-crud'
@@ -278,30 +277,6 @@
setInputs(newInputs)
}, [inputs, setInputs])
- // structure output
- const { data: modelList } = useModelList(ModelTypeEnum.textGeneration)
- const isModelSupportStructuredOutput = modelList
- ?.find(provideItem => provideItem.provider === model?.provider)
- ?.models.find(modelItem => modelItem.model === model?.name)
- ?.features?.includes(ModelFeatureEnum.StructuredOutput)
-
- const [structuredOutputCollapsed, setStructuredOutputCollapsed] = useState(true)
- const handleStructureOutputEnableChange = useCallback((enabled: boolean) => {
- const newInputs = produce(inputs, (draft) => {
- draft.structured_output_enabled = enabled
- })
- setInputs(newInputs)
- if (enabled)
- setStructuredOutputCollapsed(false)
- }, [inputs, setInputs])
-
- const handleStructureOutputChange = useCallback((newOutput: StructuredOutput) => {
- const newInputs = produce(inputs, (draft) => {
- draft.structured_output = newOutput
- })
- setInputs(newInputs)
- }, [inputs, setInputs])
-
const filterInputVar = useCallback((varPayload: Var) => {
return [VarType.number, VarType.string, VarType.secret, VarType.arrayString, VarType.arrayNumber, VarType.file, VarType.arrayFile].includes(varPayload.type)
}, [])
@@ -331,7 +306,6 @@
handleRun,
handleStop,
runInputData,
- runInputDataRef,
setRunInputData,
runResult,
toVarInputs,
@@ -357,27 +331,27 @@
const setInputVarValues = useCallback((newPayload: Record<string, any>) => {
const newVars = {
...newPayload,
- '#context#': runInputDataRef.current['#context#'],
- '#files#': runInputDataRef.current['#files#'],
+ '#context#': runInputData['#context#'],
+ '#files#': runInputData['#files#'],
}
setRunInputData(newVars)
- }, [runInputDataRef, setRunInputData])
+ }, [runInputData, setRunInputData])
const contexts = runInputData['#context#']
const setContexts = useCallback((newContexts: string[]) => {
setRunInputData({
- ...runInputDataRef.current,
+ ...runInputData,
'#context#': newContexts,
})
- }, [runInputDataRef, setRunInputData])
+ }, [runInputData, setRunInputData])
const visionFiles = runInputData['#files#']
const setVisionFiles = useCallback((newFiles: any[]) => {
setRunInputData({
- ...runInputDataRef.current,
+ ...runInputData,
'#files#': newFiles,
})
- }, [runInputDataRef, setRunInputData])
+ }, [runInputData, setRunInputData])
const allVarStrArr = (() => {
const arr = isChatModel ? (inputs.prompt_template as PromptItem[]).filter(item => item.edition_type !== EditionType.jinja2).map(item => item.text) : [(inputs.prompt_template as PromptItem).text]
@@ -433,11 +407,6 @@
setContexts,
varInputs,
runningStatus,
- isModelSupportStructuredOutput,
- handleStructureOutputChange,
- structuredOutputCollapsed,
- setStructuredOutputCollapsed,
- handleStructureOutputEnableChange,
handleRun,
handleStop,
runResult,
--
Gitblit v1.8.0