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.
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