@@ -106,7 +106,6 @@ def __init__(
106
106
107
107
self ._task_state = WorkflowTaskState ()
108
108
self ._wip_workflow_node_executions = {}
109
- self .total_tokens : int = 0
110
109
111
110
def process (self ) -> Union [WorkflowAppBlockingResponse , Generator [WorkflowAppStreamResponse , None , None ]]:
112
111
"""
@@ -320,8 +319,6 @@ def _process_stream_response(
320
319
if not workflow_run :
321
320
raise Exception ("Workflow run not initialized." )
322
321
323
- # FIXME for issue #11221 quick fix maybe have a better solution
324
- self .total_tokens += event .metadata .get ("total_tokens" , 0 ) if event .metadata else 0
325
322
yield self ._workflow_iteration_completed_to_stream_response (
326
323
task_id = self ._application_generate_entity .task_id , workflow_run = workflow_run , event = event
327
324
)
@@ -335,7 +332,7 @@ def _process_stream_response(
335
332
workflow_run = self ._handle_workflow_run_success (
336
333
workflow_run = workflow_run ,
337
334
start_at = graph_runtime_state .start_at ,
338
- total_tokens = graph_runtime_state .total_tokens or self . total_tokens ,
335
+ total_tokens = graph_runtime_state .total_tokens ,
339
336
total_steps = graph_runtime_state .node_run_steps ,
340
337
outputs = event .outputs ,
341
338
conversation_id = None ,
0 commit comments