diff --git a/routes/openclaw_bot_routes.py b/routes/openclaw_bot_routes.py index 71458aed6..54bb68d1e 100644 --- a/routes/openclaw_bot_routes.py +++ b/routes/openclaw_bot_routes.py @@ -3169,6 +3169,8 @@ def sales_quick_kb(date_str): return [ [{'text': '⬅️ 昨日業績', 'callback_data': f'cmd:sales:{yesterday}'}, {'text': '🏆 熱銷商品', 'callback_data': f'cmd:top:{date_str}'}], + [{'text': '📊 產出日報 PPT', 'callback_data': f'cmd:ppt:daily {date_str}'}, + {'text': '📄 策略簡報', 'callback_data': f'cmd:ppt:strategy {date_str}'}], [{'text': '📋 完整報表', 'callback_data': f'cmd:report:{date_str}'}], ] except Exception: @@ -4311,7 +4313,13 @@ def handle_cmd(cmd, arg, chat_id, reply_to): if days_count <= 35: # 週/月:逐日文字 + 折線圖 - send_message(chat_id, fmt_trend(data, period_label), reply_to, _submenu_trend()) + _trend_kb_short = [ + [{'text': '📊 產出趨勢簡報', 'callback_data': f'cmd:ppt:strategy {start_str}'}, + {'text': '📅 產出日報 PPT', 'callback_data': f'cmd:ppt:daily {end_str}'}], + [{'text': '🔄 加載新趨勢', 'callback_data': f'cmd:trend:{sub}'}, + {'text': '← 返回業績查詢', 'callback_data': 'menu:sales'}], + ] + send_message(chat_id, fmt_trend(data, period_label), reply_to, _trend_kb_short) try: png = gen_trend_chart(data_points=data, title=chart_title) if png: @@ -4323,7 +4331,21 @@ def handle_cmd(cmd, arg, chat_id, reply_to): else: # 季/半年/年:摘要 + 聚合柱狀圖(不洗版面) granularity = 'monthly' if days_count > 100 else 'weekly' - send_message(chat_id, fmt_trend_summary(data, period_label), reply_to, _submenu_trend()) + # 決定働用 strategy 簡報的期間標籤 + if sub in ('quarter', 'quarterly', '季'): + ppt_sub = 'quarterly' + elif sub in ('half', '半年'): + ppt_sub = 'half' + elif sub in ('year', 'yearly', '年'): + ppt_sub = 'yearly' + else: + ppt_sub = 'weekly' + _trend_kb_long = [ + [{'text': '📊 產出趨勢簡報', 'callback_data': f'cmd:ppt:strategy {ppt_sub}'}, + {'text': '📅 月報 PPT', 'callback_data': f'cmd:ppt:monthly {start_str[:7].replace("/","/")}'}], + [{'text': '← 返回業績查詢', 'callback_data': 'menu:sales'}], + ] + send_message(chat_id, fmt_trend_summary(data, period_label), reply_to, _trend_kb_long) try: png = gen_aggregated_chart(data, chart_title, granularity=granularity) if png: