Merge pull request #2468 from NousResearch/hermes/hermes-5d6932ba

feat(discord): persistent typing indicator for DMs
This commit is contained in:
Teknium 2026-03-22 04:53:32 -07:00 committed by GitHub
commit 3037450c77
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 68 additions and 8 deletions

View file

@ -2125,7 +2125,15 @@ class GatewayRunner:
session_id=session_entry.session_id,
session_key=session_key
)
# Stop persistent typing indicator now that the agent is done
try:
_typing_adapter = self.adapters.get(source.platform)
if _typing_adapter and hasattr(_typing_adapter, "stop_typing"):
await _typing_adapter.stop_typing(source.chat_id)
except Exception:
pass
response = agent_result.get("final_response") or ""
agent_messages = agent_result.get("messages", [])
@ -2327,6 +2335,13 @@ class GatewayRunner:
return response
except Exception as e:
# Stop typing indicator on error too
try:
_err_adapter = self.adapters.get(source.platform)
if _err_adapter and hasattr(_err_adapter, "stop_typing"):
await _err_adapter.stop_typing(source.chat_id)
except Exception:
pass
logger.exception("Agent error in session %s", session_key)
error_type = type(e).__name__
error_detail = str(e)[:300] if str(e) else "no details available"