fix: bind observed models and calibrate every model dispatch budget
This commit is contained in:
@@ -209,7 +209,7 @@ export class Store extends EventEmitter {
|
||||
if (plan.workerDispatchedAt && !plan.workerUsageAccounted && !plan.engineStepOnly) {
|
||||
const run = this.core.run.get(plan.runId);
|
||||
if (run && this.core.task.get(run.taskId)?.workerId) {
|
||||
this.recordResponse(session, run, null, plan.estimatedInputTokens + (run.model.maxOutputTokens ?? 2048));
|
||||
this.recordResponse(session, run, null, plan.tokenReservation?.reservedTokens??plan.estimatedInputTokens + (run.model.maxOutputTokens ?? 2048));
|
||||
plan.workerUsageAccounted = true; plan.workerUsageRecovered = true; changed = true;
|
||||
}
|
||||
}
|
||||
@@ -553,6 +553,7 @@ export class Store extends EventEmitter {
|
||||
model: receipt.model, endpoint: receipt.endpoint, protocol: receipt.protocol,
|
||||
startedAt: receipt.startedAt, finishedAt: receipt.finishedAt, outcome: receipt.outcome,
|
||||
usageStatus: receipt.usage ? 'reported' : 'unknown', usage: receipt.usage ?? null,
|
||||
...(receipt.localEstimate?{localEstimate:structuredClone(receipt.localEstimate)}:{}),
|
||||
estimatedUnknownTokens: receipt.usage ? 0 : Math.max(0, Math.ceil(estimate)) });
|
||||
this.recordResponse(session, run, receipt.usage, estimate);
|
||||
this.save(session, { type: 'model.consumption', detail: { attemptId: receipt.attemptId, usageStatus: receipt.usage ? 'reported' : 'unknown' } });
|
||||
|
||||
Reference in New Issue
Block a user