mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-17 04:31:55 +00:00
fix: resolve listed messaging targets consistently
This commit is contained in:
parent
1d2e34c7eb
commit
afccbf253c
5 changed files with 105 additions and 22 deletions
|
|
@ -203,6 +203,44 @@ class TestSendMessageTool:
|
|||
media_files=[],
|
||||
)
|
||||
|
||||
def test_display_label_target_resolves_via_channel_directory(self, tmp_path):
|
||||
config, telegram_cfg = _make_config()
|
||||
cache_file = tmp_path / "channel_directory.json"
|
||||
cache_file.write_text(json.dumps({
|
||||
"updated_at": "2026-01-01T00:00:00",
|
||||
"platforms": {
|
||||
"telegram": [
|
||||
{"id": "-1001:17585", "name": "Coaching Chat / topic 17585", "type": "group"}
|
||||
]
|
||||
},
|
||||
}))
|
||||
|
||||
with patch("gateway.channel_directory.DIRECTORY_PATH", cache_file), \
|
||||
patch("gateway.config.load_gateway_config", return_value=config), \
|
||||
patch("tools.interrupt.is_interrupted", return_value=False), \
|
||||
patch("model_tools._run_async", side_effect=_run_async_immediately), \
|
||||
patch("tools.send_message_tool._send_to_platform", new=AsyncMock(return_value={"success": True})) as send_mock, \
|
||||
patch("gateway.mirror.mirror_to_session", return_value=True):
|
||||
result = json.loads(
|
||||
send_message_tool(
|
||||
{
|
||||
"action": "send",
|
||||
"target": "telegram:Coaching Chat / topic 17585 (group)",
|
||||
"message": "hello",
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
assert result["success"] is True
|
||||
send_mock.assert_awaited_once_with(
|
||||
Platform.TELEGRAM,
|
||||
telegram_cfg,
|
||||
"-1001",
|
||||
"hello",
|
||||
thread_id="17585",
|
||||
media_files=[],
|
||||
)
|
||||
|
||||
def test_media_only_message_uses_placeholder_for_mirroring(self):
|
||||
config, telegram_cfg = _make_config()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue