mirror of
https://github.com/ThearchyHelios/AgentLab.git
synced 2026-11-23 21:42:01 +00:00
模型不在价格目录里时运行金额写「金额无法估算」,不写 $0:真实运行里 token 记到了上百万,金额却是 $0,看着像没花钱。llm.end 发出时,用了 token、模型却不在价格目录里的标 unpriced(目录里标 0 价的本地模型不算);运行用量按 llm.end 数出 unpriced_calls,成功的运行也补上(状态里的用量分不出 0 是免费还是没价)。运行详情、画布运行面板、航迹的金额:一分都没估出来写「金额无法估算」,估出一部分写「≥ $x」,悬停说几次调用不在价格目录中。check-trace 补断言;流式用量测试和注释里的真实调用次数换成概括说法
This commit is contained in:
@@ -10,7 +10,7 @@ import { type StatusCode } from '../../lib/status'
|
||||
import { isExecuting, liveAt, project, type Projection, type RunPhase, type Trace } from '../../run/trace'
|
||||
import { useRunClock } from '../../run/useRunClock'
|
||||
import type { Approval, Run } from '../../types'
|
||||
import { UNSAVED_HINT, isUnsaved, runName } from '../../lib/terms'
|
||||
import { COST_TEXT, UNSAVED_HINT, isUnsaved, runCostText, runName } from '../../lib/terms'
|
||||
import {
|
||||
LONG_WAIT_MS, ageMs, cancelReason, runScope, runTiming, type RunTiming,
|
||||
} from './model'
|
||||
@@ -92,6 +92,9 @@ export function Telemetry({ run, trace, phase, code, streaming, pending, labelOf
|
||||
const tokens = settled || !streaming ? tokensSettled ?? (liveTokens || undefined) : liveTokens
|
||||
const cost = settled || !streaming ? (isNum(usage.cost_usd) ? usage.cost_usd : trace.costUsd || undefined) : trace.costUsd
|
||||
const approx = streaming && !settled
|
||||
// 金额估不出来的调用(模型不在价格目录中):有的话不写 $0
|
||||
const unpriced = (settled || !streaming ? (isNum(usage.unpriced_calls) ? usage.unpriced_calls : undefined) : undefined)
|
||||
?? trace.unpricedCalls
|
||||
|
||||
const running = Object.values(trace.nodes).filter(isExecuting)
|
||||
const waitingId = trace.waitingNodeId ?? pending?.[0]?.node_id
|
||||
@@ -156,7 +159,7 @@ export function Telemetry({ run, trace, phase, code, streaming, pending, labelOf
|
||||
<Value data="tokens">
|
||||
{tokens ? <>{approx && '≥ '}{formatTokens(tokens, { compact: true })}</> : NONE}
|
||||
</Value>
|
||||
<Sub>{isNum(cost) && cost > 0 ? `${approx ? '≥ ' : ''}${formatCost(cost)}` : isNum(cost) ? formatCost(cost) : ' '}</Sub>
|
||||
<Sub title={unpriced ? COST_TEXT.unpricedTitle(unpriced) : undefined}>{runCostText(cost, unpriced, approx) ?? ' '}</Sub>
|
||||
</Cell>
|
||||
</div>
|
||||
)
|
||||
|
||||
@@ -11,7 +11,7 @@ import { explainRunError } from '../../lib/explain'
|
||||
import {
|
||||
NONE, formatCost, formatDateTime, formatNumber, formatOffset, formatSpan, formatTokens, shortId,
|
||||
} from '../../lib/format'
|
||||
import { runClassLabel, nodeTypeLabel } from '../../lib/terms'
|
||||
import { COST_TEXT, runClassLabel, nodeTypeLabel, runCostText } from '../../lib/terms'
|
||||
import { topology, type GraphLike } from '../../run/derive'
|
||||
import {
|
||||
isActivePhase, isSettled, liveAt, project, type NodeState, type Projection, type RunPhase, type Trace,
|
||||
@@ -245,7 +245,9 @@ function Readout({
|
||||
sub={tokens ? `输入 ${formatNumber(proj.tokensIn)} · 输出 ${formatNumber(proj.tokensOut)}` : undefined}>
|
||||
{tokens == null ? NONE : formatTokens(tokens, { compact: true })}
|
||||
</Metric>
|
||||
<Metric label="成本" data="cost">{!metered || proj.costUsd == null ? NONE : formatCost(proj.costUsd)}</Metric>
|
||||
<Metric label="成本" data="cost" title={trace.unpricedCalls ? COST_TEXT.unpricedTitle(trace.unpricedCalls) : undefined}>
|
||||
{!metered || proj.costUsd == null ? NONE : runCostText(proj.costUsd, trace.unpricedCalls) ?? NONE}
|
||||
</Metric>
|
||||
</div>
|
||||
|
||||
<div className="runs-trace-cols">
|
||||
|
||||
Reference in New Issue
Block a user