mirror of
https://github.com/jina-ai/node-DeepResearch.git
synced 2025-12-26 06:28:56 +08:00
chore: first commit
This commit is contained in:
parent
a032a71701
commit
f8bb0b4c1a
@ -15,7 +15,7 @@ export class TokenTracker extends EventEmitter {
|
||||
const currentTotal = this.getTotalUsage();
|
||||
if (this.budget && currentTotal + tokens > this.budget) {
|
||||
// Instead of adding tokens and then throwing, we'll throw before adding
|
||||
throw new Error(`Token budget exceeded: ${currentTotal + tokens} > ${this.budget}`);
|
||||
console.error(`Token budget exceeded: ${currentTotal + tokens} > ${this.budget}`);
|
||||
}
|
||||
// Only track usage if we're within budget
|
||||
if (!this.budget || currentTotal + tokens <= this.budget) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user