mckaywrigley / chatbot-ui

Come join the best place on the internet to learn AI skills. Use code "chatbotui" for an extra 20% off.
https://JoinTakeoff.com
MIT License
28.83k stars 8.04k forks source link

Serverless Functions Error when running other models #1582

Open Jonneal3 opened 8 months ago

Jonneal3 commented 8 months ago

Hi guys - question...for API folder to be used for serverless functions, I need the API to reference similar material in the lib that the front end accesses as well. When i make an API request, it works swimmingly up until the point that it hits a routing rule.

Ive separately tried to access the endpoint for groq (for example) and I continually get this "user not found" error - which makes no sense because in the "groq" route, there is nothing mentioning any user.

Screenshot 2024-03-21 at 1 08 54 AM

Any thoughts?

spammenotinoz commented 8 months ago

Hello @Jonneal3 while interesting, suggest moving to discussions as this is not an issue with the codebase.

Jonneal3 commented 8 months ago

Hey @spammenotinoz - Appreciate the feedback. I finally got the chance to post a part 2 here jsut now, so let me fill you in.

I was able to deep dive into the API folder. Most routes in that directory import from the "server-chat-helpers" which utilizes cookies, which is a client side feature.

Thought the api's (outbound completion requess) such as anthropic, google etc. are API's, I've looked around to learn more, and it doesnt sound like the API dircotry in next.js is supposed to be used for client side items. From what ive read, i believe most of the routing in the API folder are supposed to be moved to a separate directory either in the "lib" or another directory.

It just gets confusing because from what i can tell, the api directory in next.js is for http requests. - https://nextjs.org/docs/pages/building-your-application/routing/api-routes

I'd like to look into moving everything in the API directory and partition it to another part of the app, to have the API directory for serverless http based API requests. For now, ive left them, but id request looking into moving them. Thanks.