diff --git a/src/client/chatConversationHelper.tsx b/src/client/chatConversationHelper.tsx index 55bd448..db5a578 100644 --- a/src/client/chatConversationHelper.tsx +++ b/src/client/chatConversationHelper.tsx @@ -36,7 +36,9 @@ export async function addAgentMessageToConversation( chat_id: Number(chat_id), message: response.content, role: "assistant", - ...(response.team_status && { status: response.team_status }), + ...(response.team_name && { team_name: response.team_name }), + ...(response.team_id && { team_id: response.team_id }), + ...(response.team_status && { team_status: response.team_status }), }; await addNewConversationToChat(openAIResponse); } diff --git a/src/server/actions.ts b/src/server/actions.ts index c4a21a5..1a16ec9 100644 --- a/src/server/actions.ts +++ b/src/server/actions.ts @@ -106,6 +106,9 @@ type AddNewConversationToChatPayload = { message: string; role: string; chat_id: number; + team_name?: string; + team_id?: number; + team_status?: string; }; export const addNewConversationToChat: AddNewConversationToChat< @@ -122,6 +125,9 @@ export const addNewConversationToChat: AddNewConversationToChat< role: args.role, chat: { connect: { id: args.chat_id } }, user: { connect: { id: context.user.id } }, + ...(args.team_name && { team_name: args.team_name }), + ...(args.team_id && { team_id: args.team_id }), + ...(args.team_status && { team_status: args.team_status }), }, }); @@ -175,7 +181,12 @@ export const getAgentResponse: GetAgentResponse = async ( throw new Error(errorMsg); } - return { content: json["content"], team_status: json["team_status"] }; + return { + content: json["content"], + team_status: json["team_status"], + team_name: json["team_name"], + team_id: json["team_id"], + }; } catch (error: any) { throw new HttpError(500, "Something went wrong. Please try again later"); }