@pinkbanana/dsh-balance 0.17.3 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/README_EN.md +4 -4
- package/docs/estimates.en.md +4 -0
- package/docs/estimates.md +4 -0
- package/lib/client.js +123 -19
- package/lib/client.js.map +1 -1
- package/lib/index.js +103 -22
- package/lib/index.js.map +1 -1
- package/lib/types/advice.d.ts +4 -0
- package/lib/types/cache-breaks.d.ts +33 -0
- package/lib/types/client/AdviceCard.d.ts +8 -2
- package/lib/types/client/locales.d.ts +11 -0
- package/lib/types/client/styles.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -148,18 +148,18 @@ providers:
|
|
|
148
148
|
|
|
149
149
|
内置 [DeepSeek 官方美元定价](https://api-docs.deepseek.com/quick_start/pricing/):现行 Flash 低谷价为每百万 tokens 缓存命中 $0.003 / 未命中 $0.15 / 输出 $0.60,高峰为 2 倍;高峰为北京时间周一至周五 09:00–12:00、14:00–18:00(UTC 01:00–04:00、06:00–10:00),周末及中国法定节假日全天低谷。法定节假日按 [国办发明电〔2025〕7号](https://www.gov.cn/zhengce/zhengceku/202511/content_7047091.htm) 的 2026 年放假日期。现行 Flash 价自 2026-09-10 04:00 UTC 起生效,此前仍使用 2026-08-17 历史档(当前官网已不再列出该档数字,无法复核)。
|
|
150
150
|
|
|
151
|
-
[StepFun 官方人民币标准价](https://platform.stepfun.com/docs/zh/guides/pricing/details) 于 2026-11-10 复核:`step-5-preview`、`step-3.7-flash`、`step-3.5-flash`、`step-3.5-flash-2603` 和 `step-1o-turbo-vision`。`step-5-preview` 缓存命中标准价自北京时间 2026-10-14 00:30 起由 0.35 元/百万调整为 0.70 元/百万;该时间之前已通过按量付费 API 调用过该模型的账户可能仍适用 0.35 元,插件无法识别账户是否享受此保留价,因此一律按标准生效时间计价。StepFun 未缓存输入(含缓存写入)、缓存读取、输出分别计价,不套用 DeepSeek 峰谷倍率。费用是公开标准价估算,不代表账户实际账单;套餐、折扣和未保存的历史调价不包含在内。
|
|
151
|
+
[StepFun 官方人民币标准价](https://platform.stepfun.com/docs/zh/guides/pricing/details) 于 2026-11-10 复核:`step-5`、`step-5-preview`、`step-3.7-flash`、`step-3.5-flash`、`step-3.5-flash-2603` 和 `step-1o-turbo-vision`。`step-5-preview` 缓存命中标准价自北京时间 2026-10-14 00:30 起由 0.35 元/百万调整为 0.70 元/百万;该时间之前已通过按量付费 API 调用过该模型的账户可能仍适用 0.35 元,插件无法识别账户是否享受此保留价,因此一律按标准生效时间计价。StepFun 未缓存输入(含缓存写入)、缓存读取、输出分别计价,不套用 DeepSeek 峰谷倍率。费用是公开标准价估算,不代表账户实际账单;套餐、折扣和未保存的历史调价不包含在内。
|
|
152
152
|
|
|
153
153
|
美元和原生人民币费用分别展示;设置 `usdToCny` 后,人民币合计才会包含美元折算金额,并明确标为固定汇率换算。未设置汇率时,原生人民币金额不会被表述为包含美元费用的完整人民币合计。已知价格且费用为 0 的请求单列为“免费”;未知 provider / model 和缺失 usage 的请求保留请求数与 token,显示“未计费”。账户余额是实时查询值,与本地用量估算独立;赠送余额与充值余额分别展示,StepFun 的总充值/总赠送为累计值而非剩余余额。会话消费页采用居中内容宽度、响应式外边距,并为底部输入框保留空间。
|
|
154
154
|
|
|
155
155
|
|
|
156
156
|
## 下轮费用估算
|
|
157
157
|
|
|
158
|
-
|
|
158
|
+
会话「消费」页会展示下轮费用估算卡片;在用量统计里点击会话名下钻时也会看到同一卡片。聊天框下方的余额摘要可按需展开该估算,默认收起以免占用空间;收起时开关会直接写出最省的下一步(例如「下轮估算 · 等待切换最省」),无需展开即可参考。同一标签页内的导航(包括切换会话或模型)会记住展开或收起;刷新或关闭标签页后仍默认收起。
|
|
159
159
|
|
|
160
160
|
卡片对照四种下一步的费用:当前时段继续、等待下个峰谷切换、现在 `/compact`(摘要请求 + 压缩后首轮;摘要约 4,000 tokens,至多历史的四分之一),以及新开会话(全部未命中缓存),并显示继续本会话相对新开因缓存可节省的费用。也可对照本 Harness 已配置且可计价的其他官方模型。当前模型下最便宜的一步会标上“最便宜”(按单轮费用比较,因此 `/compact` 很少在单轮胜出)。仅为估算,不会自动压缩或换模型。
|
|
161
161
|
|
|
162
|
-
估算使用本会话最近 8 次已计费请求各 token 桶(未缓存输入 / 缓存读取 / 缓存写入 /
|
|
162
|
+
估算使用本会话最近 8 次已计费请求各 token 桶(未缓存输入 / 缓存读取 / 缓存写入 / 输出)的中位数,通过与用量统计相同的计价引擎计算。下轮实际用量可能不同,例如上下文压缩、大段粘贴或视觉输入。卡片还会在检测到缓存命中率骤降(例如换模型、前缀变化或上下文被压缩)时列出最近 3 次「缓存断层」及估算多花的费用,帮助定位缓存为何失效。没有已计价样本或估算加载失败时,卡片会说明原因,并提示重新估算或打开用量统计。完整计算说明、峰谷规则和局限见 [估算是怎么算的](./docs/estimates.md)。
|
|
163
163
|
|
|
164
164
|

|
|
165
165
|
|
package/README_EN.md
CHANGED
|
@@ -146,16 +146,16 @@ Each request is attributed to its actual message source, with request headers as
|
|
|
146
146
|
|
|
147
147
|
Built-in estimates use [official DeepSeek USD rates](https://api-docs.deepseek.com/quick_start/pricing/): current Flash off-peak prices are $0.003 / $0.15 / $0.60 per million tokens (cache hit / miss / output), and peak is 2x. Peak hours are 09:00–12:00 and 14:00–18:00 Beijing time (UTC 01:00–04:00 and 06:00–10:00), Monday–Friday only; weekends and Chinese public holidays are all-day off-peak. Holiday dates follow the 2026 arrangements in [State Council General Office notice 国办发明电〔2025〕7号](https://www.gov.cn/zhengce/zhengceku/202511/content_7047091.htm). Current Flash prices take effect from 2026-09-10 04:00 UTC; earlier usage keeps the 2026-08-17 historical tier (the current official page no longer lists those figures, so they cannot be re-verified).
|
|
148
148
|
|
|
149
|
-
[StepFun mainland CNY reference rates](https://platform.stepfun.com/docs/zh/guides/pricing/details) were re-checked on 2026-11-10 for `step-5-preview`, `step-3.7-flash`, `step-3.5-flash`, `step-3.5-flash-2603`, and `step-1o-turbo-vision`. The standard `step-5-preview` cache-hit price changed from 0.35 to 0.70 CNY per million tokens at 2026-10-14 00:30 Beijing time. Accounts that had already used the pay-as-you-go API before that time may keep 0.35; the plugin cannot detect that grandfathering, so it applies the standard effective-from date. Requests without supported pricing keep their token and request counts and show as unpriced. A similarly named DeepSeek model does not inherit official DeepSeek pricing on another provider. Entirely unpriced totals do not show $0; mixed totals include only known charges and carry a partial-cost label. Live account balances are separate from local usage estimates.
|
|
149
|
+
[StepFun mainland CNY reference rates](https://platform.stepfun.com/docs/zh/guides/pricing/details) were re-checked on 2026-11-10 for `step-5` (same rates as `step-5-preview`), `step-5-preview`, `step-3.7-flash`, `step-3.5-flash`, `step-3.5-flash-2603`, and `step-1o-turbo-vision`. The standard `step-5-preview` cache-hit price changed from 0.35 to 0.70 CNY per million tokens at 2026-10-14 00:30 Beijing time. Accounts that had already used the pay-as-you-go API before that time may keep 0.35; the plugin cannot detect that grandfathering, so it applies the standard effective-from date. Requests without supported pricing keep their token and request counts and show as unpriced. A similarly named DeepSeek model does not inherit official DeepSeek pricing on another provider. Entirely unpriced totals do not show $0; mixed totals include only known charges and carry a partial-cost label. Live account balances are separate from local usage estimates.
|
|
150
150
|
|
|
151
151
|
|
|
152
152
|
## Next-turn estimates
|
|
153
153
|
|
|
154
|
-
The session Usage tab shows a next-turn estimate card; the same card appears when you drill into a session from Usage Statistics. The composer balance dock can expand the estimate on demand; it stays collapsed by default so it does not clutter the row. The tab remembers whether you left it open or closed while you navigate (including session or model switches); a refresh or closing the tab returns to the default collapsed state.
|
|
154
|
+
The session Usage tab shows a next-turn estimate card; the same card appears when you drill into a session from Usage Statistics. The composer balance dock can expand the estimate on demand; it stays collapsed by default so it does not clutter the row, and the collapsed toggle names the cheapest next step (for example “Next-turn estimate · waiting is cheapest”) so it is useful without opening. The tab remembers whether you left it open or closed while you navigate (including session or model switches); a refresh or closing the tab returns to the default collapsed state.
|
|
155
155
|
|
|
156
156
|
The card compares four next steps: continue in the current period, wait for the next peak change, **`/compact` now** (summarizer request plus the first post-compact turn; about 4,000 summary tokens, at most a quarter of the history), and a fresh session (all cache-miss), plus how much cache saves by continuing versus starting over. It can also compare other official models already configured in this Harness that can be priced. The cheapest of these four steps for the current model gets a “Cheapest” badge (single-turn cost, so `/compact` rarely wins one turn). These are estimates only; nothing is compacted or switched automatically.
|
|
157
157
|
|
|
158
|
-
The token shape is the per-bucket median of the session’s most recent 8 priced requests (uncached input, cache read, cache write, output), priced through the same billing engines as usage totals rather than a second pricing path. The next turn may not match, for example after compaction, a large paste, or vision input. When there is no priced sample or the estimate fails to load, the card explains why and suggests refreshing or opening Usage. The full method, peak-hour rules, and limitations are in [How estimates are computed](./docs/estimates.en.md).
|
|
158
|
+
The token shape is the per-bucket median of the session’s most recent 8 priced requests (uncached input, cache read, cache write, output), priced through the same billing engines as usage totals rather than a second pricing path. The next turn may not match, for example after compaction, a large paste, or vision input. The card also lists the latest three **cache breaks** — turns where the cache-hit share collapsed (model switch, changed prefix, or a much shorter context after compaction) — with the estimated extra cost versus keeping the prefix. When there is no priced sample or the estimate fails to load, the card explains why and suggests refreshing or opening Usage. The full method, peak-hour rules, and limitations are in [How estimates are computed](./docs/estimates.en.md).
|
|
159
159
|
|
|
160
160
|

|
|
161
161
|
|
|
@@ -210,4 +210,4 @@ The activity punchcard groups requests by weekday and hour in the selected brows
|
|
|
210
210
|
|
|
211
211
|
The conversation usage view has centered content, responsive padding and space for the composer. Cache input is counted once; duplicate settlements replace the previous sample, retries remain separate, and fork prefixes are excluded.
|
|
212
212
|
|
|
213
|
-
StepFun mainland API estimates use [official standard CNY rates](https://platform.stepfun.com/docs/zh/guides/pricing/details), re-checked on 2026-11-10, for `step-5-preview`, `step-3.7-flash`, `step-3.5-flash`, `step-3.5-flash-2603`, and `step-1o-turbo-vision`. The standard `step-5-preview` cache-hit rate is 0.70 CNY per million from 2026-10-14 00:30 Beijing time; earlier records use 0.35. These reference estimates do not account for plans, discounts, grandfathered account rates, or unrecorded historical rate changes. USD and native CNY are shown separately; only an explicitly configured `usdToCny` rate enables a combined CNY total. Unknown rates remain unpriced. `?page=session` previews the conversation view with 124 StepFun requests.
|
|
213
|
+
StepFun mainland API estimates use [official standard CNY rates](https://platform.stepfun.com/docs/zh/guides/pricing/details), re-checked on 2026-11-10, for `step-5` (same rates as `step-5-preview`), `step-5-preview`, `step-3.7-flash`, `step-3.5-flash`, `step-3.5-flash-2603`, and `step-1o-turbo-vision`. The standard `step-5-preview` cache-hit rate is 0.70 CNY per million from 2026-10-14 00:30 Beijing time; earlier records use 0.35. These reference estimates do not account for plans, discounts, grandfathered account rates, or unrecorded historical rate changes. USD and native CNY are shown separately; only an explicitly configured `usdToCny` rate enables a combined CNY total. Unknown rates remain unpriced. `?page=session` previews the conversation view with 124 StepFun requests.
|
package/docs/estimates.en.md
CHANGED
|
@@ -43,6 +43,10 @@ Plans, discounts, account-specific rates, or unrecorded historical price changes
|
|
|
43
43
|
- The balance dock under the composer can expand the same estimate on demand; it stays collapsed by default. The tab remembers the open/closed state while you navigate; a refresh or closing the tab returns to the default.
|
|
44
44
|
- Local read-only API: `GET /dsh-balance/api/advice?session=…` (`sessionId` is also accepted; optional `provider`, `model`, `refresh=1`, and repeated `compare=provider:model`). Loopback only; the payload never includes prompt or session text.
|
|
45
45
|
|
|
46
|
+
## Cache breaks
|
|
47
|
+
|
|
48
|
+
The card compares each priced request with the previous one. When the previous request hit at least 50% of its prompt, this prompt has at least 2,000 tokens, and the hit share fell by at least 40 percentage points, it is recorded as a **cache break**; the latest three are shown. The cause is a heuristic: a different model or provider → model switched; a prompt under 60% of the previous size → context shrank (possibly a compaction); anything else → prefix changed. Extra cost is the difference between this request's actual usage and a counterfactual that keeps the previous hit share — still an estimate.
|
|
49
|
+
|
|
46
50
|
This version has **no** agent tool the model can call. A read-only `dsh_balance_advise` tool is still on the [roadmap](../ROADMAP.md). Until then, use the UI or the local HTTP route above.
|
|
47
51
|
|
|
48
52
|
Local preview (no credentials):
|
package/docs/estimates.md
CHANGED
|
@@ -43,6 +43,10 @@
|
|
|
43
43
|
- 聊天框下方的余额条可按需展开同一估算,默认收起;同一标签页内会记住展开或收起,刷新或关闭标签页后恢复默认收起。
|
|
44
44
|
- 本机只读接口:`GET /dsh-balance/api/advice?session=…`(也可用 `sessionId`;可选 `provider`、`model`、`refresh=1` 与重复的 `compare=provider:model`)。仅本机可访问,响应不含 prompt 或会话正文。
|
|
45
45
|
|
|
46
|
+
## 缓存断层
|
|
47
|
+
|
|
48
|
+
卡片会比较相邻两次已计价请求:若上一次缓存命中率不低于 50%、本次提示至少 2,000 tokens,且命中率下降至少 40 个百分点,就记为一次「缓存断层」,最多显示最近 3 次。原因是启发式判断:换了模型或 provider → 切换了模型;提示长度不足上一次的 60% → 上下文大幅变短,可能刚压缩过;其余 → 前缀发生变化。多花的费用按本次请求的实际用量与「保持上一次命中率」的反事实用量之差估算,仍然只是估算。
|
|
49
|
+
|
|
46
50
|
本版本**没有**可供模型调用的 agent tool。只读的 `dsh_balance_advise` 仍在[路线图](../ROADMAP.md)中;在此之前,请使用上面的界面或本机 HTTP 接口。
|
|
47
51
|
|
|
48
52
|
本地预览(无需密钥):
|
package/lib/client.js
CHANGED
|
@@ -707,6 +707,10 @@ window.__ModuleLoader__.load({
|
|
|
707
707
|
}
|
|
708
708
|
//#endregion
|
|
709
709
|
//#region src/client/AdviceCard.tsx
|
|
710
|
+
/** Cheapest step of a successful advice response, if any. */
|
|
711
|
+
function cheapestStepOf(result) {
|
|
712
|
+
return result?.ok === true ? result.cheapest : void 0;
|
|
713
|
+
}
|
|
710
714
|
function combined(estimate, rate) {
|
|
711
715
|
if (estimate.combinedCny !== null) return estimate.combinedCny;
|
|
712
716
|
if (rate === null || rate === void 0) return null;
|
|
@@ -766,7 +770,7 @@ window.__ModuleLoader__.load({
|
|
|
766
770
|
});
|
|
767
771
|
}
|
|
768
772
|
/** Session-shaped next-turn estimates. Prompt text is never requested or rendered. */
|
|
769
|
-
function AdviceCard({ sessionId, provider, model, loadAdvice, t, usdToCny = null, compact = false }) {
|
|
773
|
+
function AdviceCard({ sessionId, provider, model, loadAdvice, t, usdToCny = null, compact = false, hidden = false, onResult }) {
|
|
770
774
|
const [result, setResult] = (0, react.useState)();
|
|
771
775
|
const [loading, setLoading] = (0, react.useState)(true);
|
|
772
776
|
const [refreshNonce, setRefreshNonce] = (0, react.useState)(0);
|
|
@@ -799,10 +803,14 @@ window.__ModuleLoader__.load({
|
|
|
799
803
|
model,
|
|
800
804
|
refreshNonce
|
|
801
805
|
]);
|
|
806
|
+
(0, react.useEffect)(() => {
|
|
807
|
+
onResult?.(result);
|
|
808
|
+
}, [result, onResult]);
|
|
802
809
|
const locale = t("locale.tag");
|
|
803
810
|
const onRefresh = () => {
|
|
804
811
|
setRefreshNonce((value) => value + 1);
|
|
805
812
|
};
|
|
813
|
+
if (hidden) return null;
|
|
806
814
|
if (loading && result === void 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
807
815
|
className: compact ? "dsh-advice-dock" : "dsh-balance-status",
|
|
808
816
|
role: "status",
|
|
@@ -911,6 +919,35 @@ window.__ModuleLoader__.load({
|
|
|
911
919
|
]
|
|
912
920
|
});
|
|
913
921
|
}
|
|
922
|
+
function CacheBreakRow({ item, t, usdToCny, locale }) {
|
|
923
|
+
const percent = (value) => `${Math.round(value * 100)}%`;
|
|
924
|
+
const extra = item.extraCostUsd !== void 0 || item.extraCostCny !== void 0;
|
|
925
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
|
|
926
|
+
className: "dsh-advice-break",
|
|
927
|
+
children: [t("advice.cacheBreak", {
|
|
928
|
+
time: formatClockTime(new Date(item.time), locale),
|
|
929
|
+
model: item.model,
|
|
930
|
+
before: percent(item.previousHitRatio),
|
|
931
|
+
after: percent(item.hitRatio),
|
|
932
|
+
cause: t(`advice.cacheBreakCause.${item.cause}`)
|
|
933
|
+
}), extra ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
934
|
+
" · ",
|
|
935
|
+
t("advice.cacheBreakExtra"),
|
|
936
|
+
" ",
|
|
937
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(CostText, {
|
|
938
|
+
inline: true,
|
|
939
|
+
estimate: {
|
|
940
|
+
costUsd: item.extraCostUsd ?? null,
|
|
941
|
+
combinedCny: null,
|
|
942
|
+
...item.extraCostCny === void 0 ? {} : { costCny: item.extraCostCny }
|
|
943
|
+
},
|
|
944
|
+
locale,
|
|
945
|
+
usdToCny,
|
|
946
|
+
t
|
|
947
|
+
})
|
|
948
|
+
] }) : null]
|
|
949
|
+
});
|
|
950
|
+
}
|
|
914
951
|
function PanelAdvice({ advice, t, usdToCny, locale, loading, onRefresh }) {
|
|
915
952
|
const nextChange = advice.nextChangeAt === null ? void 0 : formatClockTime(new Date(advice.nextChangeAt), locale);
|
|
916
953
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
@@ -1021,6 +1058,21 @@ window.__ModuleLoader__.load({
|
|
|
1021
1058
|
locale
|
|
1022
1059
|
}, `${item.provider}:${item.model}:${item.pricingVersion}`))
|
|
1023
1060
|
}) : null,
|
|
1061
|
+
advice.cacheBreaks.length > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1062
|
+
className: "dsh-advice-breaks",
|
|
1063
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1064
|
+
className: "dsh-advice-meta",
|
|
1065
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: t("advice.cacheBreaks") })
|
|
1066
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
|
|
1067
|
+
className: "dsh-advice-caveats",
|
|
1068
|
+
children: advice.cacheBreaks.map((item) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CacheBreakRow, {
|
|
1069
|
+
item,
|
|
1070
|
+
t,
|
|
1071
|
+
usdToCny,
|
|
1072
|
+
locale
|
|
1073
|
+
}, `${item.sessionId}:${item.seq}`))
|
|
1074
|
+
})]
|
|
1075
|
+
}) : null,
|
|
1024
1076
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1025
1077
|
className: "dsh-advice-meta",
|
|
1026
1078
|
children: t(`advice.coverage.${advice.coverage.status}`, {
|
|
@@ -2918,21 +2970,32 @@ window.__ModuleLoader__.load({
|
|
|
2918
2970
|
outputCnyPerMillion: 2.1
|
|
2919
2971
|
}
|
|
2920
2972
|
};
|
|
2921
|
-
const STEPFUN_CURRENT_PRICES = [
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2973
|
+
const STEPFUN_CURRENT_PRICES = [
|
|
2974
|
+
{
|
|
2975
|
+
model: "step-5-preview",
|
|
2976
|
+
effectiveFrom: STEPFUN_STEP5_STANDARD_HIT_FROM,
|
|
2977
|
+
pricingVersion: STEPFUN_PRICING_VERSION,
|
|
2978
|
+
cacheHitCnyPerMillion: .7,
|
|
2979
|
+
cacheMissCnyPerMillion: 7,
|
|
2980
|
+
outputCnyPerMillion: 20
|
|
2981
|
+
},
|
|
2982
|
+
{
|
|
2983
|
+
model: "step-5",
|
|
2984
|
+
effectiveFrom: STEPFUN_STEP5_STANDARD_HIT_FROM,
|
|
2985
|
+
pricingVersion: STEPFUN_PRICING_VERSION,
|
|
2986
|
+
cacheHitCnyPerMillion: .7,
|
|
2987
|
+
cacheMissCnyPerMillion: 7,
|
|
2988
|
+
outputCnyPerMillion: 20
|
|
2989
|
+
},
|
|
2990
|
+
{
|
|
2991
|
+
model: "step-1o-turbo-vision",
|
|
2992
|
+
effectiveFrom: 0,
|
|
2993
|
+
pricingVersion: STEPFUN_PRICING_VERSION,
|
|
2994
|
+
cacheHitCnyPerMillion: .5,
|
|
2995
|
+
cacheMissCnyPerMillion: 2.5,
|
|
2996
|
+
outputCnyPerMillion: 8
|
|
2997
|
+
}
|
|
2998
|
+
];
|
|
2936
2999
|
const BILLING_PRICES = [
|
|
2937
3000
|
...Object.entries(LEGACY_PRICES).map(([model, rates]) => ({
|
|
2938
3001
|
provider: "deepseek",
|
|
@@ -3067,6 +3130,10 @@ window.__ModuleLoader__.load({
|
|
|
3067
3130
|
const [result, setResult] = (0, react.useState)();
|
|
3068
3131
|
const [now, setNow] = (0, react.useState)(() => /* @__PURE__ */ new Date());
|
|
3069
3132
|
const [adviceOpen, setAdviceOpen] = (0, react.useState)(readAdviceDockOpen);
|
|
3133
|
+
const [cheapest, setCheapest] = (0, react.useState)();
|
|
3134
|
+
const onAdviceResult = (0, react.useCallback)((value) => {
|
|
3135
|
+
if (value !== void 0) setCheapest(cheapestStepOf(value));
|
|
3136
|
+
}, []);
|
|
3070
3137
|
(0, react.useEffect)(() => {
|
|
3071
3138
|
if (typeof document === "undefined") {
|
|
3072
3139
|
const timer = setInterval(() => setNow(/* @__PURE__ */ new Date()), PEAK_TICK_MS);
|
|
@@ -3201,15 +3268,17 @@ window.__ModuleLoader__.load({
|
|
|
3201
3268
|
return next;
|
|
3202
3269
|
});
|
|
3203
3270
|
},
|
|
3204
|
-
children:
|
|
3205
|
-
}),
|
|
3271
|
+
children: adviceOpen ? t("advice.dockCollapse") : cheapest === void 0 ? t("advice.dockToggle") : t("advice.dockToggleCheapest", { step: t(`advice.step.${cheapest}`) })
|
|
3272
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AdviceCard, {
|
|
3206
3273
|
compact: true,
|
|
3274
|
+
hidden: !adviceOpen,
|
|
3275
|
+
onResult: onAdviceResult,
|
|
3207
3276
|
sessionId: String(sessionId),
|
|
3208
3277
|
...provider === void 0 ? {} : { provider },
|
|
3209
3278
|
...model === void 0 ? {} : { model },
|
|
3210
3279
|
loadAdvice,
|
|
3211
3280
|
t
|
|
3212
|
-
})
|
|
3281
|
+
})] })]
|
|
3213
3282
|
});
|
|
3214
3283
|
}
|
|
3215
3284
|
//#endregion
|
|
@@ -3402,6 +3471,17 @@ window.__ModuleLoader__.load({
|
|
|
3402
3471
|
"advice.fresh": "新开会话(全部未命中缓存)",
|
|
3403
3472
|
"advice.compact": "现在 /compact(摘要请求 + 压缩后首轮)",
|
|
3404
3473
|
"advice.cheapest": "最便宜",
|
|
3474
|
+
"advice.dockToggleCheapest": "下轮估算 · {step}最省",
|
|
3475
|
+
"advice.step.now": "继续",
|
|
3476
|
+
"advice.step.after-change": "等待切换",
|
|
3477
|
+
"advice.step.fresh": "新开会话",
|
|
3478
|
+
"advice.step.compact": "/compact",
|
|
3479
|
+
"advice.cacheBreaks": "缓存断层",
|
|
3480
|
+
"advice.cacheBreak": "{time} · {model}:缓存命中率 {before} → {after}({cause})",
|
|
3481
|
+
"advice.cacheBreakCause.model-switch": "切换了模型",
|
|
3482
|
+
"advice.cacheBreakCause.context-shrink": "上下文大幅变短,可能刚压缩过",
|
|
3483
|
+
"advice.cacheBreakCause.prefix-change": "前缀发生变化",
|
|
3484
|
+
"advice.cacheBreakExtra": "多花约",
|
|
3405
3485
|
"advice.alternative": "其他已配置模型",
|
|
3406
3486
|
"advice.cacheSavings": "继续本会话相对新开可节省",
|
|
3407
3487
|
"advice.sample": "取最近 {count} / {limit} 次已计费请求的中位数",
|
|
@@ -3614,6 +3694,17 @@ window.__ModuleLoader__.load({
|
|
|
3614
3694
|
"advice.fresh": "Fresh session (all cache-miss)",
|
|
3615
3695
|
"advice.compact": "Compact now (summary request + first turn after)",
|
|
3616
3696
|
"advice.cheapest": "Cheapest",
|
|
3697
|
+
"advice.dockToggleCheapest": "Next-turn estimate · {step} is cheapest",
|
|
3698
|
+
"advice.step.now": "continuing",
|
|
3699
|
+
"advice.step.after-change": "waiting",
|
|
3700
|
+
"advice.step.fresh": "starting fresh",
|
|
3701
|
+
"advice.step.compact": "/compact",
|
|
3702
|
+
"advice.cacheBreaks": "Cache breaks",
|
|
3703
|
+
"advice.cacheBreak": "{time} · {model}: cache hit {before} → {after} ({cause})",
|
|
3704
|
+
"advice.cacheBreakCause.model-switch": "model switched",
|
|
3705
|
+
"advice.cacheBreakCause.context-shrink": "context shrank, possibly after a compaction",
|
|
3706
|
+
"advice.cacheBreakCause.prefix-change": "prefix changed",
|
|
3707
|
+
"advice.cacheBreakExtra": "Extra cost about",
|
|
3617
3708
|
"advice.alternative": "Other configured model",
|
|
3618
3709
|
"advice.cacheSavings": "Saved by continuing this session vs starting over",
|
|
3619
3710
|
"advice.sample": "Median of the last {count} / {limit} priced requests",
|
|
@@ -4215,6 +4306,17 @@ window.__ModuleLoader__.load({
|
|
|
4215
4306
|
"advice.fresh": "新開工作階段(全部未命中快取)",
|
|
4216
4307
|
"advice.compact": "現在 /compact(摘要請求 + 壓縮後首輪)",
|
|
4217
4308
|
"advice.cheapest": "最便宜",
|
|
4309
|
+
"advice.dockToggleCheapest": "下輪估算 · {step}最省",
|
|
4310
|
+
"advice.step.now": "繼續",
|
|
4311
|
+
"advice.step.after-change": "等待切換",
|
|
4312
|
+
"advice.step.fresh": "新開工作階段",
|
|
4313
|
+
"advice.step.compact": "/compact",
|
|
4314
|
+
"advice.cacheBreaks": "快取斷層",
|
|
4315
|
+
"advice.cacheBreak": "{time} · {model}:快取命中率 {before} → {after}({cause})",
|
|
4316
|
+
"advice.cacheBreakCause.model-switch": "切換了模型",
|
|
4317
|
+
"advice.cacheBreakCause.context-shrink": "上下文大幅變短,可能剛壓縮過",
|
|
4318
|
+
"advice.cacheBreakCause.prefix-change": "前綴發生變化",
|
|
4319
|
+
"advice.cacheBreakExtra": "多花約",
|
|
4218
4320
|
"advice.alternative": "其他已設定模型",
|
|
4219
4321
|
"advice.cacheSavings": "繼續本工作階段相對新開可節省",
|
|
4220
4322
|
"advice.sample": "取最近 {count} / {limit} 次已計費請求的中位數",
|
|
@@ -4535,6 +4637,8 @@ window.__ModuleLoader__.load({
|
|
|
4535
4637
|
.dsh-advice-row > span:first-child { min-width: 0; overflow-wrap: anywhere; }
|
|
4536
4638
|
.dsh-advice-meta, .dsh-advice-caveats li { overflow-wrap: anywhere; }
|
|
4537
4639
|
.dsh-advice-row small { flex-basis: 100%; color: var(--ledger-muted); font-size: 11px; }
|
|
4640
|
+
.dsh-advice-breaks { display: flex; flex-direction: column; gap: 4px; padding-top: 8px; border-top: 1px solid var(--ledger-line); }
|
|
4641
|
+
.dsh-advice-break { overflow-wrap: anywhere; }
|
|
4538
4642
|
.dsh-advice-best { color: var(--dsw-alias-label-success, #1a7f37); font-size: 11px; font-weight: 600; white-space: nowrap; }
|
|
4539
4643
|
.dsh-advice-alternatives { display: flex; flex-direction: column; gap: 8px; padding-top: 8px; border-top: 1px solid var(--ledger-line); }
|
|
4540
4644
|
.dsh-advice-caveats { margin: 0; padding-left: 18px; color: var(--ledger-muted); font-size: 11px; line-height: 1.6; }
|