Files
beige/backend/alembic/versions/018_fission_notes_table.py
yangqianqian d85dcd401b 第11环裂变重写:对齐上线版 split.js 一次LLM出N套完整笔记包
架构从"扇出N个GenerationTask各跑完整管道"改为"一次LLM调用直接出N套
完整笔记包(N=1~5)",落 FissionNote 表 + 独立展示页。

后端:
- 018迁移:fission_notes 表(文案JSON+score+passed+imagePlan+images+status)
- fission_prompt:FISSION_SYSTEM+三档参考度(low/mid/high)+normalize_tags+品类兜底
- fission_pipeline:一次LLM出N套→各评分(@80合格线)→排序→落库,不达标标
  needs_optimization 非丢弃;apiports 503 回落 codeproxy gpt-5.5 强档兜底
- fission_images:每套串行调现有生图接口(零改动image_gen/storyboard)
- tasks.py:run_fission_pipeline Celery task,删旧扇出注入
- api/v1/fission:进度聚合FissionNote + GET /fission/{id}/notes(剥内部字段)

前端:FissionProgress对齐状态机 + N套独立展示页 + FissionNoteCard

测试:test_fission_engine(19)+test_fission_pipeline(5) 全过;104 全量回归绿

实测task5(fanout=2,mid)端到端跑通:一次出2套→seq0=85过/seq1=79标优化→
生图codeproxy/edits→1024×1536去AI化→task completed→notes端点返完整数据

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-18 11:17:37 +08:00

58 lines
2.3 KiB
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.
"""create fission_notes table
Revision ID: 018
Revises: 017
Create Date: 2026-06-18
裂变重写(对齐上线版 split.js一次LLM出N套完整笔记包每套落一行。
每套含 标题/正文/标签/封面/imagePlan/裂变维度,带评分+生图结果。
"""
from alembic import op
import sqlalchemy as sa
revision = "018"
down_revision = "017"
branch_labels = None
depends_on = None
def upgrade():
op.create_table(
"fission_notes",
sa.Column("id", sa.BigInteger, primary_key=True, autoincrement=True),
sa.Column(
"fission_id", sa.BigInteger,
sa.ForeignKey("fission_tasks.id", ondelete="CASCADE"),
nullable=False,
),
sa.Column(
"workspace_id", sa.BigInteger,
sa.ForeignKey("workspaces.id", ondelete="CASCADE"),
nullable=False, comment="多租户隔离",
),
sa.Column("seq", sa.Integer, nullable=False, server_default="0",
comment="第几套0起"),
sa.Column("note_json", sa.Text, nullable=True, comment="完整笔记包JSON"),
sa.Column("images_json", sa.Text, nullable=True, comment="生图结果JSON"),
sa.Column("score", sa.Integer, nullable=False, server_default="0"),
sa.Column("passed", sa.Integer, nullable=False, server_default="0",
comment="是否过线(>=80)"),
sa.Column("needs_optimization", sa.Integer, nullable=False,
server_default="0", comment="不达标降级草稿标记"),
sa.Column("dimension", sa.String(64), nullable=True,
comment="裂变维度: 换角度/换痛点/换人群"),
sa.Column("status", sa.String(20), nullable=False,
server_default="pending",
comment="状态: pending/scored/image_done/failed"),
sa.Column("created_at", sa.DateTime, server_default=sa.func.now(),
nullable=False),
)
op.create_index("idx_fission_notes_fission_id", "fission_notes", ["fission_id"])
op.create_index("idx_fission_notes_workspace_id", "fission_notes", ["workspace_id"])
def downgrade():
op.drop_index("idx_fission_notes_workspace_id", table_name="fission_notes")
op.drop_index("idx_fission_notes_fission_id", table_name="fission_notes")
op.drop_table("fission_notes")