fix: add workspace_id compatibility for removed workspace concept
This commit is contained in:
@@ -16,7 +16,7 @@ class AssetGapItem(BaseModel):
|
||||
|
||||
|
||||
class ProjectAssetDiagnosisResponse(BaseModel):
|
||||
workspace_id: str
|
||||
workspace_id: str = ""
|
||||
project_id: str
|
||||
readiness_score: int
|
||||
readiness_label: str
|
||||
|
||||
@@ -5,7 +5,7 @@ from pydantic import BaseModel, Field
|
||||
|
||||
class EditTemplateResponse(BaseModel):
|
||||
id: str
|
||||
workspace_id: str
|
||||
workspace_id: str = ""
|
||||
project_id: str
|
||||
name: str
|
||||
description: str
|
||||
@@ -28,7 +28,7 @@ class EditPlanClipResponse(BaseModel):
|
||||
|
||||
class EditPlanResponse(BaseModel):
|
||||
id: str
|
||||
workspace_id: str
|
||||
workspace_id: str = ""
|
||||
project_id: str
|
||||
template_id: str
|
||||
asset_library_id: str
|
||||
@@ -42,7 +42,7 @@ class EditPlanResponse(BaseModel):
|
||||
|
||||
|
||||
class CreateEditPlanRequest(BaseModel):
|
||||
workspace_id: str
|
||||
workspace_id: str = ""
|
||||
asset_library_id: str
|
||||
template_id: str = ""
|
||||
title_id: str = ""
|
||||
@@ -50,7 +50,7 @@ class CreateEditPlanRequest(BaseModel):
|
||||
|
||||
class AutoGenerateEditPlanRequest(BaseModel):
|
||||
"""智能生成剪辑计划请求"""
|
||||
workspace_id: str
|
||||
workspace_id: str = ""
|
||||
asset_library_id: str
|
||||
editing_mode: str = Field(
|
||||
default="one_take",
|
||||
|
||||
@@ -8,7 +8,7 @@ TitleCategory = Literal["default", "marketing", "tutorial", "story", "promo"]
|
||||
|
||||
class ProjectTitleResponse(BaseModel):
|
||||
id: str
|
||||
workspace_id: str
|
||||
workspace_id: str = ""
|
||||
project_id: str
|
||||
text: str
|
||||
category: str
|
||||
@@ -24,7 +24,7 @@ class ListProjectTitlesResponse(BaseModel):
|
||||
|
||||
|
||||
class CreateProjectTitleRequest(BaseModel):
|
||||
workspace_id: str
|
||||
workspace_id: str = ""
|
||||
text: str = Field(min_length=1, max_length=200)
|
||||
category: TitleCategory = "default"
|
||||
favorite: bool = False
|
||||
|
||||
@@ -6,7 +6,7 @@ from pydantic import BaseModel, Field
|
||||
class ProjectTaskResponse(BaseModel):
|
||||
id: str
|
||||
task_type: str
|
||||
workspace_id: str
|
||||
workspace_id: str = ""
|
||||
project_id: str
|
||||
status: str
|
||||
progress: float
|
||||
|
||||
@@ -51,6 +51,7 @@ class Project:
|
||||
owner_user_id: str
|
||||
name: str
|
||||
description: str = ""
|
||||
workspace_id: str = "" # 兼容旧代码,待移除
|
||||
shared_users: list[str] = field(default_factory=list) # 被共享的用户 ID 列表
|
||||
created_at: datetime = field(default_factory=lambda: datetime.now(timezone.utc))
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ from uuid import uuid4
|
||||
@dataclass(slots=True)
|
||||
class GeneratedVideo:
|
||||
id: str
|
||||
workspace_id: str
|
||||
workspace_id: str = ""
|
||||
project_id: str
|
||||
generation_task_id: str
|
||||
name: str
|
||||
@@ -32,7 +32,7 @@ class GeneratedVideo:
|
||||
@classmethod
|
||||
def create(
|
||||
cls,
|
||||
workspace_id: str,
|
||||
workspace_id: str = "",
|
||||
project_id: str,
|
||||
generation_task_id: str,
|
||||
name: str,
|
||||
@@ -46,9 +46,7 @@ class GeneratedVideo:
|
||||
thumbnail_url: str | None = None,
|
||||
generation_params: dict[str, Any] | None = None,
|
||||
) -> "GeneratedVideo":
|
||||
if not workspace_id.strip():
|
||||
raise ValueError("workspace_id cannot be empty")
|
||||
if not project_id.strip():
|
||||
if not project_id.strip():
|
||||
raise ValueError("project_id cannot be empty")
|
||||
if not generation_task_id.strip():
|
||||
raise ValueError("generation_task_id cannot be empty")
|
||||
|
||||
@@ -17,7 +17,7 @@ class GenerationTaskStatus(StrEnum):
|
||||
@dataclass(slots=True)
|
||||
class GenerationTask:
|
||||
id: str
|
||||
workspace_id: str
|
||||
workspace_id: str = ""
|
||||
project_id: str
|
||||
asset_library_id: str
|
||||
strategy_id: str = ""
|
||||
@@ -35,7 +35,7 @@ class GenerationTask:
|
||||
@classmethod
|
||||
def create(
|
||||
cls,
|
||||
workspace_id: str,
|
||||
workspace_id: str = "",
|
||||
project_id: str,
|
||||
asset_library_id: str,
|
||||
*,
|
||||
@@ -44,9 +44,7 @@ class GenerationTask:
|
||||
edit_plan_id: str = "",
|
||||
created_by_user_id: str = "",
|
||||
) -> "GenerationTask":
|
||||
if not workspace_id.strip():
|
||||
raise ValueError("workspace_id 不能为空")
|
||||
if not project_id.strip():
|
||||
if not project_id.strip():
|
||||
raise ValueError("project_id 不能为空")
|
||||
if not asset_library_id.strip():
|
||||
raise ValueError("asset_library_id 不能为空")
|
||||
|
||||
Reference in New Issue
Block a user