mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-16 13:35:58 +08:00
chore: remove useless code handle output var
This commit is contained in:
parent
bfaa601aca
commit
001385e843
@ -1,31 +0,0 @@
|
||||
'use client'
|
||||
import type { FC } from 'react'
|
||||
import React from 'react'
|
||||
import mockStructData from '@/app/components/workflow/nodes/llm/mock-struct-data'
|
||||
import VarFullPathPanel from '../var-full-path-panel'
|
||||
import PickerPanel from '@/app/components/workflow/nodes/_base/components/variable/object-child-tree-panel/picker'
|
||||
import ShowPanel from '@/app/components/workflow/nodes/_base/components/variable/object-child-tree-panel/show'
|
||||
import { Type } from '../../../../llm/types'
|
||||
|
||||
const Test: FC = () => {
|
||||
return (
|
||||
<div className='mb-2 space-y-2'>
|
||||
<VarFullPathPanel
|
||||
nodeName='LLM'
|
||||
path={['memory', 'content', 'text']}
|
||||
varType={Type.string}
|
||||
/>
|
||||
<div className='my-2 w-[404px] bg-white'>
|
||||
<ShowPanel
|
||||
payload={mockStructData}
|
||||
/>
|
||||
</div>
|
||||
<PickerPanel
|
||||
root={{ nodeName: 'LLM', attrName: 'structured_output' }}
|
||||
payload={mockStructData}
|
||||
onSelect={() => { }}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
export default React.memo(Test)
|
@ -20,7 +20,6 @@ import { BlockEnum, InputVarType, VarType } from '@/app/components/workflow/type
|
||||
import type { StartNodeType } from '@/app/components/workflow/nodes/start/types'
|
||||
import type { ConversationVariable, EnvironmentVariable, Node, NodeOutPutVar, ValueSelector, Var } from '@/app/components/workflow/types'
|
||||
import type { VariableAssignerNodeType } from '@/app/components/workflow/nodes/variable-assigner/types'
|
||||
import mockStructData from '@/app/components/workflow/nodes/llm/mock-struct-data'
|
||||
import type { Field as StructField } from '@/app/components/workflow/nodes/llm/types'
|
||||
|
||||
import {
|
||||
@ -500,9 +499,6 @@ const formatItem = (
|
||||
return findExceptVarInObject(isFile ? { ...v, children } : v, filterVar, selector, isFile)
|
||||
})
|
||||
|
||||
// if (res.nodeId === 'llm')
|
||||
// console.log(res)
|
||||
|
||||
return res
|
||||
}
|
||||
export const toNodeOutputVars = (
|
||||
@ -1237,15 +1233,16 @@ export const getNodeOutputVars = (node: Node, isChatMode: boolean): ValueSelecto
|
||||
}
|
||||
|
||||
case BlockEnum.LLM: {
|
||||
varsToValueSelectorList([
|
||||
...LLM_OUTPUT_STRUCT,
|
||||
{
|
||||
const vars = [...LLM_OUTPUT_STRUCT]
|
||||
const llmNodeData = data as LLMNodeType
|
||||
if (llmNodeData.structured_output_enabled && llmNodeData.structured_output?.schema?.properties && Object.keys(llmNodeData.structured_output.schema.properties).length > 0) {
|
||||
vars.push({
|
||||
variable: 'structured_output',
|
||||
type: VarType.object,
|
||||
children: mockStructData,
|
||||
},
|
||||
], [id], res)
|
||||
console.log(res)
|
||||
children: llmNodeData.structured_output,
|
||||
})
|
||||
}
|
||||
varsToValueSelectorList(vars, [id], res)
|
||||
break
|
||||
}
|
||||
|
||||
|
@ -1,113 +0,0 @@
|
||||
import { type StructuredOutput, Type } from './types'
|
||||
|
||||
const data: StructuredOutput = {
|
||||
schema: {
|
||||
type: Type.object,
|
||||
properties: {
|
||||
string_field: {
|
||||
type: Type.string,
|
||||
description: '这是一个字符串类型的字段',
|
||||
},
|
||||
obj_field: {
|
||||
type: Type.object,
|
||||
properties: {
|
||||
string_field_1: {
|
||||
type: Type.string,
|
||||
description: 'this is a string type field',
|
||||
},
|
||||
number_field_2: {
|
||||
type: Type.number,
|
||||
description: '描述可为空',
|
||||
},
|
||||
array_field_4: {
|
||||
type: Type.array,
|
||||
items: {
|
||||
type: Type.string,
|
||||
},
|
||||
},
|
||||
boolean_field_5: {
|
||||
type: Type.boolean,
|
||||
description: '描述可为空',
|
||||
},
|
||||
sub_item_d_2: {
|
||||
type: Type.object,
|
||||
properties: {
|
||||
sub_item_3: {
|
||||
type: Type.object,
|
||||
// generate more than sub item 10 levels
|
||||
properties: {
|
||||
sub_item_4: {
|
||||
type: Type.object,
|
||||
properties: {
|
||||
sub_item_5: {
|
||||
type: Type.object,
|
||||
properties: {
|
||||
sub_item_6: {
|
||||
type: Type.object,
|
||||
properties: {
|
||||
sub_item_7: {
|
||||
type: Type.object,
|
||||
properties: {
|
||||
sub_item_8: {
|
||||
type: Type.object,
|
||||
properties: {
|
||||
sub_item_9: {
|
||||
type: Type.object,
|
||||
properties: {
|
||||
sub_item_10: {
|
||||
type: Type.object,
|
||||
properties: {
|
||||
sub_item_11: {
|
||||
type: Type.object,
|
||||
properties: {
|
||||
sub_item_12: {
|
||||
type: Type.object,
|
||||
description: 'This is a object type field.This is a object type field.This is a object type field.',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
number_field_3: {
|
||||
type: Type.number,
|
||||
description: '描述可为空',
|
||||
},
|
||||
},
|
||||
required: [
|
||||
'string_field_1',
|
||||
'number_field_2',
|
||||
'enum_field_3',
|
||||
'array_field_4',
|
||||
'boolean_field_5',
|
||||
],
|
||||
additionalProperties: false,
|
||||
},
|
||||
},
|
||||
required: [
|
||||
'string_field_1',
|
||||
'number_field_2',
|
||||
'enum_field_3',
|
||||
'array_field_4',
|
||||
'boolean_field_5',
|
||||
],
|
||||
additionalProperties: false,
|
||||
},
|
||||
}
|
||||
|
||||
export default data
|
Loading…
x
Reference in New Issue
Block a user