feat: implement chat persistence with MongoDB
- Add full chat persistence to database (conversations and messages) - Implement MongoChatRepository with cursor-based pagination - Add getConversations/getConversation endpoints in ChatController - Save user and assistant messages in ChatService.processMessage() - Track respondedAction (confirm/reject) on proposed event messages - Load existing messages on chat screen mount - Add addMessages() bulk action and chatMessageToMessageData() helper to ChatStore - Add RespondedAction type and UpdateMessageDTO to shared types
This commit is contained in:
@@ -47,13 +47,20 @@ export const ChatService = {
|
||||
},
|
||||
|
||||
getConversations: async (): Promise<ConversationSummary[]> => {
|
||||
throw new Error("Not implemented");
|
||||
return ApiClient.get<ConversationSummary[]>("/chat/conversations");
|
||||
},
|
||||
|
||||
getConversation: async (
|
||||
_id: string,
|
||||
_options?: GetMessagesOptions,
|
||||
id: string,
|
||||
options?: GetMessagesOptions,
|
||||
): Promise<ChatMessage[]> => {
|
||||
throw new Error("Not implemented");
|
||||
const params = new URLSearchParams();
|
||||
if (options?.before) params.append("before", options.before);
|
||||
if (options?.limit) params.append("limit", options.limit.toString());
|
||||
|
||||
const queryString = params.toString();
|
||||
const url = `/chat/conversations/${id}${queryString ? `?${queryString}` : ""}`;
|
||||
|
||||
return ApiClient.get<ChatMessage[]>(url);
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user