docs: 为全部代码补充中文注释并加入 AGENTS 注释规范
This commit is contained in:
+12
@@ -1,3 +1,9 @@
|
||||
"""种子数据模块。
|
||||
|
||||
启动时把工作区内所有 wov-node-* 子仓库的 manifest 注册为节点,并创建演示
|
||||
“视频字幕生成”工作流,方便本地直接体验完整链路。
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
@@ -8,16 +14,21 @@ from app.db import Database
|
||||
|
||||
|
||||
def seed_nodes(db: Database, workspace_root: Path) -> None:
|
||||
"""扫描工作区中的节点仓库并注册其 manifest。"""
|
||||
for node_dir in sorted(workspace_root.glob("wov-node-*")):
|
||||
manifest_path = node_dir / "node.manifest.json"
|
||||
# 没有 manifest 的目录不是节点仓库,直接跳过。
|
||||
if not manifest_path.is_file():
|
||||
continue
|
||||
manifest = NodeManifest.load(str(manifest_path))
|
||||
# 以目录名作为 repo_dir,确保 NodeManager 能定位到子仓库。
|
||||
manifest.repo_dir = node_dir.name
|
||||
db.upsert_node(manifest)
|
||||
|
||||
|
||||
def seed_demo_workflow(db: Database) -> None:
|
||||
"""创建演示工作流:提音 -> 转写 -> 翻译 -> ASS。"""
|
||||
# 已存在同名工作流时不重复创建,保持幂等。
|
||||
if db.get_workflow("demo") is not None:
|
||||
return
|
||||
definition = WorkflowDefinition(
|
||||
@@ -69,4 +80,5 @@ def seed_demo_workflow(db: Database) -> None:
|
||||
"latest_version": 1,
|
||||
}
|
||||
)
|
||||
# 保存第一个版本的 DAG 定义,后续发布流程以版本记录为准。
|
||||
db.create_workflow_version("demo", 1, definition.to_dict())
|
||||
|
||||
Reference in New Issue
Block a user