@opencompress/opencompress 1.6.2 → 1.6.4
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/index.js +8 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
6
6
|
});
|
|
7
7
|
|
|
8
8
|
// src/index.ts
|
|
9
|
-
var VERSION = "1.6.
|
|
9
|
+
var VERSION = "1.6.4";
|
|
10
10
|
var DEFAULT_BASE_URL = "https://www.opencompress.ai/api";
|
|
11
11
|
function getApiKey(api) {
|
|
12
12
|
const auth = api.config.auth;
|
|
@@ -412,7 +412,8 @@ var plugin = {
|
|
|
412
412
|
}
|
|
413
413
|
}
|
|
414
414
|
}
|
|
415
|
-
|
|
415
|
+
const modelsForAllowlist = providerModels.models;
|
|
416
|
+
setTimeout(() => injectModelsAllowlist(modelsForAllowlist), 3e3);
|
|
416
417
|
const apiKey = getApiKey(api);
|
|
417
418
|
if (apiKey) {
|
|
418
419
|
persistAuthProfile(apiKey);
|
|
@@ -442,10 +443,10 @@ var plugin = {
|
|
|
442
443
|
}
|
|
443
444
|
const stats = await res.json();
|
|
444
445
|
const calls = stats.totalCalls ?? 0;
|
|
445
|
-
const savings = stats.totalSavings
|
|
446
|
-
const rate = stats.avgCompressionRate ? `${(stats.avgCompressionRate * 100).toFixed(1)}%` : "N/A";
|
|
447
|
-
const origTokens = stats.totalOriginalTokens
|
|
448
|
-
const compTokens = stats.totalCompressedTokens
|
|
446
|
+
const savings = Number(stats.totalSavings || 0).toFixed(4);
|
|
447
|
+
const rate = stats.avgCompressionRate ? `${(Number(stats.avgCompressionRate) * 100).toFixed(1)}%` : "N/A";
|
|
448
|
+
const origTokens = Number(stats.totalOriginalTokens || 0).toLocaleString();
|
|
449
|
+
const compTokens = Number(stats.totalCompressedTokens || 0).toLocaleString();
|
|
449
450
|
return {
|
|
450
451
|
text: [
|
|
451
452
|
"```",
|
|
@@ -497,7 +498,7 @@ var plugin = {
|
|
|
497
498
|
" `/compress-byok sk-or-xxx` \u2014 Connect OpenRouter key",
|
|
498
499
|
" `/compress-byok off` \u2014 Switch back to router mode",
|
|
499
500
|
"",
|
|
500
|
-
data ? `**Balance:** $${data.balance.toFixed(2)}` : ""
|
|
501
|
+
data ? `**Balance:** $${Number(data.balance || 0).toFixed(2)}` : ""
|
|
501
502
|
].join("\n")
|
|
502
503
|
};
|
|
503
504
|
}
|