diff --git a/src/services/tauri.ts b/src/services/tauri.ts index f34ab2d..12b1131 100644 --- a/src/services/tauri.ts +++ b/src/services/tauri.ts @@ -420,10 +420,35 @@ export class AIVideoService { */ static async batchGenerateVideos(request: BatchAIVideoRequest): Promise { try { + console.log('Sending batch AI video request:', request) const result = await invoke('batch_generate_ai_videos', { request }) - return JSON.parse(result as string) + console.log('Raw batch result from Tauri:', result) + + const parsedResult = JSON.parse(result as string) + console.log('Parsed batch result:', parsedResult) + + // Handle JSON-RPC response format + if (parsedResult.jsonrpc === "2.0") { + if (parsedResult.result) { + // Success response + console.log('JSON-RPC batch success result:', parsedResult.result) + return parsedResult.result + } else if (parsedResult.error) { + // Error response + console.error('JSON-RPC batch error:', parsedResult.error) + throw new Error(parsedResult.error.message || 'JSON-RPC batch error') + } + } + + // Fallback: direct result format + return parsedResult } catch (error) { console.error('Failed to batch generate AI videos:', error) + console.error('Batch error details:', { + name: error instanceof Error ? error.name : 'Unknown', + message: error instanceof Error ? error.message : String(error), + stack: error instanceof Error ? error.stack : undefined + }) throw error } } diff --git a/src/stores/useAIVideoStore.ts b/src/stores/useAIVideoStore.ts index 89dc50f..1b36b34 100644 --- a/src/stores/useAIVideoStore.ts +++ b/src/stores/useAIVideoStore.ts @@ -173,9 +173,13 @@ export const useAIVideoStore = create((set, get) => ({ updateJob(jobId, { status: 'processing', progress: 0 }) const result = await AIVideoService.batchGenerateVideos(request) + console.log('Batch processing result in store:', result) + console.log('Result status:', result?.status) + console.log('Result type:', typeof result?.status) // Check if the Python script actually succeeded if (result && result.status === true) { + console.log('Batch processing succeeded, updating job to completed') updateJob(jobId, { status: 'completed', progress: 100, @@ -184,6 +188,7 @@ export const useAIVideoStore = create((set, get) => ({ }) } else { // Python script returned failure + console.log('Batch processing failed, result:', result) const errorMsg = result?.msg || 'Batch processing failed' updateJob(jobId, { status: 'failed',