feat: Add detailed debug logging to editor functions
This commit is contained in:
@@ -456,21 +456,30 @@ async def regenerate_frame_image(
|
|||||||
from api.dependencies import get_pixelle_video
|
from api.dependencies import get_pixelle_video
|
||||||
from api.routers.quality import _style_anchors
|
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()
|
pixelle_video = await get_pixelle_video()
|
||||||
|
|
||||||
# Get style anchor prefix if available
|
# Get style anchor prefix if available
|
||||||
style_prefix = ""
|
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:
|
if storyboard_id in _style_anchors:
|
||||||
style_data = _style_anchors[storyboard_id]
|
style_data = _style_anchors[storyboard_id]
|
||||||
style_prefix = style_data.get("style_prefix", "")
|
style_prefix = style_data.get("style_prefix", "")
|
||||||
if style_prefix:
|
logger.info(f"[REGEN-IMG] Found style anchor: {style_prefix[:80] if style_prefix else 'EMPTY'}...")
|
||||||
logger.info(f"Applying style anchor prefix: {style_prefix[:50]}...")
|
else:
|
||||||
|
logger.warning(f"[REGEN-IMG] No style anchor found for {storyboard_id}")
|
||||||
|
|
||||||
# Apply style prefix to prompt
|
# Apply style prefix to prompt
|
||||||
final_prompt = f"{style_prefix}, {prompt}" if style_prefix else 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 MediaService to generate image via RunningHub workflow
|
||||||
# Use image_flux workflow by default, or get from config
|
# 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(
|
result = await pixelle_video.image(
|
||||||
prompt=final_prompt,
|
prompt=final_prompt,
|
||||||
media_type="image",
|
media_type="image",
|
||||||
|
|||||||
@@ -251,14 +251,19 @@ function SelectedFrameDetails() {
|
|||||||
const handleSave = async () => {
|
const handleSave = async () => {
|
||||||
if (!storyboard || !selectedFrame) return
|
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)
|
setIsSaving(true)
|
||||||
setError(null)
|
setError(null)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await editorApi.updateFrame(storyboard.id, selectedFrame.id, {
|
const result = await editorApi.updateFrame(storyboard.id, selectedFrame.id, {
|
||||||
narration,
|
narration,
|
||||||
image_prompt: imagePrompt,
|
image_prompt: imagePrompt,
|
||||||
})
|
})
|
||||||
|
console.log('[SAVE] API response:', result)
|
||||||
|
|
||||||
// Update local store
|
// Update local store
|
||||||
updateFrame(selectedFrame.id, {
|
updateFrame(selectedFrame.id, {
|
||||||
@@ -266,8 +271,10 @@ function SelectedFrameDetails() {
|
|||||||
imagePrompt,
|
imagePrompt,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
console.log('[SAVE] Success!')
|
||||||
setIsEditing(false)
|
setIsEditing(false)
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
|
console.error('[SAVE] Error:', err)
|
||||||
setError(err.message || '保存失败')
|
setError(err.message || '保存失败')
|
||||||
} finally {
|
} finally {
|
||||||
setIsSaving(false)
|
setIsSaving(false)
|
||||||
@@ -277,6 +284,9 @@ function SelectedFrameDetails() {
|
|||||||
const handleRegenerateImage = async () => {
|
const handleRegenerateImage = async () => {
|
||||||
if (!storyboard || !selectedFrame) return
|
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)
|
setIsRegeneratingImage(true)
|
||||||
setError(null)
|
setError(null)
|
||||||
|
|
||||||
@@ -286,12 +296,15 @@ function SelectedFrameDetails() {
|
|||||||
selectedFrame.id,
|
selectedFrame.id,
|
||||||
imagePrompt
|
imagePrompt
|
||||||
)
|
)
|
||||||
|
console.log('[REGEN-IMG] API response:', result)
|
||||||
|
|
||||||
// Update local store with new image path
|
// Update local store with new image path
|
||||||
updateFrame(selectedFrame.id, {
|
updateFrame(selectedFrame.id, {
|
||||||
imagePath: result.image_path,
|
imagePath: result.image_path,
|
||||||
})
|
})
|
||||||
|
console.log('[REGEN-IMG] Success! New image path:', result.image_path)
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
|
console.error('[REGEN-IMG] Error:', err)
|
||||||
setError(err.message || '重新生成图片失败')
|
setError(err.message || '重新生成图片失败')
|
||||||
} finally {
|
} finally {
|
||||||
setIsRegeneratingImage(false)
|
setIsRegeneratingImage(false)
|
||||||
|
|||||||
Reference in New Issue
Block a user