copilot-api-plus 1.0.48 → 1.0.49
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 +1 -2
- package/dist/main.js.map +1 -1
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -2875,7 +2875,6 @@ 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(`Context too long (${tokenCount.input}/${maxPromptTokens} tokens), truncating...`);
|
|
2879
2878
|
const groups = groupMessages(payload.messages);
|
|
2880
2879
|
const systemGroups = groups.filter((g) => g.isSystem);
|
|
2881
2880
|
const conversationGroups = groups.filter((g) => !g.isSystem);
|
|
@@ -2902,7 +2901,7 @@ const truncateMessages = async (payload, model) => {
|
|
|
2902
2901
|
if (newTokenCount.input <= safeLimit) {
|
|
2903
2902
|
if (dropCount > 0) {
|
|
2904
2903
|
const droppedMessages = conversationGroups.slice(0, dropCount).reduce((sum, g) => sum + g.messages.length, 0);
|
|
2905
|
-
console.log(`Truncated
|
|
2904
|
+
console.log(`Truncated: ${tokenCount.input} -> ${newTokenCount.input} tokens (-${droppedMessages} msgs)`);
|
|
2906
2905
|
}
|
|
2907
2906
|
return truncatedPayload;
|
|
2908
2907
|
}
|