Skip to content

Commit

Permalink
更新AgentRuntime的返回字段extra
Browse files Browse the repository at this point in the history
  • Loading branch information
barrierye committed Mar 7, 2024
1 parent 79c7d3f commit 07c2325
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions appbuilder/core/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,8 @@ def gen_sse_resp(stream_message):
iterator = iter(stream_message.content)
prev_result = {
"content": next(iterator),
"extra": stream_message.extra if hasattr(stream_message, "extra") else {},
"token_usage": stream_message.token_usage if hasattr(stream_message, "token_usage") else {},
"extra": getattr(stream_message, "extra", None),
"token_usage": getattr(stream_message, "token_usage", {}),
}
for sub_content in iterator:
logging.info(f"[request_id={request_id}, session_id={session_id}] streaming_result={prev_result}")
Expand All @@ -294,8 +294,8 @@ def gen_sse_resp(stream_message):
}, ensure_ascii=False) + "\n\n"
prev_result = {
"content": sub_content,
"extra": stream_message.extra if hasattr(stream_message, "extra") else {},
"token_usage": stream_message.token_usage if hasattr(stream_message, "token_usage") else {},
"extra": getattr(stream_message, "extra", None),
"token_usage": getattr(stream_message, "token_usage", {}),
}
logging.info(f"[request_id={request_id}, session_id={session_id}] streaming_result={prev_result}")
yield "data: " + json.dumps({
Expand Down

0 comments on commit 07c2325

Please sign in to comment.