mirror of
https://github.com/langgenius/dify.git
synced 2026-05-06 10:28:10 +08:00
Expose LLM usage in workflows (#21766)
Co-authored-by: crazywoola <100913391+crazywoola@users.noreply.github.com>
This commit is contained in:
@ -480,6 +480,10 @@ export const LLM_OUTPUT_STRUCT: Var[] = [
|
||||
variable: 'text',
|
||||
type: VarType.string,
|
||||
},
|
||||
{
|
||||
variable: 'usage',
|
||||
type: VarType.object,
|
||||
},
|
||||
]
|
||||
|
||||
export const KNOWLEDGE_RETRIEVAL_OUTPUT_STRUCT: Var[] = [
|
||||
@ -501,6 +505,10 @@ export const QUESTION_CLASSIFIER_OUTPUT_STRUCT = [
|
||||
variable: 'class_name',
|
||||
type: VarType.string,
|
||||
},
|
||||
{
|
||||
variable: 'usage',
|
||||
type: VarType.object,
|
||||
},
|
||||
]
|
||||
|
||||
export const HTTP_REQUEST_OUTPUT_STRUCT: Var[] = [
|
||||
@ -546,6 +554,10 @@ export const PARAMETER_EXTRACTOR_COMMON_STRUCT: Var[] = [
|
||||
variable: '__reason',
|
||||
type: VarType.string,
|
||||
},
|
||||
{
|
||||
variable: '__usage',
|
||||
type: VarType.object,
|
||||
},
|
||||
]
|
||||
|
||||
export const FILE_STRUCT: Var[] = [
|
||||
|
||||
@ -282,6 +282,11 @@ const Panel: FC<NodePanelProps<LLMNodeType>> = ({
|
||||
type='string'
|
||||
description={t(`${i18nPrefix}.outputVars.output`)}
|
||||
/>
|
||||
<VarItem
|
||||
name='usage'
|
||||
type='object'
|
||||
description={t(`${i18nPrefix}.outputVars.usage`)}
|
||||
/>
|
||||
{inputs.structured_output_enabled && (
|
||||
<>
|
||||
<Split className='mt-3' />
|
||||
|
||||
@ -190,12 +190,17 @@ const Panel: FC<NodePanelProps<ParameterExtractorNodeType>> = ({
|
||||
<VarItem
|
||||
name='__is_success'
|
||||
type={VarType.number}
|
||||
description={t(`${i18nPrefix}.isSuccess`)}
|
||||
description={t(`${i18nPrefix}.outputVars.isSuccess`)}
|
||||
/>
|
||||
<VarItem
|
||||
name='__reason'
|
||||
type={VarType.string}
|
||||
description={t(`${i18nPrefix}.errorReason`)}
|
||||
description={t(`${i18nPrefix}.outputVars.errorReason`)}
|
||||
/>
|
||||
<VarItem
|
||||
name='__usage'
|
||||
type='object'
|
||||
description={t(`${i18nPrefix}.outputVars.usage`)}
|
||||
/>
|
||||
</>
|
||||
</OutputVars>
|
||||
|
||||
@ -129,6 +129,11 @@ const Panel: FC<NodePanelProps<QuestionClassifierNodeType>> = ({
|
||||
type='string'
|
||||
description={t(`${i18nPrefix}.outputVars.className`)}
|
||||
/>
|
||||
<VarItem
|
||||
name='usage'
|
||||
type='object'
|
||||
description={t(`${i18nPrefix}.outputVars.usage`)}
|
||||
/>
|
||||
</>
|
||||
</OutputVars>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user