mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-09-04 09:05:14 +03:00
feat(agent): handle AIMessageChunk content access in copilot streaming
Update agent service to properly access content from AIMessageChunk objects during chat model streaming. Instead of using dictionary get method on the chunk, now use getattr to directly access the content attribute, ensuring compatibility with the AIMessageChunk object structure.
This commit is contained in:
parent
b780bfaf53
commit
5e9aac7514
@ -171,7 +171,8 @@ class AgentService:
|
||||
if event_type == "on_chat_model_stream":
|
||||
# Streaming text content from LLM
|
||||
chunk = data.get("chunk", {})
|
||||
content = chunk.get("content", "")
|
||||
# chunk is AIMessageChunk object, access content directly
|
||||
content = getattr(chunk, "content", "")
|
||||
if content:
|
||||
return {"type": "content", "content": content}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user