fix frontend bug

This commit is contained in:
jaehwang committed 2026-09-08 15:57:35 +09:00
1 parent a18f7a5c8b
commit 9bb46f7004
10 files changed
+83 -21

No files matched your search

+16 -3
View File
@@ -2,7 +2,7 @@
필드는 web/lib/api.ts 의 Job, web/lib/playreel.ts 의 PlayreelJob 과 맞춤
"""
from models.motion import MotionPlan
from models.pipeline_state import PlayreelState, PosterAliveState, initial_timings
from models.pipeline_state import PlayreelState, PosterAliveState, stage_keys
from pipelines.gate import build_review
from tables.task import PlayreelTask, PosterAliveTask
@@ -24,13 +24,26 @@ def motion_elements(motion_plan: dict | None) -> list[str] | None:
return [item.motion for item in MotionPlan.model_validate(motion_plan).kept]
IDLE = {"status": "idle", "started": None, "ended": None}
# 이름은 narration_text 가 포스터에서 읽어 채운다. 그 전까지 화면에 쓸 말
UNNAMED = "이름 없는 행사"
def ordered_stages(task, state_type) -> dict:
"""스테퍼가 키 순서대로 그리므로 실행 순서로 다시 세운다.
JSON 객체는 순서를 담는 자리가 아니고, 순서의 정본은 state enum이다.
"""
stored = task.stage_timings or {}
return {key: stored.get(key, IDLE) for key in stage_keys(state_type)}
def base_view(task, state_type) -> dict:
return {
"id": task.id,
"name": task.name,
"name": task.name or UNNAMED,
"status": task.status,
"stage": current_stage(task),
"stages": task.stage_timings or initial_timings(state_type),
"stages": ordered_stages(task, state_type),
"error": error_view(task),
"created_at": task.created_at.timestamp(),
"credits_used": task.credits_used,