mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-31 19:16:29 +00:00
fix(gateway): guard chained .get() against None intermediate values
.get("key", {}) only applies the default when the key is ABSENT.
When the key exists with value None (null in JSON), .get() returns
None and the subsequent .get() raises AttributeError.
Fix: replace .get("key", {}).get(...) with (.get("key") or {}).get(...)
which handles both missing keys AND None values.
8 instances across 6 files:
- gateway/run.py: tool_call function name check
- acp_adapter/server.py: tool name/description extraction
- gateway/platforms/qqbot/onboard.py: API response task_id
- gateway/platforms/yuanbao.py: message content parsing (x2)
- gateway/platforms/slack.py: block text extraction (x2)
- tui_gateway/server.py: error message extraction
This commit is contained in:
parent
241bc112e8
commit
c5b62fdbae
6 changed files with 10 additions and 10 deletions
|
|
@ -6683,7 +6683,7 @@ class SlackAdapter(BasePlatformAdapter):
|
|||
original_text = ""
|
||||
for block in message.get("blocks", []):
|
||||
if block.get("type") == "section":
|
||||
original_text = block.get("text", {}).get("text", "")
|
||||
original_text = (block.get("text") or {}).get("text", "")
|
||||
break
|
||||
|
||||
# Slack re-escapes HTML entities in the interaction payload
|
||||
|
|
@ -6862,7 +6862,7 @@ class SlackAdapter(BasePlatformAdapter):
|
|||
original_text = ""
|
||||
for block in message.get("blocks", []):
|
||||
if block.get("type") == "section":
|
||||
original_text = block.get("text", {}).get("text", "")
|
||||
original_text = (block.get("text") or {}).get("text", "")
|
||||
break
|
||||
|
||||
# Slack re-escapes HTML entities in the interaction payload
|
||||
|
|
@ -6964,7 +6964,7 @@ class SlackAdapter(BasePlatformAdapter):
|
|||
original_text = ""
|
||||
for block in message.get("blocks", []):
|
||||
if block.get("type") == "section":
|
||||
original_text = block.get("text", {}).get("text", "")
|
||||
original_text = (block.get("text") or {}).get("text", "")
|
||||
break
|
||||
|
||||
from tools import clarify_gateway as _clarify_mod
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue