market-assistant/backend/pipeline/reporting/marketing_pack_persist.py
hub-gif 6470d0d56c feat(marketing): 营销内容命名、文生图/视频提示词与结果规范化
两步 LLM 增加可复制文生图/文生视频提示词并强化卖点可视化;normalize_detail_page_pack 补全键;产品用语由商详包改为营销内容;前端导出 Markdown 与策略预览区展示一致;营销包落盘模块入库。

Made-with: Cursor
2026-04-22 15:35:35 +08:00

24 lines
852 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""营销内容包等产物落盘(任务 run_dir便于归档与审计"""
from __future__ import annotations
import json
from pathlib import Path
from typing import Any
def persist_marketing_detail_pack_v1(run_dir: str | None, payload: dict[str, Any]) -> Path | None:
"""
写入 ``{run_dir}/marketing/marketing_detail_pack_v1.json``。
``payload`` 建议与 API 响应体一致(含 schema_version、job_id、core_info_card 等)。
"""
if not run_dir or not str(run_dir).strip():
return None
root = Path(run_dir)
if not root.is_dir():
return None
out_dir = root / "marketing"
out_dir.mkdir(parents=True, exist_ok=True)
path = out_dir / "marketing_detail_pack_v1.json"
path.write_text(json.dumps(payload, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")
return path