From a3ab12e87c653af07df4eba55e79aba546dc634d Mon Sep 17 00:00:00 2001 From: empty Date: Wed, 7 Jan 2026 00:05:53 +0800 Subject: [PATCH] feat: Add detailed debug logging to editor functions --- api/routers/editor.py | 13 +++++++++++-- frontend/src/app/editor/page.tsx | 15 ++++++++++++++- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/api/routers/editor.py b/api/routers/editor.py index 22558cb..3f4bfb9 100644 --- a/api/routers/editor.py +++ b/api/routers/editor.py @@ -456,21 +456,30 @@ async def regenerate_frame_image( from api.dependencies import get_pixelle_video from api.routers.quality import _style_anchors + logger.debug(f"[REGEN-IMG] Starting image regeneration for frame {frame_id}") + logger.debug(f"[REGEN-IMG] Original prompt: {prompt[:100]}...") + pixelle_video = await get_pixelle_video() # Get style anchor prefix if available style_prefix = "" + logger.debug(f"[REGEN-IMG] Checking style anchors for storyboard {storyboard_id}") + logger.debug(f"[REGEN-IMG] Available style anchors: {list(_style_anchors.keys())}") + if storyboard_id in _style_anchors: style_data = _style_anchors[storyboard_id] style_prefix = style_data.get("style_prefix", "") - if style_prefix: - logger.info(f"Applying style anchor prefix: {style_prefix[:50]}...") + logger.info(f"[REGEN-IMG] Found style anchor: {style_prefix[:80] if style_prefix else 'EMPTY'}...") + else: + logger.warning(f"[REGEN-IMG] No style anchor found for {storyboard_id}") # Apply style prefix to prompt final_prompt = f"{style_prefix}, {prompt}" if style_prefix else prompt + logger.info(f"[REGEN-IMG] Final prompt: {final_prompt[:120]}...") # Use MediaService to generate image via RunningHub workflow # Use image_flux workflow by default, or get from config + logger.debug(f"[REGEN-IMG] Calling pixelle_video.image with workflow=runninghub/image_flux.json") result = await pixelle_video.image( prompt=final_prompt, media_type="image", diff --git a/frontend/src/app/editor/page.tsx b/frontend/src/app/editor/page.tsx index 3ea1468..25d0949 100644 --- a/frontend/src/app/editor/page.tsx +++ b/frontend/src/app/editor/page.tsx @@ -251,14 +251,19 @@ function SelectedFrameDetails() { const handleSave = async () => { if (!storyboard || !selectedFrame) return + console.log('[SAVE] Starting save for frame:', selectedFrame.id) + console.log('[SAVE] Narration:', narration) + console.log('[SAVE] Image Prompt:', imagePrompt?.slice(0, 50)) + setIsSaving(true) setError(null) try { - await editorApi.updateFrame(storyboard.id, selectedFrame.id, { + const result = await editorApi.updateFrame(storyboard.id, selectedFrame.id, { narration, image_prompt: imagePrompt, }) + console.log('[SAVE] API response:', result) // Update local store updateFrame(selectedFrame.id, { @@ -266,8 +271,10 @@ function SelectedFrameDetails() { imagePrompt, }) + console.log('[SAVE] Success!') setIsEditing(false) } catch (err: any) { + console.error('[SAVE] Error:', err) setError(err.message || '保存失败') } finally { setIsSaving(false) @@ -277,6 +284,9 @@ function SelectedFrameDetails() { const handleRegenerateImage = async () => { if (!storyboard || !selectedFrame) return + console.log('[REGEN-IMG] Starting regenerate image for frame:', selectedFrame.id) + console.log('[REGEN-IMG] Image prompt:', imagePrompt?.slice(0, 80)) + setIsRegeneratingImage(true) setError(null) @@ -286,12 +296,15 @@ function SelectedFrameDetails() { selectedFrame.id, imagePrompt ) + console.log('[REGEN-IMG] API response:', result) // Update local store with new image path updateFrame(selectedFrame.id, { imagePath: result.image_path, }) + console.log('[REGEN-IMG] Success! New image path:', result.image_path) } catch (err: any) { + console.error('[REGEN-IMG] Error:', err) setError(err.message || '重新生成图片失败') } finally { setIsRegeneratingImage(false)