fix: remove LLM dependency logic from answer stream generate router

pull/22201/head
baonudesifeizhai 10 months ago
parent 1329f69072
commit bf1aa35974

@ -151,6 +151,18 @@ class AnswerStreamGeneratorRouter:
continue continue
source_node_type = node_id_config_mapping[source_node_id].get("data", {}).get("type") source_node_type = node_id_config_mapping[source_node_id].get("data", {}).get("type")
source_node_data = node_id_config_mapping[source_node_id].get("data", {}) source_node_data = node_id_config_mapping[source_node_id].get("data", {})
# Check if this answer node uses sys.total_tokens and add LLM dependencies
if source_node_type == NodeType.LLM.value:
answer_node_config = node_id_config_mapping.get(answer_node_id)
if answer_node_config:
answer_data = answer_node_config.get("data", {})
answer_text = answer_data.get("answer", "")
# Check if the answer template contains sys.total_tokens
if "{{#sys.total_tokens#}}" in answer_text:
answer_dependencies[answer_node_id].append(source_node_id)
continue
if ( if (
source_node_type source_node_type
in { in {

@ -155,8 +155,18 @@ const Panel: FC<NodePanelProps<StartNodeType>> = ({
</div> </div>
} }
/> />
<VarItem
readonly
payload={{
variable: 'sys.total_tokens',
} as any}
rightContent={
<div className='text-xs font-normal text-text-tertiary'>
Number
</div>
}
/>
</div> </div>
</> </>
</Field> </Field>
</div> </div>

Loading…
Cancel
Save