a2aproject / a2aproject/a2a-samples

stream bug

未关闭
#406 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Jupyter Notebook
星标
1.8k
派生
751
PR 合并指标
30 天内没有已合并 PR

描述

### What happened?

The server-side has already finished streaming the output, but the client-side only starts streaming output afterwards, and it prints everything out very quickly.

server code:
async for event in self.agent.stream(query):
message = TaskArtifactUpdateEvent(
context_id=context.context_id, # type: ignore
task_id=context.task_id, # type: ignore
artifact=new_text_artifact(
name='current_result',
text=event['content'],
),
)
await event_queue.enqueue_event(message)
print(event['content'])
if event['done']:
break

client_code :
request = create_text_message_object(content=user_input)

# Send the request and get the streaming messages
async for response in client.send_message(request):
task, _ = response
print(get_message_text(task.artifacts[-1]))

### Relevant log output

```shell

```

### Code of Conduct

- [x] I agree to follow this project's Code of Conduct

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。