mirror of https://github.com/openclaw/openclaw.git
refactor: lazy load cron usage formatting
This commit is contained in:
parent
fc8ab82aab
commit
12fa700579
|
|
@ -44,7 +44,6 @@ import {
|
|||
isExternalHookSession,
|
||||
resolveHookExternalContentSource,
|
||||
} from "../../security/external-content.js";
|
||||
import { estimateUsageCost, resolveModelCostConfig } from "../../utils/usage-format.js";
|
||||
import { resolveCronDeliveryPlan } from "../delivery.js";
|
||||
import type { CronJob, CronRunOutcome, CronRunTelemetry } from "../types.js";
|
||||
import {
|
||||
|
|
@ -174,6 +173,10 @@ async function loadCliRunnerRuntime() {
|
|||
return await import("../../agents/cli-runner.runtime.js");
|
||||
}
|
||||
|
||||
async function loadUsageFormatRuntime() {
|
||||
return await import("../../utils/usage-format.js");
|
||||
}
|
||||
|
||||
export async function runCronIsolatedAgentTurn(params: {
|
||||
cfg: OpenClawConfig;
|
||||
deps: CliDeps;
|
||||
|
|
@ -727,6 +730,7 @@ export async function runCronIsolatedAgentTurn(params: {
|
|||
}
|
||||
}
|
||||
if (hasNonzeroUsage(usage)) {
|
||||
const { estimateUsageCost, resolveModelCostConfig } = await loadUsageFormatRuntime();
|
||||
const input = usage.input ?? 0;
|
||||
const output = usage.output ?? 0;
|
||||
const totalTokens = deriveSessionTotalTokens({
|
||||
|
|
|
|||
Loading…
Reference in New Issue