-
Notifications
You must be signed in to change notification settings - Fork 1.3k
fix: bypass broken workflow package for self-hosted transcription and AI generation #1630
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -77,35 +77,45 @@ export async function getVideoStatus( | |||||||||
| console.log( | ||||||||||
| `[Get Status] Transcription not started for video ${videoId}, triggering transcription`, | ||||||||||
| ); | ||||||||||
| try { | ||||||||||
| transcribeVideo(videoId, video.ownerId).catch((error) => { | ||||||||||
| console.error( | ||||||||||
| `[Get Status] Error starting transcription for video ${videoId}:`, | ||||||||||
| error, | ||||||||||
| ); | ||||||||||
| }); | ||||||||||
|
|
||||||||||
| return { | ||||||||||
| transcriptionStatus: "PROCESSING", | ||||||||||
| aiGenerationStatus: | ||||||||||
| (metadata.aiGenerationStatus as AiGenerationStatus) || null, | ||||||||||
| aiTitle: metadata.aiTitle || null, | ||||||||||
| summary: metadata.summary || null, | ||||||||||
| chapters: metadata.chapters || null, | ||||||||||
| }; | ||||||||||
| } catch (error) { | ||||||||||
| await db() | ||||||||||
| .update(videos) | ||||||||||
| .set({ transcriptionStatus: "PROCESSING" }) | ||||||||||
| .where(eq(videos.id, videoId)); | ||||||||||
|
|
||||||||||
| transcribeVideo(videoId, video.ownerId, false, true).catch((error) => { | ||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
| console.error( | ||||||||||
| `[Get Status] Error triggering transcription for video ${videoId}:`, | ||||||||||
| `[Get Status] Error starting transcription for video ${videoId}:`, | ||||||||||
| error, | ||||||||||
| ); | ||||||||||
| }); | ||||||||||
|
Comment on lines
+81
to
+91
|
||||||||||
|
|
||||||||||
| return { | ||||||||||
| transcriptionStatus: "PROCESSING", | ||||||||||
| aiGenerationStatus: | ||||||||||
| (metadata.aiGenerationStatus as AiGenerationStatus) || null, | ||||||||||
| aiTitle: metadata.aiTitle || null, | ||||||||||
| summary: metadata.summary || null, | ||||||||||
| chapters: metadata.chapters || null, | ||||||||||
| }; | ||||||||||
| } | ||||||||||
|
|
||||||||||
| if (video.transcriptionStatus === "PROCESSING") { | ||||||||||
| const threeMinutesAgo = new Date(Date.now() - 3 * 60 * 1000); | ||||||||||
| if (video.updatedAt < threeMinutesAgo) { | ||||||||||
|
Comment on lines
+104
to
+105
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. timeout based on Prompt To Fix With AIThis is a comment left during a code review.
Path: apps/web/actions/videos/get-status.ts
Line: 104-105
Comment:
timeout based on `updatedAt` will incorrectly trigger if video record is updated for unrelated reasons (e.g. metadata changes, view count). Consider using a dedicated `processingStartedAt` timestamp or checking `transcriptionStatus` update time specifically
How can I resolve this? If you propose a fix, please make it concise.There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Quick sanity check: does |
||||||||||
| await db() | ||||||||||
| .update(videos) | ||||||||||
| .set({ transcriptionStatus: "ERROR" }) | ||||||||||
| .where(eq(videos.id, videoId)); | ||||||||||
|
|
||||||||||
| return { | ||||||||||
| transcriptionStatus: "ERROR", | ||||||||||
| aiGenerationStatus: | ||||||||||
| (metadata.aiGenerationStatus as AiGenerationStatus) || null, | ||||||||||
| aiTitle: metadata.aiTitle || null, | ||||||||||
| summary: metadata.summary || null, | ||||||||||
| chapters: metadata.chapters || null, | ||||||||||
| error: "Failed to start transcription", | ||||||||||
| error: "Transcription timed out", | ||||||||||
| }; | ||||||||||
| } | ||||||||||
|
Comment on lines
+103
to
120
|
||||||||||
| } | ||||||||||
|
|
||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
race condition:
transcribeVideoon line 86 also sets PROCESSING at line 143, creating duplicate DB writes. SincetranscribeVideois called with_isRetry=true, it will skip the PROCESSING check anywayPrompt To Fix With AI