mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-23 20:21:03 +02:00
Fix agent non-streaming messaging
This commit is contained in:
parent
69f10e50b3
commit
f49b770c75
2 changed files with 14 additions and 4 deletions
|
|
@ -93,6 +93,8 @@ class AgentService(FlowProcessor):
|
|||
thought = None,
|
||||
observation = None,
|
||||
answer = None,
|
||||
end_of_message = True,
|
||||
end_of_dialog = True,
|
||||
),
|
||||
properties={"id": id}
|
||||
)
|
||||
|
|
|
|||
|
|
@ -232,12 +232,14 @@ class Processor(AgentService):
|
|||
observation=None,
|
||||
)
|
||||
else:
|
||||
# Legacy format
|
||||
# Non-streaming format
|
||||
r = AgentResponse(
|
||||
answer=None,
|
||||
error=None,
|
||||
thought=x,
|
||||
observation=None,
|
||||
end_of_message=True,
|
||||
end_of_dialog=False,
|
||||
)
|
||||
|
||||
await respond(r)
|
||||
|
|
@ -260,12 +262,14 @@ class Processor(AgentService):
|
|||
observation=x,
|
||||
)
|
||||
else:
|
||||
# Legacy format
|
||||
# Non-streaming format
|
||||
r = AgentResponse(
|
||||
answer=None,
|
||||
error=None,
|
||||
thought=None,
|
||||
observation=x,
|
||||
end_of_message=True,
|
||||
end_of_dialog=False,
|
||||
)
|
||||
|
||||
await respond(r)
|
||||
|
|
@ -288,12 +292,14 @@ class Processor(AgentService):
|
|||
observation=None,
|
||||
)
|
||||
else:
|
||||
# Legacy format - shouldn't be called in non-streaming mode
|
||||
# Non-streaming format - shouldn't normally be called
|
||||
r = AgentResponse(
|
||||
answer=x,
|
||||
error=None,
|
||||
thought=None,
|
||||
observation=None,
|
||||
end_of_message=True,
|
||||
end_of_dialog=False,
|
||||
)
|
||||
|
||||
await respond(r)
|
||||
|
|
@ -364,11 +370,13 @@ class Processor(AgentService):
|
|||
thought=None,
|
||||
)
|
||||
else:
|
||||
# Legacy format - send complete answer
|
||||
# Non-streaming format - send complete answer
|
||||
r = AgentResponse(
|
||||
answer=act.final,
|
||||
error=None,
|
||||
thought=None,
|
||||
end_of_message=True,
|
||||
end_of_dialog=True,
|
||||
)
|
||||
|
||||
await respond(r)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue