Skip to content

Add "Render Selected" for video generation - #200

Merged
davior merged 2 commits into
mainfrom
claude/festive-turing-o115dl
Oct 4, 2026
Merged

davior merged 2 commits into
mainfrom
claude/festive-turing-o115dl

Conversation

@davior

@davior davior commented Oct 4, 2026

Copy link
Copy Markdown
Owner

Summary

Implement automatic detection and rendering of selected text in video generation. When a user highlights a portion of their note, the video renderer now uses only that selection instead of the entire note.

Key features:

  • Transparent selection detection: Uses existing getEditorSelectionMarkdown() function from AI assistant
  • Automatic fallback: Single "Video (MP4)" button works with or without selection
  • Smart diagram filtering: Only rasterizes diagrams within selected blocks (faster for large notes)
  • Accurate estimates: /video/estimate endpoint respects selected content for accurate segment/duration predictions

Changes

Frontend

  • EditorView.tsx: Detect selection, filter diagram rasterization to selected blocks, pass selectedContent through VideoGenModal
  • VideoGenModal.tsx: Accept optional selectedContent prop, pass to render function
  • activity.ts: Thread selectedContent through startVideo() call
  • videoGen.ts: Include selected_content in API request payload

Backend

  • schemas.py: Add selected_content: Optional[str] to VideoRenderRequest
  • models.py: Add selected_content: Optional[str] column to VideoRenderJob
  • routers/video.py: Store selected_content in job, use in estimate endpoint
  • worker.py: Use job.selected_content if present, else fetch full note
  • database.py: Migration to add nullable selected_content column to video_render_jobs

Testing

  • Render full note (no selection) → works as before
  • Highlight a section → VideoGenModal shows estimate for selection only
  • Estimate reflects selection scope (fewer segments, shorter duration)
  • Click "Preview" or "Generate" → video renders only selected content
  • Output video duration is noticeably shorter than full-note render
  • Diagrams outside selection are skipped during rasterization

Generated with Claude Code

https://claude.ai/code/session_01KrPcbycrTZrrThFR2a23Yz


Generated by Claude Code

claude added 2 commits October 4, 2026 06:27
When a user highlights text in the editor, it's now automatically detected and passed to the video renderer. If selection exists, only that portion is rendered; otherwise, the full note is rendered.

Changes:
- Frontend: Detect selection using getEditorSelectionMarkdown(), filter diagram rasterization to selected blocks only, pass selectedContent through the render pipeline
- Backend: Accept optional selected_content in VideoRenderRequest, store in VideoRenderJob, use in estimate and render endpoints
- Database: Add nullable selected_content column to video_render_jobs via migration

UX: Selection detection is transparent - single "Video (MP4)" button automatically uses selection if present, falls back to full note if not. Estimate endpoint returns accurate segment/duration for selection.
…meter

The function implementation accepted selectedContent but the interface didn't,
causing TypeScript compilation error TS2554 in EditorView.tsx.

davior commented Oct 4, 2026

Copy link
Copy Markdown
Owner Author

Fixed TypeScript compilation error in the initial commit. The issue was that the startVideo() function signature in the activity store interface wasn't updated to accept the new selectedContent parameter. The implementation accepted it, but the type definition didn't, causing TS2554 error at EditorView.tsx:993.

Fix: Updated the ActivityState.startVideo type signature to include the optional selectedContent?: string parameter.

Commit: 2b97dde


Generated by Claude Code

davior commented Oct 4, 2026

Copy link
Copy Markdown
Owner Author

✅ CI is now passing!

Both checks completed successfully:

  • ✅ Backend (pytest)
  • ✅ Frontend (vitest + build)

The TypeScript fix resolved the compilation error. The PR is now ready for code review and testing.


Generated by Claude Code

@davior
davior marked this pull request as ready for review October 4, 2026 07:43
@davior
davior merged commit e2d1574 into main Oct 4, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants