@rayadesu/dsh-client-ui-billing 0.3.2 → 0.3.5
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.i18n.yaml +2 -2
- package/README.md +1 -1
- package/README.zh.md +1 -1
- package/lib/client.js +50 -97
- package/lib/types/client/TurnCostAction.d.ts +13 -9
- package/lib/types/client/locales.d.ts +0 -1
- package/package.json +3 -3
package/README.i18n.yaml
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
# last confirmed-consistent state. Both languages carry equal authority; after
|
|
3
3
|
# editing either side, bring the other along and re-record both hashes with:
|
|
4
4
|
# git hash-object README.md README.zh.md
|
|
5
|
-
README.md:
|
|
6
|
-
README.zh.md:
|
|
5
|
+
README.md: 72a43fe5a4e2fd6cb5f0e95232387a3418a4abf8
|
|
6
|
+
README.zh.md: 8f3c5aad147d645af91214f4b35015a413722baf
|
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ English | [中文](README.zh.md)
|
|
|
4
4
|
|
|
5
5
|
Web billing feature owner: contributes one entry to `conversation.session.header.utilities` that mounts its own `billing` Remote, reads the DeepSeek account balance, this session's billed spend, today's spend across every session, today's per-session ranking, and one turn's cost through `billing/getBalance`, `billing/getSessionSpend`, `billing/getTodaySpend`, `billing/getTodaySessionsSpend`, and `billing/getTurnSpend`, and renders them as a top-right label box. The host half of the capability lives in [`dsh-llm-billing`](../llm-billing/README.md), which owns the `/user/balance` transport, the peak/off-peak pricing table, and the `billing` Remote namespace; this package mounts that Remote and renders what it returns.
|
|
6
6
|
|
|
7
|
-
The trigger shows two lines — the remaining balance and this conversation's billed spend ("本轮对话花费 ¥X") — and renders nothing while the first fetch is in flight. Clicking it opens a label box with the remaining amount, this session's billed spend (本会话花费, priced per message at the official peak/off-peak rate — peak windows apply weekdays Mon–Fri only, weekends are off-peak) with today's all-session spend beside it (今日共花费), one priced row per model with the cache-hit / cache-miss-input / output cost breakdown ("缓存命中 ¥X · 未命中输入 ¥Y · 输出 ¥Z"), a manual refresh action, and a spend disclaimer. The remaining-amount row (`API 剩余金额`) renders larger than the spend rows below it. Below the model rows the panel ends with the **today session-spend ranking** (`今日会话花费`): sessions sorted by today's cost, highest first, each row a fixed right-aligned rank column, then the same middot separator the cost breakdown uses ("·" with the same size, tone, and spacing), then the session's durable title (renames sync automatically), then its amount — the title keeps its indented rank column; at most `SESSION_RANKING_LIMIT` (10) rows render, with a "…还有 N 个会话" hint for the rest. Refreshing keeps the last values visible rather than blanking them, and a refresh failure retains the last good value. A session or day without priced usage shows a "no usage recorded" word rather than a fabricated figure. A failure — no API key configured, a rejected credential, a transport error — renders a muted "Balance unavailable" word whose tooltip carries the Remote's own error message.
|
|
7
|
+
The trigger shows two lines — the remaining balance and this conversation's billed spend ("本轮对话花费 ¥X") — and renders nothing while the first fetch is in flight. Clicking it opens a label box with the remaining amount, this session's billed spend (本会话花费, priced per message at the official peak/off-peak rate — peak windows apply weekdays Mon–Fri only, weekends are off-peak; a forked session prices only its own post-fork work) with today's all-session spend beside it (今日共花费), one priced row per model with the cache-hit / cache-miss-input / output cost breakdown ("缓存命中 ¥X · 未命中输入 ¥Y · 输出 ¥Z"), a manual refresh action, and a spend disclaimer. The remaining-amount row (`API 剩余金额`) renders larger than the spend rows below it. Below the model rows the panel ends with the **today session-spend ranking** (`今日会话花费`): sessions sorted by today's cost, highest first, each row a fixed right-aligned rank column, then the same middot separator the cost breakdown uses ("·" with the same size, tone, and spacing), then the session's durable title (renames sync automatically), then its amount — the title keeps its indented rank column; at most `SESSION_RANKING_LIMIT` (10) rows render, with a "…还有 N 个会话" hint for the rest. Refreshing keeps the last values visible rather than blanking them, and a refresh failure retains the last good value. A session or day without priced usage shows a "no usage recorded" word rather than a fabricated figure. A failure — no API key configured, a rejected credential, a transport error — renders a muted "Balance unavailable" word whose tooltip carries the Remote's own error message.
|
|
8
8
|
|
|
9
9
|
The package also contributes the **turn-cost entry** (`billing-turn-cost`, order 20) to ui-chat's `conversation.chat.assistant-actions` list slot — the same strip `ui-message-feedback` uses, so entries coexist; the entry uses flex `order: -1` to sit at the **front** of the actions row (before the copy control). For each completed turn's closing assistant message, the entry reads `billing/getTurnSpend` (memoized per session + message, since settled turns never change) and renders `本轮花费 ¥X` — the "本轮花费" word in the usage-card title tone and the amount in the summary tone, **always visible** (the hover rule only targets the clock text). Turns that priced to zero (no DeepSeek usage) and failed loads render nothing, so a Remote outage never clutters the row.
|
|
10
10
|
|
package/README.zh.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
Web 额度特性的归属方:向 `conversation.session.header.utilities` 贡献一个条目,自己挂载 `billing` Remote,通过 `billing/getBalance`、`billing/getSessionSpend`、`billing/getTodaySpend`、`billing/getTodaySessionsSpend` 与 `billing/getTurnSpend` 读取 DeepSeek 账户余额、本会话的计费花费、今日所有会话的计费花费、今日按会话的排行与单个回合的花费,并在右上角渲染成一个标签框。该能力的宿主侧在 [`dsh-llm-billing`](../llm-billing/README.md),它拥有 `/user/balance` 传输、峰谷计价表与 `billing` Remote 命名空间;本包挂载那个 Remote 并渲染它返回的内容。
|
|
6
6
|
|
|
7
|
-
触发器显示两行——剩余额度与本轮对话的计费花费(「本轮对话花费 ¥X
|
|
7
|
+
触发器显示两行——剩余额度与本轮对话的计费花费(「本轮对话花费 ¥X」)——首个请求在途时不渲染任何东西。点击后展开一个标签框:剩余金额、本会话的计费花费(本会话花费,按官方峰/谷单价逐条消息计价——高峰窗口仅周一至周五适用,周末按低谷价——分叉会话只按分叉后的自有工作计价——右侧并列今日所有会话的合计「今日共花费」)、每个模型一行的花费及其缓存命中/未命中输入/输出分项(「缓存命中 ¥X · 未命中输入 ¥Y · 输出 ¥Z」)、手动刷新按钮与花费说明。剩余金额行(`API 剩余金额`)字号大于下方花费行。模型行下方是**今日会话花费排行**(`今日会话花费`):按今日花费从高到低排列的会话列表,每行以右对齐的名次列开头,后接与花费分项相同的小圆点分隔符(「·」,字号、色调与间距一致),再是会话的持久标题(重命名自动同步),最后是金额——标题在名次列后缩进对齐;最多渲染 `SESSION_RANKING_LIMIT`(10)行,其余以「…还有 N 个会话」提示。刷新时旧值不消失,刷新失败保留上一次有效值。没有可计价消耗的会话或日子显示「暂无消耗记录」而不是编造数字。失败——未配置 API key、凭据被拒绝、传输错误——渲染弱化的「额度不可用」,其提示携带 Remote 自己的错误信息。
|
|
8
8
|
|
|
9
9
|
本包还贡献**本轮花费条目**(`billing-turn-cost`,order 20)到 ui-chat 的 `conversation.chat.assistant-actions` list slot——与 `ui-message-feedback` 同一条操作条,多条目共存;条目经 CSS `order: -1` 排到操作行**最前**(复制按钮之前)。对每条已完成回合的收尾助手消息,条目通过 `billing/getTurnSpend` 读取花费(按会话 + 消息 memo,回合落定后不再变化),渲染「本轮花费 ¥X」——「本轮花费」用卡片标题色、金额用卡片摘要色,**始终显示**(悬停规则只作用于时钟文本)。回合没有 DeepSeek 用量(花费为 0)或加载失败时不渲染,Remote 故障不会污染操作行。
|
|
10
10
|
|
package/lib/client.js
CHANGED
|
@@ -4297,8 +4297,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4297
4297
|
]
|
|
4298
4298
|
};
|
|
4299
4299
|
//#endregion
|
|
4300
|
-
//#region \0dsh-css
|
|
4301
|
-
const css$1 = ".
|
|
4300
|
+
//#region \0dsh-css:C:\Users\admin\Desktop\me\code\DeepSeek-Harness-chat-billing\packages\ui-billing\src\client\BalanceBadge.module.css.mjs
|
|
4301
|
+
const css$1 = "._4_Wqcq_root{position:relative}._4_Wqcq_trigger{background:var(--dsw-alias-fill-l2);min-height:32px;color:var(--dsw-alias-label-secondary);cursor:pointer;border:0;border-radius:8px;align-items:center;gap:4px;padding:4px 8px;display:inline-flex}._4_Wqcq_trigger:hover,._4_Wqcq_trigger:focus-visible{color:var(--dsw-alias-label-primary)}._4_Wqcq_trigger svg{transition:transform .12s}._4_Wqcq_chevronOpen{transform:rotate(180deg)}._4_Wqcq_triggerLines{text-align:left;flex-direction:column;align-items:flex-start;gap:0;display:flex}._4_Wqcq_linePrimary{font-variant-numeric:tabular-nums;font-size:12px;line-height:16px}._4_Wqcq_lineSecondary{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;font-size:11px;line-height:15px}._4_Wqcq_unavailable{color:var(--dsw-alias-label-tertiary)}._4_Wqcq_inlineIcon{color:var(--dsw-alias-label-tertiary);flex:none}._4_Wqcq_spinning{color:var(--dsw-alias-label-tertiary);flex:none;animation:.8s linear infinite _4_Wqcq_spin}@keyframes _4_Wqcq_spin{to{transform:rotate(360deg)}}._4_Wqcq_panel{z-index:100;box-sizing:border-box;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-specific-menu);width:336px;max-width:min(360px,100vw - 32px);box-shadow:var(--dsw-shadow-lv3);border-radius:12px;flex-direction:column;gap:2px;padding:6px;display:flex;position:absolute;top:calc(100% + 6px);right:0}._4_Wqcq_amountRow{border-radius:8px;justify-content:space-between;align-items:center;gap:8px;padding:6px 8px;display:flex}._4_Wqcq_amountLabel{color:var(--dsw-alias-label-primary);font-variant-numeric:tabular-nums;font-size:13px;line-height:18px}._4_Wqcq_amountRow>._4_Wqcq_amountLabel{font-size:15px;line-height:22px}._4_Wqcq_spendRow{border-top:1px solid var(--dsw-alias-border-l2);border-radius:0;justify-content:space-between;align-items:center;gap:8px;padding:6px 8px;display:flex}._4_Wqcq_costRow{align-items:center;padding:2px 8px 6px;display:flex}._4_Wqcq_costBreakdown{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;font-size:11px;line-height:16px}._4_Wqcq_amountActions{align-items:center;gap:2px;display:inline-flex}._4_Wqcq_infoButton,._4_Wqcq_refreshButton{width:24px;height:24px;color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:0;border-radius:6px;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}._4_Wqcq_infoButton:hover,._4_Wqcq_infoButton:focus-visible,._4_Wqcq_refreshButton:hover,._4_Wqcq_refreshButton:focus-visible{color:var(--dsw-alias-label-secondary);background:var(--dsw-alias-fill-l2)}._4_Wqcq_modelRow{border-radius:8px;justify-content:space-between;align-items:baseline;gap:8px;padding:6px 8px;display:flex}._4_Wqcq_modelName{color:var(--dsw-alias-label-secondary);flex:none;font-size:12px;line-height:18px}._4_Wqcq_tasks{text-align:right;min-width:0;color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;overflow-wrap:anywhere;font-size:12px;line-height:18px}._4_Wqcq_ranking{border-top:1px solid var(--dsw-alias-border-l2);flex-direction:column;gap:0;padding-top:2px;display:flex}._4_Wqcq_rankingTitle{color:var(--dsw-alias-label-secondary);padding:6px 8px 2px;font-size:12px;line-height:18px}._4_Wqcq_rankingRow{border-radius:8px;align-items:baseline;gap:0;min-width:0;padding:3px 8px;display:flex}._4_Wqcq_rankingRow:hover{background:var(--dsw-alias-fill-l2)}._4_Wqcq_rankingIndex{width:16px;color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;text-align:right;flex:none;font-size:11px;line-height:16px}._4_Wqcq_rankingDot{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;white-space:pre;flex:none;font-size:11px;line-height:16px}._4_Wqcq_rankingName{min-width:0;color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;text-overflow:ellipsis;white-space:nowrap;flex:1;font-size:11px;line-height:16px;overflow:hidden}._4_Wqcq_rankingAmount{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;flex:none;margin-left:8px;font-size:11px;line-height:16px}._4_Wqcq_rankingMore{color:var(--dsw-alias-label-tertiary);padding:2px 8px 4px;font-size:11px;line-height:16px}";
|
|
4302
4302
|
const tagId$1 = "@rayadesu/dsh-client-ui-billing/BalanceBadge.module.css";
|
|
4303
4303
|
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$1) + "]") === null) {
|
|
4304
4304
|
const tag = document.createElement("style");
|
|
@@ -4308,36 +4308,36 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4308
4308
|
document.head.appendChild(tag);
|
|
4309
4309
|
}
|
|
4310
4310
|
var BalanceBadge_module_css_default = {
|
|
4311
|
-
"amountActions": "
|
|
4312
|
-
"amountLabel": "
|
|
4313
|
-
"amountRow": "
|
|
4314
|
-
"chevronOpen": "
|
|
4315
|
-
"costBreakdown": "
|
|
4316
|
-
"costRow": "
|
|
4317
|
-
"infoButton": "
|
|
4318
|
-
"inlineIcon": "
|
|
4319
|
-
"linePrimary": "
|
|
4320
|
-
"lineSecondary": "
|
|
4321
|
-
"modelName": "
|
|
4322
|
-
"modelRow": "
|
|
4323
|
-
"panel": "
|
|
4324
|
-
"ranking": "
|
|
4325
|
-
"rankingAmount": "
|
|
4326
|
-
"rankingDot": "
|
|
4327
|
-
"rankingIndex": "
|
|
4328
|
-
"rankingMore": "
|
|
4329
|
-
"rankingName": "
|
|
4330
|
-
"rankingRow": "
|
|
4331
|
-
"rankingTitle": "
|
|
4332
|
-
"refreshButton": "
|
|
4333
|
-
"root": "
|
|
4334
|
-
"spendRow": "
|
|
4335
|
-
"spin": "
|
|
4336
|
-
"spinning": "
|
|
4337
|
-
"tasks": "
|
|
4338
|
-
"trigger": "
|
|
4339
|
-
"triggerLines": "
|
|
4340
|
-
"unavailable": "
|
|
4311
|
+
"amountActions": "_4_Wqcq_amountActions",
|
|
4312
|
+
"amountLabel": "_4_Wqcq_amountLabel",
|
|
4313
|
+
"amountRow": "_4_Wqcq_amountRow",
|
|
4314
|
+
"chevronOpen": "_4_Wqcq_chevronOpen",
|
|
4315
|
+
"costBreakdown": "_4_Wqcq_costBreakdown",
|
|
4316
|
+
"costRow": "_4_Wqcq_costRow",
|
|
4317
|
+
"infoButton": "_4_Wqcq_infoButton",
|
|
4318
|
+
"inlineIcon": "_4_Wqcq_inlineIcon",
|
|
4319
|
+
"linePrimary": "_4_Wqcq_linePrimary",
|
|
4320
|
+
"lineSecondary": "_4_Wqcq_lineSecondary",
|
|
4321
|
+
"modelName": "_4_Wqcq_modelName",
|
|
4322
|
+
"modelRow": "_4_Wqcq_modelRow",
|
|
4323
|
+
"panel": "_4_Wqcq_panel",
|
|
4324
|
+
"ranking": "_4_Wqcq_ranking",
|
|
4325
|
+
"rankingAmount": "_4_Wqcq_rankingAmount",
|
|
4326
|
+
"rankingDot": "_4_Wqcq_rankingDot",
|
|
4327
|
+
"rankingIndex": "_4_Wqcq_rankingIndex",
|
|
4328
|
+
"rankingMore": "_4_Wqcq_rankingMore",
|
|
4329
|
+
"rankingName": "_4_Wqcq_rankingName",
|
|
4330
|
+
"rankingRow": "_4_Wqcq_rankingRow",
|
|
4331
|
+
"rankingTitle": "_4_Wqcq_rankingTitle",
|
|
4332
|
+
"refreshButton": "_4_Wqcq_refreshButton",
|
|
4333
|
+
"root": "_4_Wqcq_root",
|
|
4334
|
+
"spendRow": "_4_Wqcq_spendRow",
|
|
4335
|
+
"spin": "_4_Wqcq_spin",
|
|
4336
|
+
"spinning": "_4_Wqcq_spinning",
|
|
4337
|
+
"tasks": "_4_Wqcq_tasks",
|
|
4338
|
+
"trigger": "_4_Wqcq_trigger",
|
|
4339
|
+
"triggerLines": "_4_Wqcq_triggerLines",
|
|
4340
|
+
"unavailable": "_4_Wqcq_unavailable"
|
|
4341
4341
|
};
|
|
4342
4342
|
//#endregion
|
|
4343
4343
|
//#region lib/types/client/BalanceBadge.js
|
|
@@ -4620,8 +4620,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4620
4620
|
});
|
|
4621
4621
|
}
|
|
4622
4622
|
//#endregion
|
|
4623
|
-
//#region \0dsh-css
|
|
4624
|
-
const css = ".
|
|
4623
|
+
//#region \0dsh-css:C:\Users\admin\Desktop\me\code\DeepSeek-Harness-chat-billing\packages\ui-billing\src\client\TurnCostAction.module.css.mjs
|
|
4624
|
+
const css = ".l2XZIa_cost{font-size:var(--dsh-content-font-size-secondary,13px);line-height:calc(24px + var(--dsh-content-font-delta,0px));color:var(--dsw-alias-label-tertiary);white-space:nowrap;order:1;margin-left:8px}";
|
|
4625
4625
|
const tagId = "@rayadesu/dsh-client-ui-billing/TurnCostAction.module.css";
|
|
4626
4626
|
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
|
|
4627
4627
|
const tag = document.createElement("style");
|
|
@@ -4630,42 +4630,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4630
4630
|
tag.textContent = css;
|
|
4631
4631
|
document.head.appendChild(tag);
|
|
4632
4632
|
}
|
|
4633
|
-
var TurnCostAction_module_css_default = {
|
|
4634
|
-
"cost": "_8yL56a_cost",
|
|
4635
|
-
"costLabel": "_8yL56a_costLabel",
|
|
4636
|
-
"costValue": "_8yL56a_costValue",
|
|
4637
|
-
"leading": "_8yL56a_leading",
|
|
4638
|
-
"separator": "_8yL56a_separator"
|
|
4639
|
-
};
|
|
4633
|
+
var TurnCostAction_module_css_default = { "cost": "l2XZIa_cost" };
|
|
4640
4634
|
//#endregion
|
|
4641
4635
|
//#region lib/types/client/TurnCostAction.js
|
|
4642
4636
|
/** Per-turn billed-cost label in the closing assistant message's actions row. */
|
|
4643
|
-
/**
|
|
4644
|
-
* In-house money-bag glyph in the hollow-outline style (16px viewBox, stroke
|
|
4645
|
-
* currentColor, fill none), referencing the 💰 emoji: a bag outline with a
|
|
4646
|
-
* tie knot at the neck and a centered yuan mark on the body. The drawing
|
|
4647
|
-
* fills the 16px box like the other glyphs.
|
|
4648
|
-
* @param props - optional size and class (the leading slot scales it to 14px).
|
|
4649
|
-
* @returns the money-bag icon.
|
|
4650
|
-
*/
|
|
4651
|
-
function WalletIcon({ size = 16, className }) {
|
|
4652
|
-
return (0, react_jsx_runtime.jsx)("svg", {
|
|
4653
|
-
width: size,
|
|
4654
|
-
height: size,
|
|
4655
|
-
className,
|
|
4656
|
-
viewBox: "0 0 16 16",
|
|
4657
|
-
fill: "none",
|
|
4658
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
4659
|
-
children: (0, react_jsx_runtime.jsx)("path", {
|
|
4660
|
-
d: "M4.8 2.7 L5.2 5.2 C2.4 6.6 1.6 9.0 2.7 11.2 C3.4 12.8 5.5 13.6 8 13.6 C10.5 13.6 12.6 12.8 13.3 11.2 C14.4 9.0 13.6 6.6 10.8 5.2 L11.2 2.7 M6.6 1.4 L9.4 2.4 M9.4 1.4 L6.6 2.4 M5.6 5.5 L8 8.2 L10.4 5.5 M8 8.2 V12.4 M5.8 9.2 H10.2 M5.8 10.9 H10.2",
|
|
4661
|
-
stroke: "currentColor",
|
|
4662
|
-
strokeWidth: 1.4,
|
|
4663
|
-
strokeLinecap: "round",
|
|
4664
|
-
strokeLinejoin: "round",
|
|
4665
|
-
fill: "none"
|
|
4666
|
-
})
|
|
4667
|
-
});
|
|
4668
|
-
}
|
|
4669
4637
|
/** CNY amount, up to four decimals with trailing zeros trimmed. */
|
|
4670
4638
|
function formatSpend(amount) {
|
|
4671
4639
|
return `¥${amount.toFixed(4).replace(/\.?0+$/, "")}`;
|
|
@@ -4682,17 +4650,21 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4682
4650
|
return spend;
|
|
4683
4651
|
}
|
|
4684
4652
|
/**
|
|
4685
|
-
* Render one Turn's billed cost
|
|
4686
|
-
*
|
|
4687
|
-
*
|
|
4688
|
-
*
|
|
4689
|
-
* the
|
|
4690
|
-
*
|
|
4691
|
-
*
|
|
4653
|
+
* Render one Turn's billed cost as a plain, non-interactive `¥金额` at the
|
|
4654
|
+
* end of the closing message's actions row. The DOM stays inside the
|
|
4655
|
+
* assistant-actions slot (between copy and branch); flex `order: 1` sorts the
|
|
4656
|
+
* span after every order-0 sibling, so it visually lands after the clock at
|
|
4657
|
+
* the line end. The typography replicates the clock's `.timeEnd` tier and the
|
|
4658
|
+
* row's 8px gap spaces it from the clock, so the amount reads as one trailing
|
|
4659
|
+
* meta line with the time; no icon, label or hover behavior of its own (the
|
|
4660
|
+
* row's hover reveal shows it with the clock). It appears only after the
|
|
4661
|
+
* Remote settles and hides again when the Turn priced to zero (no DeepSeek
|
|
4662
|
+
* usage); a failed fetch stays hidden so a Remote outage never clutters the
|
|
4663
|
+
* row.
|
|
4692
4664
|
* @param props - the closing message id, the session runtime share, and the injected cost reader.
|
|
4693
|
-
* @returns the cost
|
|
4665
|
+
* @returns the cost text, or null while loading, on failure, or for zero cost.
|
|
4694
4666
|
*/
|
|
4695
|
-
function TurnCostAction({ messageId, sessionId, getTurnSpend
|
|
4667
|
+
function TurnCostAction({ messageId, sessionId, getTurnSpend }) {
|
|
4696
4668
|
const [cost, setCost] = (0, react.useState)(null);
|
|
4697
4669
|
(0, react.useEffect)(() => {
|
|
4698
4670
|
let current = true;
|
|
@@ -4710,27 +4682,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4710
4682
|
sessionId
|
|
4711
4683
|
]);
|
|
4712
4684
|
if (cost === null || cost.total <= 0) return null;
|
|
4713
|
-
return (0, react_jsx_runtime.
|
|
4685
|
+
return (0, react_jsx_runtime.jsx)("span", {
|
|
4714
4686
|
className: TurnCostAction_module_css_default.cost,
|
|
4715
4687
|
"data-turn-cost": true,
|
|
4716
|
-
children:
|
|
4717
|
-
(0, react_jsx_runtime.jsx)("span", {
|
|
4718
|
-
className: TurnCostAction_module_css_default.leading,
|
|
4719
|
-
children: (0, react_jsx_runtime.jsx)(WalletIcon, {})
|
|
4720
|
-
}),
|
|
4721
|
-
(0, react_jsx_runtime.jsx)("span", {
|
|
4722
|
-
className: TurnCostAction_module_css_default.costLabel,
|
|
4723
|
-
children: t("turnCost.label")
|
|
4724
|
-
}),
|
|
4725
|
-
(0, react_jsx_runtime.jsx)("span", {
|
|
4726
|
-
className: TurnCostAction_module_css_default.separator,
|
|
4727
|
-
"aria-hidden": true
|
|
4728
|
-
}),
|
|
4729
|
-
(0, react_jsx_runtime.jsx)("span", {
|
|
4730
|
-
className: TurnCostAction_module_css_default.costValue,
|
|
4731
|
-
children: formatSpend(cost.total)
|
|
4732
|
-
})
|
|
4733
|
-
]
|
|
4688
|
+
children: formatSpend(cost.total)
|
|
4734
4689
|
});
|
|
4735
4690
|
}
|
|
4736
4691
|
//#endregion
|
|
@@ -4756,7 +4711,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4756
4711
|
"info.hint": "仅能预估 DeepSeek 相关模型。本会话花费按每条消息的发生时刻(北京时间)所在峰谷时段单价计费:缓存命中输入、未命中输入(含缓存写入)、输出(含推理)分别计价。费率按 8 月 17 日实行的标准,高峰时段为北京时间周一至周五 9:00–12:00、14:00–18:00,周末全天按低谷价计费。",
|
|
4757
4712
|
"badge.aria": "DeepSeek 额度:{amount}",
|
|
4758
4713
|
"panel.aria": "DeepSeek 额度详情",
|
|
4759
|
-
"turnCost.label": "本轮花费",
|
|
4760
4714
|
"label.sessionRanking": "今日会话花费",
|
|
4761
4715
|
"label.sessionRanking.more": "…还有 {count} 个会话"
|
|
4762
4716
|
};
|
|
@@ -4778,7 +4732,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4778
4732
|
"info.hint": "Only DeepSeek models are estimated. This session's spend is priced per message at the rate of its Beijing-time peak/off-peak hour: cache-hit input, cache-miss input (including cache writes), and output (including reasoning) are billed separately. Rates follow the August 17 pricing; peak hours are Beijing time Monday–Friday 09:00–12:00 and 14:00–18:00, and weekends are billed at off-peak prices all day.",
|
|
4779
4733
|
"badge.aria": "DeepSeek balance {amount}",
|
|
4780
4734
|
"panel.aria": "DeepSeek balance details",
|
|
4781
|
-
"turnCost.label": "This turn",
|
|
4782
4735
|
"label.sessionRanking": "Today session spend",
|
|
4783
4736
|
"label.sessionRanking.more": "…{count} more sessions"
|
|
4784
4737
|
};
|
|
@@ -16,15 +16,19 @@ export interface TurnCostActionInjected {
|
|
|
16
16
|
*/
|
|
17
17
|
export type TurnCostActionProps = PropsRuntime<'conversation.chat.assistant-actions'> & InjectFace<TurnCostActionInjected> & PropsLocale<typeof NS>;
|
|
18
18
|
/**
|
|
19
|
-
* Render one Turn's billed cost
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* the
|
|
24
|
-
*
|
|
25
|
-
*
|
|
19
|
+
* Render one Turn's billed cost as a plain, non-interactive `¥金额` at the
|
|
20
|
+
* end of the closing message's actions row. The DOM stays inside the
|
|
21
|
+
* assistant-actions slot (between copy and branch); flex `order: 1` sorts the
|
|
22
|
+
* span after every order-0 sibling, so it visually lands after the clock at
|
|
23
|
+
* the line end. The typography replicates the clock's `.timeEnd` tier and the
|
|
24
|
+
* row's 8px gap spaces it from the clock, so the amount reads as one trailing
|
|
25
|
+
* meta line with the time; no icon, label or hover behavior of its own (the
|
|
26
|
+
* row's hover reveal shows it with the clock). It appears only after the
|
|
27
|
+
* Remote settles and hides again when the Turn priced to zero (no DeepSeek
|
|
28
|
+
* usage); a failed fetch stays hidden so a Remote outage never clutters the
|
|
29
|
+
* row.
|
|
26
30
|
* @param props - the closing message id, the session runtime share, and the injected cost reader.
|
|
27
|
-
* @returns the cost
|
|
31
|
+
* @returns the cost text, or null while loading, on failure, or for zero cost.
|
|
28
32
|
*/
|
|
29
|
-
export declare function TurnCostAction({ messageId, sessionId, getTurnSpend
|
|
33
|
+
export declare function TurnCostAction({ messageId, sessionId, getTurnSpend }: TurnCostActionProps): import("react").JSX.Element | null;
|
|
30
34
|
//# sourceMappingURL=TurnCostAction.d.ts.map
|
|
@@ -19,7 +19,6 @@ export declare const zh: {
|
|
|
19
19
|
readonly 'info.hint': "仅能预估 DeepSeek 相关模型。本会话花费按每条消息的发生时刻(北京时间)所在峰谷时段单价计费:缓存命中输入、未命中输入(含缓存写入)、输出(含推理)分别计价。费率按 8 月 17 日实行的标准,高峰时段为北京时间周一至周五 9:00–12:00、14:00–18:00,周末全天按低谷价计费。";
|
|
20
20
|
readonly 'badge.aria': "DeepSeek 额度:{amount}";
|
|
21
21
|
readonly 'panel.aria': "DeepSeek 额度详情";
|
|
22
|
-
readonly 'turnCost.label': "本轮花费";
|
|
23
22
|
readonly 'label.sessionRanking': "今日会话花费";
|
|
24
23
|
readonly 'label.sessionRanking.more': "…还有 {count} 个会话";
|
|
25
24
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rayadesu/dsh-client-ui-billing",
|
|
3
3
|
"description": "Session-header DeepSeek account-balance and conversation-spend badge over the billing Remote",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.5",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"types": "lib/types/index.d.ts",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"access": "public"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@rayadesu/dsh-llm-billing": "^0.3.
|
|
50
|
+
"@rayadesu/dsh-llm-billing": "^0.3.5",
|
|
51
51
|
"@deepseek-ai/dsh-client-locale": "^0.1.1-rc.2",
|
|
52
52
|
"@deepseek-ai/dsh-client-ui-conversation": "^0.1.1-rc.2",
|
|
53
53
|
"@deepseek-ai/dsh-typert-protocol": "^0.1.1-rc.2",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"@deepseek-ai/dsh-session": "^0.1.1-rc.2"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"@rayadesu/dsh-llm-billing": "^0.3.
|
|
61
|
+
"@rayadesu/dsh-llm-billing": "^0.3.5",
|
|
62
62
|
"@deepseek-ai/dsh-client-locale": "^0.1.1-rc.2",
|
|
63
63
|
"@deepseek-ai/dsh-client-runtime": "^0.1.1-rc.2",
|
|
64
64
|
"@deepseek-ai/dsh-client-test-runtime": "^0.1.1-rc.2",
|