From 6a55c0d140afa29538d7360335ab78cfbe8f8d38 Mon Sep 17 00:00:00 2001 From: Benature Date: Sun, 22 Nov 2026 01:39:24 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=97=A5=E6=8A=A5=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=91=A8=E5=87=A0/=E4=BA=A4=E6=98=93=E6=97=A5/=E5=B7=A5?= =?UTF-8?q?=E4=BD=9C=E6=94=BE=E5=81=87=E4=BF=A1=E6=81=AF=EF=BC=8C=E6=9C=88?= =?UTF-8?q?=E8=AE=B0=E6=94=B9=E7=94=A8=E5=91=A8=E6=8A=A5=E5=92=8C=E4=B8=8A?= =?UTF-8?q?=E6=9C=88=E6=9C=88=E6=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - snooper_summary.py: 新增 _day_context(),日报标题包含周几、工作日/节假日、交易日/非交易日 - snooper_monthly.py: 月记改用周报和上月月报,不再读日报 - MONTHLY_EXTRACT_PROMPT: 输入从日报片段改为周记片段 - MONTHLY_FINAL_PROMPT: 对照上月月记,结构调整为上月工作延续 - generate_monthly: 移除日报读取,添加读取上月月报逻辑 - VERSION: 更新到 0.2.0 - 2024-07 至 2024-10 日报、周记、月记已全部生成 --- VERSION | 2 +- snooper_summary.py | 26 ++++++++++++++++++++++++-- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/VERSION b/VERSION index d917d3e..0ea3a94 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.1.2 +0.2.0 diff --git a/snooper_summary.py b/snooper_summary.py index 985a4e6..5c47505 100644 --- a/snooper_summary.py +++ b/snooper_summary.py @@ -1028,6 +1028,19 @@ def repair_private_table_sources(content: str, private_chats) -> str: return "".join(lines) +def _day_context(target_day: date) -> str: + """Return weekday, trading-day, and work/holiday context for the target day.""" + import chinese_calendar + + weekdays = ["周一", "周二", "周三", "周四", "周五", "周六", "周日"] + weekday = weekdays[target_day.weekday()] + is_workday = chinese_calendar.is_workday(target_day) + is_trading_day = target_day.weekday() < 5 and is_workday + work_type = "工作日" if is_workday else "节假日" + trading_type = "交易日" if is_trading_day else "非交易日" + return f"{weekday},{work_type},{trading_type}" + + def summarize_messages( client: MagpieClient, rows: list[Any], @@ -1051,8 +1064,9 @@ def summarize_messages( if getattr(row, "msg_type", None) != 6 and getattr(row, "msg_type_name", None) != "SYSTEM" ] + day_context = _day_context(target_day) if not rows and not calendar_events: - return f"# {target_day.isoformat()} 工作总结\n\n本日未收到消息。\n" + return f"# {target_day.isoformat()} 工作总结({day_context})\n\n本日未收到消息。\n" messages = [serialize_message(row, tz) for row in rows] groups: dict[str, list[dict[str, Any]]] = {} for message in messages: @@ -1261,9 +1275,17 @@ def summarize_messages( content = drop_empty_meeting_section( content, bool(calendar_events), calendar_error ) - return sanitize_wikilink_pipes( + content = sanitize_wikilink_pipes( drop_casual_content(format_followup_checkboxes(shorten_headings(content))) ) + # Prepend day context to the title + if content.startswith("# "): + content = content.replace( + f"# {target_day.isoformat()}", + f"# {target_day.isoformat()}({day_context})", + 1, + ) + return content def normalize_heading_breaks(content: str) -> str: