mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-06-05 07:41:39 +00:00
feat(telegram): support quick-command-only menus
This commit is contained in:
parent
e80d3084e5
commit
b1acf80e17
7 changed files with 144 additions and 3 deletions
|
|
@ -26,6 +26,7 @@ from hermes_cli.commands import (
|
|||
slack_subcommand_map,
|
||||
telegram_bot_commands,
|
||||
telegram_menu_commands,
|
||||
telegram_quick_menu_commands,
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -1153,6 +1154,47 @@ class TestTelegramMenuCommands:
|
|||
# No empty string in menu names
|
||||
assert "" not in menu_names
|
||||
|
||||
def test_quick_menu_commands_include_profile_quick_commands_only(self):
|
||||
menu, hidden = telegram_quick_menu_commands(
|
||||
{
|
||||
"agent-health": {
|
||||
"type": "exec",
|
||||
"command": "echo ok",
|
||||
"description": "Show agent health",
|
||||
},
|
||||
"hidden": {
|
||||
"type": "exec",
|
||||
"command": "echo hidden",
|
||||
"description": "Hidden command",
|
||||
"show_in_telegram_menu": False,
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
assert hidden == 0
|
||||
assert menu == [("agent_health", "Show agent health")]
|
||||
|
||||
def test_quick_menu_commands_sanitize_dedupe_and_trim_descriptions(self):
|
||||
menu, hidden = telegram_quick_menu_commands(
|
||||
{
|
||||
"agent-health": {
|
||||
"description": "A" * 80,
|
||||
},
|
||||
"agent_health": {
|
||||
"description": "Duplicate after sanitization",
|
||||
},
|
||||
"+++": {
|
||||
"description": "Sanitizes to empty",
|
||||
},
|
||||
},
|
||||
max_commands=1,
|
||||
)
|
||||
|
||||
assert hidden == 0
|
||||
assert len(menu) == 1
|
||||
assert menu[0][0] == "agent_health"
|
||||
assert menu[0][1] == ("A" * 37) + "..."
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Backward-compat aliases
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue