Merge 200f8c0f0340c12181dca28a712a53436f09588b into 598f1826d8b2bc969aace2c6459824737667218c
This commit is contained in:
commit
9631548e8c
@ -316,7 +316,7 @@ export async function launchOpenClawChrome(
|
||||
args.push("about:blank");
|
||||
|
||||
return spawn(exe.path, args, {
|
||||
stdio: "pipe",
|
||||
stdio: ["ignore", "ignore", "ignore"],
|
||||
env: {
|
||||
...process.env,
|
||||
// Reduce accidental sharing with the user's env.
|
||||
|
||||
@ -769,22 +769,22 @@ export const usageHandlers: GatewayRequestHandlers = {
|
||||
.toSorted((a, b) => b.count - a.count),
|
||||
},
|
||||
byModel: Array.from(byModelMap.values()).toSorted((a, b) => {
|
||||
const costDiff = b.totals.totalCost - a.totals.totalCost;
|
||||
const costDiff = (b.totals?.totalCost ?? 0) - (a.totals?.totalCost ?? 0);
|
||||
if (costDiff !== 0) {
|
||||
return costDiff;
|
||||
}
|
||||
return b.totals.totalTokens - a.totals.totalTokens;
|
||||
return (b.totals?.totalTokens ?? 0) - (a.totals?.totalTokens ?? 0);
|
||||
}),
|
||||
byProvider: Array.from(byProviderMap.values()).toSorted((a, b) => {
|
||||
const costDiff = b.totals.totalCost - a.totals.totalCost;
|
||||
const costDiff = (b.totals?.totalCost ?? 0) - (a.totals?.totalCost ?? 0);
|
||||
if (costDiff !== 0) {
|
||||
return costDiff;
|
||||
}
|
||||
return b.totals.totalTokens - a.totals.totalTokens;
|
||||
return (b.totals?.totalTokens ?? 0) - (a.totals?.totalTokens ?? 0);
|
||||
}),
|
||||
byAgent: Array.from(byAgentMap.entries())
|
||||
.map(([id, totals]) => ({ agentId: id, totals }))
|
||||
.toSorted((a, b) => b.totals.totalCost - a.totals.totalCost),
|
||||
.toSorted((a, b) => (b.totals?.totalCost ?? 0) - (a.totals?.totalCost ?? 0)),
|
||||
...tail,
|
||||
};
|
||||
|
||||
|
||||
@ -707,11 +707,11 @@ export async function loadSessionCostSummary(params: {
|
||||
|
||||
const modelUsage = modelUsageMap.size
|
||||
? Array.from(modelUsageMap.values()).toSorted((a, b) => {
|
||||
const costDiff = b.totals.totalCost - a.totals.totalCost;
|
||||
const costDiff = (b.totals?.totalCost ?? 0) - (a.totals?.totalCost ?? 0);
|
||||
if (costDiff !== 0) {
|
||||
return costDiff;
|
||||
}
|
||||
return b.totals.totalTokens - a.totals.totalTokens;
|
||||
return (b.totals?.totalTokens ?? 0) - (a.totals?.totalTokens ?? 0);
|
||||
})
|
||||
: undefined;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user