Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
harishmohanraj committed Nov 29, 2023
1 parent d5bc6f7 commit 2cf9dee
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/client/chatConversationHelper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
13 changes: 12 additions & 1 deletion src/server/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<
Expand All @@ -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 }),
},
});

Expand Down Expand Up @@ -175,7 +181,12 @@ export const getAgentResponse: GetAgentResponse<AgentPayload> = 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");
}
Expand Down

0 comments on commit 2cf9dee

Please sign in to comment.