Repository navigation
feat: add AI transcript imports with YouTube captions and browser downloads - #625
Merged
Merged
Conversation
|
Sorry @annieappflowy, your pull request is larger than the review limit of 150,000 diff characters |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add audio/video file imports and YouTube transcript imports to the AI transcript block. Users can insert AI transcript from the slash menu, upload a file, or paste a YouTube URL. YouTube imports now try existing captions first and offer an explicit browser audio download when captions are unavailable. AppFlowy servers do not download or proxy YouTube audio/video.
Why use a browser extension?
An ordinary React page is subject to browser cross-origin restrictions. A React downloader library cannot grant access to YouTube resources or alter the browser's network-header rules. YouTube downloads also need current playback metadata from its native player. The helper prepares that playback on YouTube's origin and applies narrowly scoped network-header rules so the audio can be fetched directly on the user's device. This meets the requirement to keep YouTube media downloading off AppFlowy servers. See Chrome's cross-origin request guidance and network-rule API.
Transcription needs the audio track, so the download omits video frames. Captions already contain text and timestamps; caption import and manual file upload require no extension. The architecture follows the local-extension/network-rule strategy demonstrated by Kira, with an original helper implementation.
Extension and deployment
/api/youtube-audiofor deployment compatibility, but restrict it to authenticated metadata/caption GET requests; the old audio-download POST is rejected. Vite, Node, Bun, and SSR deployments use the shared handler. Static-only deployments must route the endpoint to Node/Bun. No AppFlowy Cloud Premium or desktop changes are included.See the AI transcript documentation and helper installation/permissions.
Validation
pnpm lintpassed, including the shared error catalog, TypeScript, and ESLint.pnpm buildandgit diff --checkpassed.W2zbKF5z1cs: 2,112,472 bytes of playable MP4 audio, 130.45 seconds. The check observed direct Googlevideo requests, zero AppFlowy server requests, and zero remaining helper tabs. It used a disposable browser profile without account sign-in and submitted no paid transcription request or document edits.Reproduce the real browser download with:
This requires a desktop display and installed Playwright Chromium. Automated unit tests use mocked services; they do not validate the live transcription or summary provider.
Remaining limitations
The helper is a development distribution pending an extension-store release. YouTube access restrictions, consent pages, unavailable videos, or player changes may still prevent downloading; file upload remains available. Current live streams are unsupported.
The last recorded full summary request to
test.appflowy.cloudreturnedAI provider authentication failed, while small completion requests succeeded. That upstream issue remains unresolved and needs AI-service investigation. The successful YouTube download does not establish that full live transcription and summary generation succeed; the client preserves the existing summary when generation fails.Feature Preview
Run
pnpm storybookand open the AI transcript import stories for welcome, progress, quota, error, transcript, and summary states.For local testing, run
pnpm dev --port 3001, open a document, and insert AI transcript. Paste a YouTube URL to import captions, or follow the dialog's helper installation steps and select Download audio and transcribe. Upload audio/video is also available.Checklist
General
Testing
Feature-Specific