diff --git a/web/app/components/workflow-app/hooks/use-workflow-template.ts b/web/app/components/workflow-app/hooks/use-workflow-template.ts index 5a89d3b3e7..4763377893 100644 --- a/web/app/components/workflow-app/hooks/use-workflow-template.ts +++ b/web/app/components/workflow-app/hooks/use-workflow-template.ts @@ -46,7 +46,7 @@ export const useWorkflowTemplate = () => { id: 'answer', data: { ...answerDefault.defaultValue, - answer: `{{#${llmNode.id}.text#}}`, + answer: `{{#${llmNode.id}.generation#}}`, type: answerDefault.metaData.type, title: t(`blocks.${answerDefault.metaData.type}`, { ns: 'workflow' }), }, diff --git a/web/app/components/workflow/constants.ts b/web/app/components/workflow/constants.ts index 01eb7a0793..b92e69a6ff 100644 --- a/web/app/components/workflow/constants.ts +++ b/web/app/components/workflow/constants.ts @@ -144,6 +144,24 @@ export const AGENT_OUTPUT_STRUCT: Var[] = [ ] export const LLM_OUTPUT_STRUCT: Var[] = [ + { + variable: 'generation', + type: VarType.object, + children: [ + { + variable: 'content', + type: VarType.string, + }, + { + variable: 'reasoning_content', + type: VarType.arrayString, + }, + { + variable: 'tool_calls', + type: VarType.arrayObject, + }, + ], + }, { variable: 'text', type: VarType.string, @@ -161,10 +179,6 @@ export const LLM_OUTPUT_STRUCT: Var[] = [ variable: 'usage', type: VarType.object, }, - { - variable: 'generation', - type: VarType.object, - }, ] export const KNOWLEDGE_RETRIEVAL_OUTPUT_STRUCT: Var[] = [ diff --git a/web/app/components/workflow/nodes/llm/panel.tsx b/web/app/components/workflow/nodes/llm/panel.tsx index 7df4bd3c50..fa2e6c3167 100644 --- a/web/app/components/workflow/nodes/llm/panel.tsx +++ b/web/app/components/workflow/nodes/llm/panel.tsx @@ -320,6 +320,28 @@ const Panel: FC> = ({ )} > <> + > = ({ type="object" description={t(`${i18nPrefix}.outputVars.usage`, { ns: 'workflow' })} /> - {inputs.structured_output_enabled && ( <>