fix(openclaw): show full main menu for wakeup phrases
All checks were successful
CD Pipeline / deploy (push) Successful in 2m44s

This commit is contained in:
OoO
2026-05-02 16:12:30 +08:00
parent 7b6423fa67
commit 3f40089d8c
2 changed files with 17 additions and 2 deletions

View File

@@ -2442,6 +2442,21 @@ def _generate_ppt_cmd(sub_type: str, sub_arg: str, _chat_id: int, target: str,
ms = query_monthly_summary(yr, mo)
top_cats = query_category_monthly(yr, mo, lim=8)
ms['top_categories'] = top_cats
# 月對月 / 年對年 比較資料(市場專業標準必備)
prev_yr_mo = (yr if mo > 1 else yr - 1)
prev_mo_no = (mo - 1 if mo > 1 else 12)
try:
prev_mo_data = query_monthly_summary(prev_yr_mo, prev_mo_no)
except Exception:
prev_mo_data = {'found': False}
try:
prev_yr_data = query_monthly_summary(yr - 1, mo)
except Exception:
prev_yr_data = {'found': False}
ms['prev_month'] = prev_mo_data if prev_mo_data.get('found') else None
ms['prev_year'] = prev_yr_data if prev_yr_data.get('found') else None
aov = ms.get('avg_order', ms.get('revenue', 0) / ms.get('orders', 1) if ms.get('orders') else 0)
top5_products = ms.get('top_products', [])[:5]
top5_cats = top_cats[:5]
@@ -4458,7 +4473,7 @@ def openclaw_answer(question: str, chat_id: int = None):
" 「怎麼查看熱銷商品?」\n"
" 「有什麼市場情報?」"
)
return wakeup_text, quick_menu_keyboard()
return wakeup_text, main_menu_keyboard()
# ── 功能說明直接導 help ───────────────────────────────────
if _is_help_question(question):

View File

@@ -44,7 +44,7 @@ def test_openclaw_answer_wakeup_query_returns_menu():
text, kb = bot.openclaw_answer("小龍蝦")
assert "OpenClaw小O" in text
assert kb == bot.quick_menu_keyboard()
assert kb == bot.main_menu_keyboard()
def test_openclaw_answer_variants_are_menu_wakeup():