File tree Expand file tree Collapse file tree 2 files changed +5
-8
lines changed
typescript-sdk/integrations/adk-middleware/src/adk_middleware Expand file tree Collapse file tree 2 files changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -862,10 +862,9 @@ async def _run_adk_in_background(
862
862
):
863
863
864
864
final_response = adk_event .is_final_response ()
865
- no_usage_response = not adk_event .usage_metadata
866
865
has_content = adk_event .content and hasattr (adk_event .content , 'parts' ) and adk_event .content .parts
867
866
868
- if not final_response or (no_usage_response and has_content ):
867
+ if not final_response or (not adk_event . usage_metadata and has_content ):
869
868
# Translate and emit events
870
869
async for ag_ui_event in event_translator .translate (
871
870
adk_event ,
Original file line number Diff line number Diff line change @@ -174,15 +174,13 @@ async def _translate_text_content(
174
174
should_send_end = is_final_response and not is_partial
175
175
176
176
logger .info (f"📥 Text event - partial={ is_partial } , turn_complete={ turn_complete } , "
177
- f"is_final_response={ is_final_response } , should_send_end={ should_send_end } , "
178
- f"currently_streaming={ self ._is_streaming } " )
179
-
180
- # Skip final response events to avoid duplicate content, but send END if streaming
177
+ f"is_final_response={ is_final_response } , should_send_end={ should_send_end } , "
178
+ f"currently_streaming={ self ._is_streaming } " )
179
+
181
180
if is_final_response :
182
181
183
182
# If a final text response wasn't streamed (not generated by an LLM) then deliver it in 3 events
184
- no_usage_response = not hasattr (adk_event , 'usage_metadata' ) or not adk_event .usage_metadata
185
- if not self ._is_streaming and no_usage_response and should_send_end :
183
+ if not self ._is_streaming and not adk_event .usage_metadata and should_send_end :
186
184
logger .info (f"⏭️ Deliver non-llm response via message events "
187
185
f"event_id={ adk_event .id } " )
188
186
You can’t perform that action at this time.
0 commit comments