Files
my-v0-server/app/schemas/node_progress.py
T

21 lines
847 B
Python

"""节点进度事件"""
from typing import Literal
from pydantic import BaseModel, Field
NodeProgressStatus = Literal[
"started", "completed", "waiting_for_input", "failed", "cancelled"
]
class NodeProgress(BaseModel):
type: Literal["node_progress"] = "node_progress" # 用于区分流中的事件类型
thread_id: str | None = None # 任务 ID,独立运行节点时可以为空
message_id: str | None = None # 当前用户输入 ID
execution_id: str # 单次节点执行 ID,开始和结束共用
node: str # 稳定的技术标识,供程序处理和排查
label: str | None = None # 用户进度提示,缺省时不展示该节点
status: NodeProgressStatus # 节点执行状态,不代表任务总体状态
duration_ms: float | None = Field(default=None, ge=0) # 结束时的执行耗时