Commit 7fc05af0 by NongMO Committed by GitHub

fix: custom chat title (#534)

* Fix: Update Custom Chat Title Based on chatId

* remove `new:true` option

* Update update.ts

---------

Co-authored-by: Archer <545436317@qq.com>
parent a9ae2703
......@@ -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) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment