fix: llm generation variable

This commit is contained in:
zxhlyh 2026-01-21 14:56:49 +08:00
parent b0a059250a
commit e85b0c49d8
3 changed files with 41 additions and 10 deletions

View File

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

View File

@ -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[] = [

View File

@ -320,6 +320,28 @@ const Panel: FC<NodePanelProps<LLMNodeType>> = ({
)}
>
<>
<VarItem
name="generation"
type="object"
description={t(`${i18nPrefix}.outputVars.generation`, { ns: 'workflow' })}
subItems={[
{
name: 'content',
type: 'string',
description: '',
},
{
name: 'reasoning_content',
type: 'array[string]',
description: '',
},
{
name: 'tool_calls',
type: 'array[object]',
description: '',
},
]}
/>
<VarItem
name="text"
type="string"
@ -335,11 +357,6 @@ const Panel: FC<NodePanelProps<LLMNodeType>> = ({
type="object"
description={t(`${i18nPrefix}.outputVars.usage`, { ns: 'workflow' })}
/>
<VarItem
name="generation"
type="object"
description={t(`${i18nPrefix}.outputVars.generation`, { ns: 'workflow' })}
/>
{inputs.structured_output_enabled && (
<>
<Split className="mt-3" />