mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-06 08:06:05 +08:00
feat: llm output changes remove var
This commit is contained in:
parent
0600f10e12
commit
55a6ade90e
@ -18,6 +18,7 @@ import {
|
|||||||
import useNodeCrud from '@/app/components/workflow/nodes/_base/hooks/use-node-crud'
|
import useNodeCrud from '@/app/components/workflow/nodes/_base/hooks/use-node-crud'
|
||||||
import { checkHasContextBlock, checkHasHistoryBlock, checkHasQueryBlock } from '@/app/components/base/prompt-editor/constants'
|
import { checkHasContextBlock, checkHasHistoryBlock, checkHasQueryBlock } from '@/app/components/base/prompt-editor/constants'
|
||||||
import type { PanelProps } from '@/types/workflow'
|
import type { PanelProps } from '@/types/workflow'
|
||||||
|
import useInspectVarsCrud from '@/app/components/workflow/hooks/use-inspect-vars-crud'
|
||||||
|
|
||||||
const useConfig = (id: string, payload: LLMNodeType, panelProps?: PanelProps) => {
|
const useConfig = (id: string, payload: LLMNodeType, panelProps?: PanelProps) => {
|
||||||
const getVarInputs = panelProps?.getInputVars
|
const getVarInputs = panelProps?.getInputVars
|
||||||
@ -34,6 +35,8 @@ const useConfig = (id: string, payload: LLMNodeType, panelProps?: PanelProps) =>
|
|||||||
const { inputs, setInputs: doSetInputs } = useNodeCrud<LLMNodeType>(id, payload)
|
const { inputs, setInputs: doSetInputs } = useNodeCrud<LLMNodeType>(id, payload)
|
||||||
const inputRef = useRef(inputs)
|
const inputRef = useRef(inputs)
|
||||||
|
|
||||||
|
const { deleteNodeInspectorVars } = useInspectVarsCrud()
|
||||||
|
|
||||||
const setInputs = useCallback((newInputs: LLMNodeType) => {
|
const setInputs = useCallback((newInputs: LLMNodeType) => {
|
||||||
if (newInputs.memory && !newInputs.memory.role_prefix) {
|
if (newInputs.memory && !newInputs.memory.role_prefix) {
|
||||||
const newPayload = produce(newInputs, (draft) => {
|
const newPayload = produce(newInputs, (draft) => {
|
||||||
@ -298,14 +301,16 @@ const useConfig = (id: string, payload: LLMNodeType, panelProps?: PanelProps) =>
|
|||||||
setInputs(newInputs)
|
setInputs(newInputs)
|
||||||
if (enabled)
|
if (enabled)
|
||||||
setStructuredOutputCollapsed(false)
|
setStructuredOutputCollapsed(false)
|
||||||
}, [inputs, setInputs])
|
deleteNodeInspectorVars(id)
|
||||||
|
}, [inputs, setInputs, deleteNodeInspectorVars, id])
|
||||||
|
|
||||||
const handleStructureOutputChange = useCallback((newOutput: StructuredOutput) => {
|
const handleStructureOutputChange = useCallback((newOutput: StructuredOutput) => {
|
||||||
const newInputs = produce(inputs, (draft) => {
|
const newInputs = produce(inputs, (draft) => {
|
||||||
draft.structured_output = newOutput
|
draft.structured_output = newOutput
|
||||||
})
|
})
|
||||||
setInputs(newInputs)
|
setInputs(newInputs)
|
||||||
}, [inputs, setInputs])
|
deleteNodeInspectorVars(id)
|
||||||
|
}, [inputs, setInputs, deleteNodeInspectorVars, id])
|
||||||
|
|
||||||
const filterInputVar = useCallback((varPayload: Var) => {
|
const filterInputVar = useCallback((varPayload: Var) => {
|
||||||
return [VarType.number, VarType.string, VarType.secret, VarType.arrayString, VarType.arrayNumber, VarType.file, VarType.arrayFile].includes(varPayload.type)
|
return [VarType.number, VarType.string, VarType.secret, VarType.arrayString, VarType.arrayNumber, VarType.file, VarType.arrayFile].includes(varPayload.type)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user