@polka-codes/core 0.9.92 → 0.9.93
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 +3 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2420,6 +2420,9 @@ var UsageMeter = class {
|
|
|
2420
2420
|
let requestsWithCache = 0;
|
|
2421
2421
|
for (const entry of entries) {
|
|
2422
2422
|
const metadata = entry.metadata;
|
|
2423
|
+
if (typeof metadata !== "object" || metadata === null) {
|
|
2424
|
+
continue;
|
|
2425
|
+
}
|
|
2423
2426
|
const cachedTokens = metadata.cachedPromptTokens ?? metadata.cacheReadTokens ?? metadata.prompt_cache_hit_tokens ?? 0;
|
|
2424
2427
|
if (cachedTokens > 0) {
|
|
2425
2428
|
totalCachedTokens += cachedTokens;
|