feat(roundtable): 深链策划流程小图 + 流程图弹窗横向/缩略图/深蓝适配
- Step1 消息列表头部:深链 taskId 模式取到目的树后,左侧标题换成「策划流程」 彩色层级小图(任务→目的→…→叙事,每级配色对齐流程图节点 + 类型小图标), 点击打开任务目的流程图弹窗;仅第一步、有数据时出现。 - TaskPurposeDialog 流程图:横向(LR)布局 + 右下角缩略图(MiniMap)。 - FlowGraphPanel 深蓝主题适配(随 ThemeContext):容器/头部/画布点阵/连线/图例/ 小地图/节点详情弹窗 + 节点配色(FLOW_NODE_TYPE_META_DARK),浅色红主题不受影响。 - 圆桌侧栏深色兜底:neutral 家族 + 米色 hex(#FAF6F5/#ECE7E4/#E8D0CC) 映射到深蓝 token(关系图背板、第N步 tag 等不再泛白)。 附带提交工作区其余暂存改动(AI 写作等),不含 config.yaml。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
85cca36ddb
commit
03b6fb724c
40 files changed
+2167
-119
No files matched your search
@@ -233,6 +233,98 @@ async def save_transcript(session_id: str, body: SaveTranscriptRequest, request:
|
||||
# 会话不存在或不属于当前用户:同样不抛 500,返回 success=False 即可
|
||||
return {"success": False, "reason": "session_not_found"}
|
||||
return {"success": True}
|
||||
|
||||
|
||||
class BackgroundResponse(BaseModel):
|
||||
# 是否新拉起了后台任务(False = 已在后台跑,幂等返回)
|
||||
started: bool
|
||||
# 会话当前状态(background = 挂起中)
|
||||
status: str
|
||||
|
||||
|
||||
@router.post("/sessions/{session_id}/background", response_model=BackgroundResponse)
|
||||
async def suspend_to_background(session_id: str, request: Request):
|
||||
"""把这篇写作转入「后台挂起」:后端自动驱动剩余流程到定稿。
|
||||
|
||||
前端在用户点「后台挂起」或离开页面时调用。幂等:同一会话已在后台跑则直接返回。
|
||||
驱动逻辑见 ``app.gateway.ai_writing_job_executor``(素材/大纲自动确认、缺素材
|
||||
通用知识续写、草稿送审、审核不过自动重写直到通过或用完次数再定稿)。
|
||||
"""
|
||||
from app.gateway.deps import (
|
||||
get_ai_writing_job_executor,
|
||||
get_ai_writing_session_store,
|
||||
get_current_user,
|
||||
)
|
||||
|
||||
executor = get_ai_writing_job_executor(request)
|
||||
if executor is None:
|
||||
raise HTTPException(status_code=503, detail="Background executor not available")
|
||||
|
||||
repo = get_ai_writing_session_store(request)
|
||||
if repo is None:
|
||||
raise HTTPException(status_code=503, detail="Session store not available")
|
||||
|
||||
user_id = await get_current_user(request)
|
||||
# 鉴权 + 存在性:会话必须属于当前用户(get 已带 user_id 过滤)。
|
||||
record = await repo.get(session_id, user_id=user_id)
|
||||
if record is None:
|
||||
raise HTTPException(status_code=404, detail="Session not found")
|
||||
if record.get("status") == "done":
|
||||
# 已定稿,无需后台驱动。
|
||||
return BackgroundResponse(started=False, status="done")
|
||||
|
||||
started = executor.start(thread_id=session_id, user_id=user_id)
|
||||
return BackgroundResponse(started=started, status="background")
|
||||
|
||||
|
||||
class ProgressResponse(BaseModel):
|
||||
# 业务表 status(background = 挂起中 / done / error / in_progress)
|
||||
sessionStatus: str
|
||||
# 规范化阶段 key(intent/research/material_confirm/outline/outline_confirm/draft/draft_confirm/review/done),
|
||||
# 从 graph checkpoint 推导;None = 还没建 checkpoint。
|
||||
stage: Optional[str] = None
|
||||
# 阶段细化说明(素材不足求助 / 编辑打回)
|
||||
note: Optional[str] = None
|
||||
revisionCount: int = 0
|
||||
maxRevisions: int = 3
|
||||
reviewVerdict: Optional[str] = None
|
||||
# 后台驱动任务是否在本进程在跑(重启后可能为 False 但 status 仍 background,由 reconcile 续起)
|
||||
isRunning: bool = False
|
||||
|
||||
|
||||
@router.get("/sessions/{session_id}/progress", response_model=ProgressResponse)
|
||||
async def get_session_progress(session_id: str, request: Request):
|
||||
"""读取一篇写作的实际进度(当前阶段),供「查看进度」流程图弹窗轮询。
|
||||
|
||||
阶段从 graph checkpoint 推导,反映后端真实推进位置;鉴权要求会话属于当前用户。
|
||||
"""
|
||||
from app.gateway.deps import (
|
||||
get_ai_writing_job_executor,
|
||||
get_ai_writing_session_store,
|
||||
get_current_user,
|
||||
)
|
||||
|
||||
repo = get_ai_writing_session_store(request)
|
||||
if repo is None:
|
||||
raise HTTPException(status_code=503, detail="Session store not available")
|
||||
user_id = await get_current_user(request)
|
||||
record = await repo.get(session_id, user_id=user_id)
|
||||
if record is None:
|
||||
raise HTTPException(status_code=404, detail="Session not found")
|
||||
|
||||
executor = get_ai_writing_job_executor(request)
|
||||
progress = await executor.get_progress(session_id) if executor is not None else {}
|
||||
return ProgressResponse(
|
||||
sessionStatus=str(record.get("status") or "in_progress"),
|
||||
stage=progress.get("stage") or None,
|
||||
note=progress.get("note"),
|
||||
revisionCount=int(progress.get("revisionCount") or 0),
|
||||
maxRevisions=int(progress.get("maxRevisions") or 3),
|
||||
reviewVerdict=progress.get("reviewVerdict"),
|
||||
isRunning=bool(executor.is_running(session_id)) if executor is not None else False,
|
||||
)
|
||||
|
||||
|
||||
@router.get("/article-types", response_model=list[ArticleTypeResponse])
|
||||
async def list_article_types(request: Request):
|
||||
"""列出所有文章类型,按 sort_order 升序排列。"""
|
||||
|
||||
Reference in new issue
Block a user