fix(roundtable): 业务链条「本阶段目标」串行链可保存/回显 + 新增「总控提示词」
本阶段目标 bug:每步只有一个智能体(无并行)时,stageGroupsToStagePayload/ stageGroupsToStageGoals 一律折叠为 null(旧设计=线性链),导致目标保存即丢、 无从回显。改为「有并行 或 任一 stage 填了目标」就落显式分层,串行带目标链按 分层 DAG 跑(总控逐阶段按目标派活);BusinessChainPicker 同步:有并行/有目标/ 有总控提示都走 dag。 新增「总控提示词」(per-chain,仅 dag 模式生效):写给总控的整体派活指引。 后端 roundtable_chains 加 coordinator_prompt LONGTEXT 列 + migration 20260608_06; 前端编辑器加输入框,注入 buildDagStageLeaderTask 每阶段派活提示。填了总控提示 也强制显式分层(forceExplicit),否则纯线性链里被静默忽略。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
1938c80061
commit
3405795371
13 files changed
+275
-24
No files matched your search
+56
@@ -0,0 +1,56 @@
|
||||
"""Add coordinator_prompt column to roundtable_chains.
|
||||
|
||||
Per-chain「总控编排提示」: an optional free-text instruction the user writes for the
|
||||
**coordinator (总控) agent** of a business chain — telling it how to dispatch / what to
|
||||
do (overall orchestration strategy / style / constraints). Injected into the coordinator
|
||||
per-stage dispatch prompt (``buildDagStageLeaderTask``) in **dag-mode only**. NULL = no
|
||||
prompt. The column is LONGTEXT on MySQL (mirrors ``stage_goals`` headroom) and plain TEXT
|
||||
elsewhere — matching ``PortableLongText`` on ``RoundtableChainRow.coordinator_prompt``.
|
||||
``create_all`` adds the column for brand-new DBs; this revision patches DBs that already
|
||||
have the table.
|
||||
|
||||
Chained after ``20260608_05`` (parallel_agent_tasks) so the revision graph stays
|
||||
single-headed — otherwise ``alembic upgrade head`` aborts with "multiple heads" and the
|
||||
startup auto-migrate silently falls back to the create_all schema (which lacks this
|
||||
column → 500 on list).
|
||||
|
||||
Revision ID: 20260608_06
|
||||
Revises: 20260608_05
|
||||
Create Date: 2026-06-09
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
from sqlalchemy import inspect
|
||||
from sqlalchemy.dialects.mysql import LONGTEXT
|
||||
|
||||
|
||||
revision = "20260608_06"
|
||||
down_revision = "20260608_05"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def _has_table(table_name: str) -> bool:
|
||||
inspector = inspect(op.get_bind())
|
||||
return table_name in inspector.get_table_names()
|
||||
|
||||
|
||||
def _has_column(table_name: str, column_name: str) -> bool:
|
||||
if not _has_table(table_name):
|
||||
return False
|
||||
inspector = inspect(op.get_bind())
|
||||
return any(col["name"] == column_name for col in inspector.get_columns(table_name))
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
if _has_table("roundtable_chains") and not _has_column("roundtable_chains", "coordinator_prompt"):
|
||||
col_type = LONGTEXT() if op.get_bind().dialect.name == "mysql" else sa.Text()
|
||||
op.add_column("roundtable_chains", sa.Column("coordinator_prompt", col_type, nullable=True))
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
if _has_column("roundtable_chains", "coordinator_prompt"):
|
||||
op.drop_column("roundtable_chains", "coordinator_prompt")
|
||||
Reference in new issue
Block a user