Chat api frontend route file created and middleware updated#168
Chat api frontend route file created and middleware updated#168Karthi-47 wants to merge 4 commits into
Conversation
| event: NextFetchEvent, | ||
| ) { | ||
| // Apply Clerk middleware for API routes instead of skipping them | ||
| if (request.nextUrl.pathname.startsWith('/api')) { |
There was a problem hiding this comment.
make it
if (request.nextUrl.pathname.startsWith('/api/backend')) {
There was a problem hiding this comment.
Once you chat with the AI as userA in org OrgA, the chat gets stored in session and gets displayed
Now when you modify the org on the top left corner to OrgB, all the chats relevant to OrgB for UserA should be visible
But currently all the chats relevant to userA for orgA is visible eventhough orgB is selected
We should test these things thoroughly before raising a PR
SaravanakumarR2018
left a comment
There was a problem hiding this comment.
-
When I type somethig in chat - it saysfailed to get response
so basically it is not communicating with the backend to get the chat output -
When I create a new chat, the old chat details in old chat thread are getting erased
-
I can create any number of chat threads by clicking on new chat icon, but actually only if you have conversed you should create a new chat thread
-
It is not working for cellphones properly. When I shrink it should not show the chat history and it should only show the chat
-
The start the new chat is close to the chat bar. We should move it up
|
|
||
| try { | ||
| const res = await fetch( | ||
| `http://${CHAT_SERVICE_HOST}:${CHAT_SERVICE_PORT}/getallchats?chat_id=${chatId}&page=${page}&page_size=${pageSize}&org_id=${requestOrgId}`, |
There was a problem hiding this comment.
org_id=${requestOrgId} is not needed
Remove it
| }, | ||
| body: JSON.stringify({ | ||
| question: message, | ||
| chat_id: chatId, |
There was a problem hiding this comment.
Should we not send chatId for the first chat?
WHere are we taking care of the condition?
| } | ||
| } | ||
|
|
||
| const res = await fetch(`/api/backend/getallchats?chat_id=${currentChat}&page=${pageToLoad}&page_size=10&org_id=${currentOrg}`); |
There was a problem hiding this comment.
We dont need org_id =org_id=${currentOrg}
| import { useCallback, useEffect, useRef, useState } from 'react'; | ||
|
|
||
| async function fetchChatIds(page: number = 1, pageSize: number = 15, orgId: string) { | ||
| const res = await fetch(`/api/backend/getallchatids?page=${page}&page_size=${pageSize}&org_id=${orgId}`); |
| } | ||
|
|
||
| async function fetchChatMessages(chatId: string, orgId: string) { | ||
| const res = await fetch(`/api/backend/getallchats?chat_id=${chatId}&org_id=${orgId}`); |

No description provided.