Expose agent node usage (#24355)

This commit is contained in:
Davide Delbianco
2025-08-23 04:57:58 +02:00
committed by GitHub
parent da9af7b547
commit 0a2111f33d
24 changed files with 42 additions and 1 deletions

View File

@@ -467,6 +467,13 @@ export const SUPPORT_OUTPUT_VARS_NODE = [
BlockEnum.Agent,
]
export const AGENT_OUTPUT_STRUCT: Var[] = [
{
variable: 'usage',
type: VarType.object,
},
]
export const LLM_OUTPUT_STRUCT: Var[] = [
{
variable: 'text',

View File

@@ -24,6 +24,7 @@ import type { VariableAssignerNodeType } from '@/app/components/workflow/nodes/v
import type { Field as StructField } from '@/app/components/workflow/nodes/llm/types'
import {
AGENT_OUTPUT_STRUCT,
HTTP_REQUEST_OUTPUT_STRUCT,
KNOWLEDGE_RETRIEVAL_OUTPUT_STRUCT,
LLM_OUTPUT_STRUCT,
@@ -498,6 +499,7 @@ const formatItem = (
res.vars = [
...outputs,
...TOOL_OUTPUT_STRUCT,
...AGENT_OUTPUT_STRUCT,
]
break
}

View File

@@ -100,6 +100,11 @@ const AgentPanel: FC<NodePanelProps<AgentNodeType>> = (props) => {
type='String'
description={t(`${i18nPrefix}.outputVars.text`)}
/>
<VarItem
name='usage'
type='object'
description={t(`${i18nPrefix}.outputVars.usage`)}
/>
<VarItem
name='files'
type='Array[File]'