feat: Add detailed debug logging to editor functions
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user