tarasglek / chatcraft.org

Developer-oriented ChatGPT clone
https://chatcraft.org/
MIT License
147 stars 26 forks source link

Update youtube-rewriter error handling to pass captioning errors as ChatCraft message #625

Closed rjwignar closed 2 months ago

rjwignar commented 2 months ago

This fixes #605

Background

If you use /import with a Youtube video that either has no English captions or no captions at all, ChatCraft will throw a non-descriptive error toast: image

Caption extraction for YouTube videos is handled by youtube-captions-scraper within functions/lib/rewriters/youtube-rewriter.ts.

A previous PR for this (#618) would extract unhandled error messages from the HTML of a generated CloudFlare Pages page and put it inside an Error Toast.

Fix

In this PR, any errors thrown in youtube-rewriter will show up in the /import Response (as a ChatCraft message): image

rjwignar commented 2 months ago

Can we remove the other fix you made before, or does it still have value?

I had both fixes in one branch and found that only this fix would be triggered if an error occured (there'd be a ChatCraft message but no Error Toast). We can remove the other fix.

cloudflare-pages[bot] commented 2 months ago

Deploying chatcraft-org with  Cloudflare Pages  Cloudflare Pages

Latest commit: 48951a4
Status: ✅  Deploy successful!
Preview URL: https://62f568e2.console-overthinker-dev.pages.dev
Branch Preview URL: https://issue-605-2.console-overthinker-dev.pages.dev

View logs