test(03-01): add ASRInput and ASROutput schemas
- Add ASRInput schema with video_path and content_type fields - Add ASROutput schema with tool/has_subtitle/output_files/segments/text/duration_seconds/speakers - Create test_processors directory with conftest fixtures - Add comprehensive schema tests (8 test cases) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+49
-1
@@ -6,7 +6,7 @@ StepStatus、StepRecord、WorkflowState 和 StepDefinition。
|
||||
"""
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
from typing import Optional, Dict, Literal, Any
|
||||
from typing import Optional, Dict, Literal, Any, List
|
||||
from datetime import datetime
|
||||
from enum import Enum
|
||||
|
||||
@@ -185,3 +185,51 @@ class StepDefinition(BaseModel):
|
||||
input_schema: type[StepInput] = Field(..., description="输入 Schema 类型")
|
||||
output_schema: type[StepOutput] = Field(..., description="输出 Schema 类型")
|
||||
dependencies: list[str] = Field(default_factory=list, description="依赖的步骤列表")
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# ASR Schemas (Phase 3)
|
||||
# =============================================================================
|
||||
|
||||
class ASRInput(StepInput):
|
||||
"""ASR 步骤输入
|
||||
|
||||
继承 StepInput 的基础字段,添加视频路径和内容类型。
|
||||
|
||||
Attributes:
|
||||
video_path: 视频文件路径
|
||||
content_type: 内容类型,默认为 'video'
|
||||
"""
|
||||
video_path: str = Field(..., description="视频文件路径")
|
||||
content_type: str = Field(default="video", description="内容类型")
|
||||
|
||||
|
||||
class ASROutput(StepOutput):
|
||||
"""ASR 步骤输出
|
||||
|
||||
继承 StepOutput 的基础字段,添加 ASR 特定字段。
|
||||
|
||||
Attributes:
|
||||
tool: 使用的工具 (subtitle, whisper, whisper-diarization)
|
||||
has_subtitle: 是否有官方字幕
|
||||
output_files: 输出文件路径字典 {txt, srt, json}
|
||||
segments: 带时间戳的分段列表
|
||||
text: 完整文本
|
||||
duration_seconds: 音频时长
|
||||
speakers: 说话者列表(仅说话者分离时有值)
|
||||
"""
|
||||
tool: Literal["subtitle", "whisper", "whisper-diarization"] = Field(
|
||||
..., description="使用的工具"
|
||||
)
|
||||
has_subtitle: bool = Field(..., description="是否有官方字幕")
|
||||
output_files: Dict[str, str] = Field(
|
||||
default_factory=dict, description="输出文件路径 {txt, srt, json}"
|
||||
)
|
||||
segments: List[Dict[str, Any]] = Field(
|
||||
default_factory=list, description="带时间戳的分段列表"
|
||||
)
|
||||
text: str = Field(default="", description="完整文本")
|
||||
duration_seconds: float = Field(default=0.0, description="音频时长")
|
||||
speakers: Optional[List[str]] = Field(
|
||||
None, description="说话者列表(仅说话者分离时有值)"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user