mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 05:12:39 +00:00
fix: price page init data;perf: usage code;fix: reasoning tokens;fix: workflow basic node cannot upgrade (#3816)
* fix: img read * fix: price page init data * perf: ai model avatar * perf: refresh in change team * perf: null checker * perf: usage code * fix: reasoning tokens * fix: workflow basic node cannot upgrade * perf: model refresh * perf: icon refresh
This commit is contained in:
@@ -72,7 +72,7 @@ parentPort?.on(
|
||||
};
|
||||
|
||||
const total =
|
||||
messages.reduce((sum, item) => {
|
||||
messages.reduce((sum, item, index) => {
|
||||
// Evaluates the text of toolcall and functioncall
|
||||
const functionCallPrompt = (() => {
|
||||
let prompt = '';
|
||||
@@ -100,7 +100,13 @@ parentPort?.on(
|
||||
.join('');
|
||||
})();
|
||||
|
||||
return sum + countPromptTokens(`${contentPrompt}${functionCallPrompt}`, item.role);
|
||||
// Only the last message computed reasoning_text
|
||||
const reasoningText = index === messages.length - 1 ? item.reasoning_text || '' : '';
|
||||
|
||||
return (
|
||||
sum +
|
||||
countPromptTokens(`${reasoningText}${contentPrompt}${functionCallPrompt}`, item.role)
|
||||
);
|
||||
}, 0) +
|
||||
countToolsTokens(tools) +
|
||||
countToolsTokens(functionCall);
|
||||
|
Reference in New Issue
Block a user