mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-28 17:29:44 +00:00
Concat plugin to app (#1799)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
Reference in New Issue
Block a user