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: