Skip to content

Commit

Permalink
Pool the server for conversation status
Browse files Browse the repository at this point in the history
  • Loading branch information
harishmohanraj committed Nov 24, 2023
1 parent 62c2db5 commit e42739e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
22 changes: 11 additions & 11 deletions src/client/components/ConversationWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,14 @@ export default function ConversationWrapper() {
);

useEffect(() => {
if (chatContainerRef.current) {
// Todo: remove the below ignore comment
// @ts-ignore
chatContainerRef.current.scrollTop =
// Todo: remove the below ignore comment
// @ts-ignore
chatContainerRef.current.scrollHeight;
}
// if (chatContainerRef.current) {
// // Todo: remove the below ignore comment
// // @ts-ignore
// chatContainerRef.current.scrollTop =
// // Todo: remove the below ignore comment
// // @ts-ignore
// chatContainerRef.current.scrollHeight;
// }
}, [conversations]);

async function callAgent(userQuery: string) {
Expand All @@ -106,17 +106,17 @@ export default function ConversationWrapper() {
conv_id: payload.conversation_id,
});
// 3. add agent response as new conversation in the table
const openAIPayload = {
const openAIResponse = {
conversation_id: conversations.id,
conversations: [
...payload.conversations,
// Todo: remove the below ignore comment
// @ts-ignore
...[{ role: "assistant", content: response.content }],
],
status: response.team_status,
...(response.team_status && { status: response.team_status }),
};
await updateConversation(openAIPayload);
await updateConversation(openAIResponse);
setIsLoading(false);
} catch (err: any) {
setIsLoading(false);
Expand Down
2 changes: 1 addition & 1 deletion src/server/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ export const updateConversation: UpdateConversation<
where: { id: args.conversation_id },
data: {
conversation: args.conversations,
status: args.status,
...(args.status && { status: args.status }),
},
});
};
Expand Down

0 comments on commit e42739e

Please sign in to comment.