fix: streaming event format
This commit is contained in:
parent
4a8ef7c77c
commit
04fd08d5ba
@ -362,7 +362,8 @@ async def stream_response(request):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
result = await stream_prompt(data=data)
|
result = await stream_prompt(data=data)
|
||||||
await response.write(json.dumps(result).encode('utf-8'))
|
await response.write(f"event: event_update\ndata: {json.dumps(result)}\n\n".encode('utf-8'))
|
||||||
|
# await response.write(.encode('utf-8'))
|
||||||
await response.drain() # Ensure the buffer is flushed
|
await response.drain() # Ensure the buffer is flushed
|
||||||
|
|
||||||
while pending:
|
while pending:
|
||||||
@ -372,7 +373,7 @@ async def stream_response(request):
|
|||||||
|
|
||||||
logfire.info(data["event"], data=json.dumps(data))
|
logfire.info(data["event"], data=json.dumps(data))
|
||||||
# logger.info("listener", data)
|
# logger.info("listener", data)
|
||||||
await response.write(json.dumps(data).encode('utf-8'))
|
await response.write(f"event: event_update\ndata: {json.dumps(data)}\n\n".encode('utf-8'))
|
||||||
await response.drain() # Ensure the buffer is flushed
|
await response.drain() # Ensure the buffer is flushed
|
||||||
|
|
||||||
if data["event"] == "status":
|
if data["event"] == "status":
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user