feat: support multiple event proposals in single AI response
- Change proposedChange to proposedChanges array in ChatMessage type - Add unique id and individual respondedAction to each ProposedEventChange - Implement arrow navigation UI for multiple proposals with "Event X von Y" counter - Add updateProposalResponse() method for per-proposal confirm/reject tracking - GPTAdapter now collects multiple tool call results into proposals array - Add RRULE documentation to system prompt (separate events for different times) - Fix RRULE parsing to strip RRULE: prefix if present - Add log summarization for large args (conversationHistory, existingEvents) - Keep proposedChanges logged in full for debugging AI issues
This commit is contained in:
@@ -53,7 +53,7 @@ export class MongoChatRepository implements ChatRepository {
|
||||
conversationId: conversationId,
|
||||
sender: message.sender,
|
||||
content: message.content,
|
||||
proposedChange: message.proposedChange,
|
||||
proposedChanges: message.proposedChanges,
|
||||
});
|
||||
return repoMessage.toJSON() as unknown as ChatMessage;
|
||||
}
|
||||
@@ -69,4 +69,17 @@ export class MongoChatRepository implements ChatRepository {
|
||||
);
|
||||
return doc ? (doc.toJSON() as unknown as ChatMessage) : null;
|
||||
}
|
||||
|
||||
async updateProposalResponse(
|
||||
messageId: string,
|
||||
proposalId: string,
|
||||
respondedAction: "confirm" | "reject",
|
||||
): Promise<ChatMessage | null> {
|
||||
const doc = await ChatMessageModel.findOneAndUpdate(
|
||||
{ _id: messageId, "proposedChanges.id": proposalId },
|
||||
{ $set: { "proposedChanges.$.respondedAction": respondedAction } },
|
||||
{ new: true },
|
||||
);
|
||||
return doc ? (doc.toJSON() as unknown as ChatMessage) : null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@ const UpdatesSchema = new Schema<UpdateEventDTO>(
|
||||
|
||||
const ProposedChangeSchema = new Schema<ProposedEventChange>(
|
||||
{
|
||||
id: { type: String, required: true },
|
||||
action: {
|
||||
type: String,
|
||||
enum: ["create", "update", "delete"],
|
||||
@@ -52,6 +53,10 @@ const ProposedChangeSchema = new Schema<ProposedEventChange>(
|
||||
eventId: { type: String },
|
||||
event: { type: EventSchema },
|
||||
updates: { type: UpdatesSchema },
|
||||
respondedAction: {
|
||||
type: String,
|
||||
enum: ["confirm", "reject"],
|
||||
},
|
||||
},
|
||||
{ _id: false },
|
||||
);
|
||||
@@ -77,12 +82,9 @@ const ChatMessageSchema = new Schema<
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
proposedChange: {
|
||||
type: ProposedChangeSchema,
|
||||
},
|
||||
respondedAction: {
|
||||
type: String,
|
||||
enum: ["confirm", "reject"],
|
||||
proposedChanges: {
|
||||
type: [ProposedChangeSchema],
|
||||
default: undefined,
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user