Concat plugin to app (#1799)

This commit is contained in:
Archer
2024-06-19 14:38:21 +08:00
committed by GitHub
parent b17d14bb7d
commit 565bfc8486
220 changed files with 5018 additions and 4667 deletions

View File

@@ -85,7 +85,14 @@ export const countGptMessagesTokens = (
functionCall
});
} catch (error) {
resolve(0);
addLog.error('Count token error', error);
const total = messages.reduce((sum, item) => {
if (item.content) {
return sum + item.content.length;
}
return sum;
}, 0);
resolve(total);
}
});
};