feat: 按自然月回补日报周报和月报

This commit is contained in:
Benature
2026-11-22 20:52:23 +08:00
parent 8f6831c3e8
commit 71fa22d1ba
8 changed files with 204 additions and 42 deletions

View File

@ -441,6 +441,8 @@ def cmd_summarize(args):
missing_background_tags.append("no_previous_day_log")
if previous_weekly_missing:
missing_background_tags.append("no_previous_weekly")
if previous_monthly_missing:
missing_background_tags.append("no_previous_monthly")
if missing_background_tags:
properties["tags"] = missing_background_tags
content = add_obsidian_properties(content, properties)
@ -497,6 +499,31 @@ def cmd_weekly(args):
return 1
def cmd_monthly(args):
from snooper_monthly import MonthlyError, generate_monthly
from snooper_summary import SummaryError
try:
generate_monthly(
month=args.month,
model=args.model or os.environ.get("MAGPIE_MODEL", "EFundGPT-dsv4-pro"),
base_url=args.base_url
or os.environ.get("MAGPIE_BASE_URL", "http://127.0.0.1:3425/v1"),
api_key=os.environ.get("MAGPIE_API_KEY"),
timeout=args.timeout,
config_path=args.config,
output=args.output,
overwrite=args.overwrite,
)
return 0
except (MonthlyError, SummaryError) as error:
print(f"月记生成失败: {error}", file=sys.stderr)
return 1
except OSError as error:
print(f"月记写入失败: {type(error).__name__}", file=sys.stderr)
return 1
def main():
parser = argparse.ArgumentParser(
prog="lark_snooper.py", description="LarkAgentX 历史同步与 EFundGPT 日度总结"
@ -513,6 +540,16 @@ def main():
weekly.add_argument("--overwrite", action="store_true", help="覆盖已有周记")
weekly.set_defaults(fn=cmd_weekly)
monthly = subparsers.add_parser("monthly", help="根据周记生成月记并读取上月月记")
monthly.add_argument("--month", required=True, help="月份 YYYY-MM")
monthly.add_argument("--model", help="实际模型段必须以 EFundGPT 开头")
monthly.add_argument("--base-url", help="Magpie OpenAI 兼容地址")
monthly.add_argument("--timeout", type=int, default=600)
monthly.add_argument("--config", help="YAML 配置路径;默认读取当前目录 config.yaml")
monthly.add_argument("-o", "--output", help="覆盖月记输出路径")
monthly.add_argument("--overwrite", action="store_true", help="覆盖已有月记")
monthly.set_defaults(fn=cmd_monthly)
web = subparsers.add_parser("web", help="打开本机会话搜索与忽略列表管理页")
web.add_argument("--port", type=int, default=8765, help="本机监听端口,默认 8765")
web.add_argument("--config", default="config.yaml", help="要维护的 YAML 配置路径")