chore: sync code and project files

This commit is contained in:
Tony Zhang
2026-01-09 14:09:16 +08:00
parent 3d1fb37769
commit 30d7eb4b35
94 changed files with 12706 additions and 255 deletions

View File

@@ -19,6 +19,7 @@ from typing import Optional, Tuple
LEGACY_HOST_TEMP_PREFIX = "/root/video-flow/temp/"
LEGACY_HOST_OUTPUT_PREFIX = "/root/video-flow/output/"
LEGACY_HOST_PREFIX = "/root/video-flow/"
# Container mount points (see docker-compose.yml)
LEGACY_CONTAINER_TEMP_DIR = "/legacy/temp"
@@ -42,18 +43,27 @@ def map_legacy_local_path(local_path: Optional[str]) -> Tuple[Optional[str], Opt
if os.path.exists(local_path):
return local_path, None
# Legacy host -> container mapping by basename
# Legacy host path -> current container workspace path (same repo but different prefix)
# Example:
# /root/video-flow/temp/projects/... -> /app/temp/projects/...
# This covers cases where we don't mount /legacy/* but the files were copied into current stack.
if local_path.startswith(LEGACY_HOST_PREFIX):
rest = local_path[len(LEGACY_HOST_PREFIX):].lstrip("/")
candidate = str(Path("/app") / rest)
if os.path.exists(candidate):
return candidate, None
# Legacy host -> container mapping (preserve relative path)
if local_path.startswith(LEGACY_HOST_TEMP_PREFIX):
name = Path(local_path).name
container_path = str(Path(LEGACY_CONTAINER_TEMP_DIR) / name)
url = f"{LEGACY_STATIC_TEMP_PREFIX}{name}"
return container_path, url
rel = local_path[len(LEGACY_HOST_TEMP_PREFIX):].lstrip("/")
container_path = str(Path(LEGACY_CONTAINER_TEMP_DIR) / rel)
# 静态路由通常只覆盖目录根(不包含子目录);这里交给 /api/assets/file 做 FileResponse 更稳
return container_path, None
if local_path.startswith(LEGACY_HOST_OUTPUT_PREFIX):
name = Path(local_path).name
container_path = str(Path(LEGACY_CONTAINER_OUTPUT_DIR) / name)
url = f"{LEGACY_STATIC_OUTPUT_PREFIX}{name}"
return container_path, url
rel = local_path[len(LEGACY_HOST_OUTPUT_PREFIX):].lstrip("/")
container_path = str(Path(LEGACY_CONTAINER_OUTPUT_DIR) / rel)
return container_path, None
# Unknown path: keep as-is
return local_path, None
@@ -64,3 +74,9 @@ def map_legacy_local_path(local_path: Optional[str]) -> Tuple[Optional[str], Opt