nsarrazin commited on
Commit
2d7325b
·
1 Parent(s): d1d09f6

fix: rename chat bug fix

Browse files
src/lib/server/api/routes/groups/conversations.ts CHANGED
@@ -429,13 +429,19 @@ export const conversationGroup = new Elysia().use(authPlugin).group("/conversati
429
  }
430
  }
431
 
 
 
 
 
 
 
432
  const res = await collections.conversations.updateOne(
433
  {
434
  _id: new ObjectId(params.id),
435
  ...authCondition(locals),
436
  },
437
  {
438
- $set: body,
439
  }
440
  );
441
 
 
429
  }
430
  }
431
 
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
+
438
  const res = await collections.conversations.updateOne(
439
  {
440
  _id: new ObjectId(params.id),
441
  ...authCondition(locals),
442
  },
443
  {
444
+ $set: updateValues,
445
  }
446
  );
447
 
src/routes/conversation/[id]/+server.ts CHANGED
@@ -555,12 +555,18 @@ export async function PATCH({ request, locals, params }) {
555
  error(404, "Conversation not found");
556
  }
557
 
 
 
 
 
 
 
558
  await collections.conversations.updateOne(
559
  {
560
  _id: convId,
561
  },
562
  {
563
- $set: values,
564
  }
565
  );
566
 
 
555
  error(404, "Conversation not found");
556
  }
557
 
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
+
564
  await collections.conversations.updateOne(
565
  {
566
  _id: convId,
567
  },
568
  {
569
+ $set: updateValues,
570
  }
571
  );
572