Commit_remaining_local_changes_after_PR_407_merge
This commit is contained in:
@@ -18,6 +18,7 @@ from services.database import get_session_for_user
|
||||
from middleware.auth_middleware import get_current_user, get_current_user_with_query_token
|
||||
from api.story_writer.utils.auth import require_authenticated_user
|
||||
from services.wavespeed.infinitetalk import animate_scene_with_voiceover
|
||||
from utils.error_normalization import extract_error_metadata
|
||||
from services.podcast.video_combination_service import PodcastVideoCombinationService
|
||||
from services.llm_providers.main_video_generation import track_video_usage
|
||||
from services.subscription import PricingService
|
||||
@@ -92,27 +93,6 @@ def _extract_error_message(exc: Exception) -> str:
|
||||
return error_str
|
||||
|
||||
|
||||
def _extract_error_metadata(exc: Exception) -> Dict[str, Any]:
|
||||
"""Extract structured error metadata for task polling clients."""
|
||||
if isinstance(exc, HTTPException):
|
||||
detail = exc.detail
|
||||
if isinstance(detail, dict):
|
||||
return {
|
||||
"error_status": exc.status_code,
|
||||
"error_data": detail,
|
||||
}
|
||||
if isinstance(detail, str):
|
||||
return {
|
||||
"error_status": exc.status_code,
|
||||
"error_data": {
|
||||
"error": detail,
|
||||
"message": detail,
|
||||
},
|
||||
}
|
||||
|
||||
return {}
|
||||
|
||||
|
||||
def _execute_podcast_video_task(
|
||||
task_id: str,
|
||||
request: PodcastVideoGenerationRequest,
|
||||
@@ -256,7 +236,7 @@ def _execute_podcast_video_task(
|
||||
|
||||
# Extract user-friendly error message from exception
|
||||
error_msg = _extract_error_message(exc)
|
||||
error_meta = _extract_error_metadata(exc)
|
||||
error_meta = extract_error_metadata(exc)
|
||||
|
||||
task_manager.update_task_status(
|
||||
task_id,
|
||||
|
||||
@@ -11,6 +11,7 @@ from loguru import logger
|
||||
from services.database import get_engine_for_user
|
||||
from sqlalchemy.orm import sessionmaker
|
||||
from utils.asset_tracker import save_asset_to_library
|
||||
from utils.error_normalization import extract_error_metadata
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
@@ -19,25 +20,6 @@ UPLOAD_DIR = Path("backend/data/video_studio/uploads")
|
||||
UPLOAD_DIR.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
|
||||
def _extract_error_metadata(exc: Exception) -> Dict[str, Any]:
|
||||
"""Extract structured HTTP error metadata for polling clients."""
|
||||
if isinstance(exc, HTTPException):
|
||||
detail = exc.detail
|
||||
if isinstance(detail, dict):
|
||||
return {
|
||||
"error_status": exc.status_code,
|
||||
"error_data": detail,
|
||||
}
|
||||
if isinstance(detail, str):
|
||||
return {
|
||||
"error_status": exc.status_code,
|
||||
"error_data": {
|
||||
"error": detail,
|
||||
"message": detail,
|
||||
},
|
||||
}
|
||||
return {}
|
||||
|
||||
def _process_avatar_generation(task_id: str, image_path: Path, audio_path: Path, user_id: str, resolution: str, model: str):
|
||||
"""
|
||||
Background task to process avatar generation using shared InfiniteTalk service.
|
||||
@@ -114,7 +96,7 @@ def _process_avatar_generation(task_id: str, image_path: Path, audio_path: Path,
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"[VideoStudio] Avatar generation failed for task {task_id}: {e}", exc_info=True)
|
||||
error_meta = _extract_error_metadata(e)
|
||||
error_meta = extract_error_metadata(e)
|
||||
task_manager.update_task(
|
||||
task_id,
|
||||
"failed",
|
||||
|
||||
Reference in New Issue
Block a user