mirror of
https://git.mirrors.martin98.com/https://github.com/jina-ai/reader
synced 2025-04-18 11:50:00 +08:00
fix: formatted usage entry
This commit is contained in:
parent
e9d69e6201
commit
e953c01e58
@ -454,7 +454,6 @@ export class SearcherHost extends RPCHost {
|
||||
const itemAmount = this.crawler.assignChargeAmount(x) || 0;
|
||||
|
||||
if (!itemAmount) {
|
||||
Reflect.deleteProperty(x, 'usage');
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -465,6 +464,13 @@ export class SearcherHost extends RPCHost {
|
||||
|
||||
const final = Math.max(contentCharge, numCharge);
|
||||
|
||||
if (final === numCharge) {
|
||||
for (const x of formatted) {
|
||||
x.usage = { tokens: Math.ceil(numCharge / formatted.length) };
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
assignMeta(formatted, { usage: { tokens: final } });
|
||||
|
||||
return final;
|
||||
|
Loading…
x
Reference in New Issue
Block a user