mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-18 04:41:56 +00:00
fix(gateway): enqueue SSE EOS sentinel on task completion
This commit is contained in:
parent
4fa5f7b765
commit
4bb0a82a2b
2 changed files with 102 additions and 1 deletions
|
|
@ -1168,6 +1168,9 @@ class APIServerAdapter(BasePlatformAdapter):
|
|||
agent_ref=agent_ref,
|
||||
gateway_session_key=gateway_session_key,
|
||||
))
|
||||
# Ensure SSE drain loops can terminate without relying on polling
|
||||
# agent_task.done(), which can race with queue timeout checks.
|
||||
agent_task.add_done_callback(lambda _fut: _stream_q.put(None))
|
||||
|
||||
return await self._write_sse_chat_completion(
|
||||
request, completion_id, model_name, created, _stream_q,
|
||||
|
|
@ -2197,6 +2200,9 @@ class APIServerAdapter(BasePlatformAdapter):
|
|||
agent_ref=agent_ref,
|
||||
gateway_session_key=gateway_session_key,
|
||||
))
|
||||
# Ensure SSE drain loops can terminate without relying on polling
|
||||
# agent_task.done(), which can race with queue timeout checks.
|
||||
agent_task.add_done_callback(lambda _fut: _stream_q.put(None))
|
||||
|
||||
response_id = f"resp_{uuid.uuid4().hex[:28]}"
|
||||
model_name = body.get("model", self._model_name)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue