copilot-api-plus 1.0.47 → 1.0.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +2 -2
- package/dist/main.js.map +1 -1
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -2875,7 +2875,7 @@ const truncateMessages = async (payload, model) => {
|
|
|
2875
2875
|
const tokenCount = await getTokenCount(payload, model);
|
|
2876
2876
|
const safeLimit = Math.floor(maxPromptTokens * .95);
|
|
2877
2877
|
if (tokenCount.input <= safeLimit) return payload;
|
|
2878
|
-
console.log(`
|
|
2878
|
+
console.log(`Context too long (${tokenCount.input}/${maxPromptTokens} tokens), truncating...`);
|
|
2879
2879
|
const groups = groupMessages(payload.messages);
|
|
2880
2880
|
const systemGroups = groups.filter((g) => g.isSystem);
|
|
2881
2881
|
const conversationGroups = groups.filter((g) => !g.isSystem);
|
|
@@ -2902,7 +2902,7 @@ const truncateMessages = async (payload, model) => {
|
|
|
2902
2902
|
if (newTokenCount.input <= safeLimit) {
|
|
2903
2903
|
if (dropCount > 0) {
|
|
2904
2904
|
const droppedMessages = conversationGroups.slice(0, dropCount).reduce((sum, g) => sum + g.messages.length, 0);
|
|
2905
|
-
console.log(`Truncated ${droppedMessages}
|
|
2905
|
+
console.log(`Truncated ${droppedMessages} msgs. Tokens: ${tokenCount.input} -> ${newTokenCount.input}`);
|
|
2906
2906
|
}
|
|
2907
2907
|
return truncatedPayload;
|
|
2908
2908
|
}
|