Add metadata flag to api/chats/recent

05a963a637335ad5627f20b722003d1399098f1b

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +3 -2Showing whitespace changes
src/endpoints/chats.js+3 -2
@@ -963,9 +963,10 @@ router.post('/recent', async function (request, response) {
963963 const max = parseInt(request.body.max ?? Number.MAX_SAFE_INTEGER);
964964 const recentChats = allChatFiles.sort((a, b) => b.mtime - a.mtime).slice(0, max);
965965 const jsonFilesPromise = recentChats.map((file) => {
966+ const withMetadata = Boolean(request.body.metadata);
966967 return file.groupId
967968 ? getChatInfo(file.filePath, { group: file.groupId }, true, withMetadata)
968969 : getChatInfo(file.filePath, { avatar: file.pngFile }, false, withMetadata);
969970 });
970971
971972 const chatData = (await Promise.allSettled(jsonFilesPromise)).filter(x => x.status === 'fulfilled').map(x => x.value);