PaoloJN / youtube-ai-extension

Interactive YouTube extension built with React, Tailwind CSS, and Plasmo. It integrates with the OpenAI API to enable real-time video chat, providing summaries, Q&A, and context-aware responses directly on YouTube.
https://chat-with-youtube.vercel.app
Other
291 stars 27 forks source link

Feat: Add ollama, mistral ai and others #4

Open Yhozen opened 5 months ago

Yhozen commented 5 months ago

This PR switches from OpenAI node library to vercel AI sdk, which abstract many AI apis.

I think a settings section would be a nice addition + the persistent storage added in #3

I would do it but I honestly suck at frontend :(

Adding more models/providers is trivial now with the ai sdk (think of it like the orm or prisma of AI apis)

Screenshots

Screenshot 2024-06-15 at 5 23 03 PM Screenshot 2024-06-15 at 5 23 22 PM
Yhozen commented 5 months ago

This is WIP since there's no way to add/edit/delete keys (or other settings i.e: ollama url) for providers

zangjiucheng commented 5 months ago
image

Hi, that's an excellent improvement to the code! This feature is exactly what I need and am working on right now, and I'm also researching this area.

However, when I tested the code on this branch, I noticed that the AI SDK might conflict with the Cross-Origin Resource Sharing (CORS) policy, resulting in a 403 error. I’m unsure of the exact cause, but it seems related to this issue.

A potential solution could be to request with mode: 'no-cors'. I'm not very familiar with the AI SDK library, so let's work together to figure out this issue :)

Test Platform:

Yhozen commented 5 months ago
image

Hi, that's an excellent improvement to the code! This feature is exactly what I need and am working on right now, and I'm also researching this area.

However, when I tested the code on this branch, I noticed that the AI SDK might conflict with the Cross-Origin Resource Sharing (CORS) policy, resulting in a 403 error. I’m unsure of the exact cause, but it seems related to this issue.

A potential solution could be to request with mode: 'no-cors'. I'm not very familiar with the AI SDK library, so let's work together to figure out this issue :)

Test Platform:

  • model: Macbook (M1 pro)
  • system: MacOS 14.5 (23F79)
  • browser: Chromium Engine Version 126.0.6478.57
  • User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36

I will give it a try later today!