Skip to content

Commit e9c5fd9

Browse files
committed
fix: rename chat bug fix
1 parent 654344c commit e9c5fd9

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/lib/server/api/routes/groups/conversations.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,13 +429,19 @@ export const conversationGroup = new Elysia().use(authPlugin).group("/conversati
429429
}
430430
}
431431

432+
// Only include defined values in the update
433+
const updateValues = {
434+
...(body.title !== undefined && { title: body.title }),
435+
...(body.model !== undefined && { model: body.model }),
436+
};
437+
432438
const res = await collections.conversations.updateOne(
433439
{
434440
_id: new ObjectId(params.id),
435441
...authCondition(locals),
436442
},
437443
{
438-
$set: body,
444+
$set: updateValues,
439445
}
440446
);
441447

src/routes/conversation/[id]/+server.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,12 +555,18 @@ export async function PATCH({ request, locals, params }) {
555555
error(404, "Conversation not found");
556556
}
557557

558+
// Only include defined values in the update
559+
const updateValues = {
560+
...(values.title !== undefined && { title: values.title }),
561+
...(values.model !== undefined && { model: values.model }),
562+
};
563+
558564
await collections.conversations.updateOne(
559565
{
560566
_id: convId,
561567
},
562568
{
563-
$set: values,
569+
$set: updateValues,
564570
}
565571
);
566572

0 commit comments

Comments
 (0)