Skip to content

Commit

Permalink
fix: custom chat title (#534)
Browse files Browse the repository at this point in the history
* Fix: Update Custom Chat Title Based on chatId

* remove `new:true` option

* Update update.ts

---------

Co-authored-by: Archer <[email protected]>
  • Loading branch information
nongmo677 and c121914yu authored Dec 3, 2023
1 parent a9ae270 commit 7fc05af
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions projects/app/src/pages/api/core/chat/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)

await authChat({ req, authToken: true, chatId });

await MongoChat.findByIdAndUpdate(chatId, {
...(customTitle ? { customTitle } : {}),
...(top ? { top } : { top: null })
await MongoChat.findOneAndUpdate({ chatId }, {
...(customTitle && { customTitle }),
...(top && { top })
});
jsonRes(res);
} catch (err) {
Expand Down

0 comments on commit 7fc05af

Please sign in to comment.