jormarcus / baike

https://baike-six.vercel.app
0 stars 0 forks source link

Chat - Create a chat and navigate to chat room page #6

Open jormarcus opened 1 year ago

jormarcus commented 1 year ago

On submit from input on Home page, a chat instance should be created and saved to the db. Then the user should navigate to a Chat page with chatId in the header. The user's message should be printed on top of the page and then the AI response should come back and be printed on the screen.

The response is a stream from openAi's chatgpt model (possibly give ability to change models in the future).

At the moment, onSubmit the chat is created and then after waiting for that call to finish, the user is navigated to the chat room. Look into changing the createChat call so its non-blocking and we can navigate immiediately.

https://platform.openai.com/docs/api-reference/chat/create https://github.com/vercel-labs/ai/blob/main/examples/next-openai/app/api/chat/route.ts

jormarcus commented 1 year ago

I originally used my own code to create a stream from the openAI api, but switched to using Vercel's AI SDK.