balance-dsh 2.3.6 → 2.3.7
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/lib/client.js +862 -378
- package/lib/index.js +369 -20
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -634,6 +634,14 @@ window.__ModuleLoader__.load({
|
|
|
634
634
|
box-shadow:0 0 5px 1.5px rgba(34,197,94,.26),0 0 20px 3px rgba(34,197,94,.34)}
|
|
635
635
|
.balance-footer--stacked .balance-footer__value--low:hover{
|
|
636
636
|
box-shadow:0 0 5px 1.5px rgba(217,119,6,.26),0 0 20px 3px rgba(217,119,6,.34)}
|
|
637
|
+
/* 上面两条把泛光色**写死**成绿 / 橙,所以默认那条(绿)会落到所有没显式覆盖的状态上:
|
|
638
|
+
余额耗尽那颗「充值」胶囊是红的(--topup),悬停时却冒出绿光
|
|
639
|
+
(2026-11-27 用户截图:「这个泛光颜色不对」)。红胶囊必须配红光。
|
|
640
|
+
⚠️ 以后再加状态色(--empty 这类)也一定要在这里补一条,别指望默认那条会跟着变。 */
|
|
641
|
+
.balance-footer--stacked .balance-footer__value--topup:hover,
|
|
642
|
+
.balance-footer--stacked .balance-footer__value--empty:hover,
|
|
643
|
+
.balance-footer--stacked .balance-footer__value--error:hover{
|
|
644
|
+
box-shadow:0 0 5px 1.5px rgba(229,72,77,.26),0 0 20px 3px rgba(229,72,77,.34)}
|
|
637
645
|
.balance-footer__value--healthy:hover{background:rgba(34,197,94,.22)}
|
|
638
646
|
.balance-footer__value--low:hover{background:rgba(217,119,6,.22)}
|
|
639
647
|
/* 旧版布局:胶囊靠右 —— 这是备份 v1.3.1 里的原始写法(margin-left:auto)。
|
|
@@ -1699,6 +1707,29 @@ window.__ModuleLoader__.load({
|
|
|
1699
1707
|
/* 会话明细一行:名字(可省略)+ 金额 */
|
|
1700
1708
|
.balance-pop__row{display:flex;align-items:baseline;gap:8px;min-width:0;padding:6px 6px;border-radius:7px;font-size:12px}
|
|
1701
1709
|
.balance-pop__row:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(127,127,127,.08))}
|
|
1710
|
+
/* 两列网格(2026-11-27 用户:「每行显示两个」):会话一格,组头 / 两条计费项整行。
|
|
1711
|
+
⚠️ 一律用子选择器(大于号)限定**直接子元素** —— 组内缩进行(.balance-pop__row--nested)在
|
|
1712
|
+
.balance-pop__group-block 里面,不该被拉进两行式格子布局。 */
|
|
1713
|
+
.balance-pop__grid{display:grid;grid-template-columns:1fr 1fr;column-gap:10px;row-gap:1px;min-width:0}
|
|
1714
|
+
.balance-pop__grid > .balance-pop__group-block,
|
|
1715
|
+
.balance-pop__grid > .balance-pop__row--full{grid-column:1 / -1}
|
|
1716
|
+
/* 今天只有一条会话时独占整行,别留半格空白(--one 由 JSX 按 rows.length 挂) */
|
|
1717
|
+
.balance-pop__grid--one > .balance-pop__row{grid-column:1 / -1}
|
|
1718
|
+
/* 一格里的会话行:标题占满整格一行,token 与金额在第二行左右分列。
|
|
1719
|
+
⚠️ 别退回「swatch + 标题 + token + 金额」四段横排:半宽只有 ~145px,
|
|
1720
|
+
token(46px) + 金额(52px) + 三段 gap 一占,标题只剩 ~25px,等于只剩一个省略号。
|
|
1721
|
+
两行式下标题能拿到整格宽度,token 和金额各占第 2 行一头。 */
|
|
1722
|
+
.balance-pop__grid > .balance-pop__row:not(.balance-pop__row--full){
|
|
1723
|
+
display:grid;grid-template-columns:3px minmax(0,1fr) auto;grid-template-rows:auto auto;
|
|
1724
|
+
column-gap:6px;row-gap:1px;align-items:center;
|
|
1725
|
+
}
|
|
1726
|
+
.balance-pop__grid > .balance-pop__row:not(.balance-pop__row--full) > .balance-pop__swatch{grid-column:1;grid-row:1 / span 2;align-self:center}
|
|
1727
|
+
.balance-pop__grid > .balance-pop__row:not(.balance-pop__row--full) > .balance-pop__name{grid-column:2 / span 2;grid-row:1}
|
|
1728
|
+
.balance-pop__grid > .balance-pop__row:not(.balance-pop__row--full) > .balance-pop__meta{grid-column:2;grid-row:2;justify-self:start}
|
|
1729
|
+
.balance-pop__grid > .balance-pop__row:not(.balance-pop__row--full) > .balance-pop__amount{grid-column:3;grid-row:2;justify-self:end;min-width:0}
|
|
1730
|
+
/* 独占整行时回到原来的一行四段(半宽才需要两行),并且按单列压一档(见 --nested 那条) */
|
|
1731
|
+
.balance-pop__grid--one > .balance-pop__row:not(.balance-pop__row--full){
|
|
1732
|
+
display:flex;align-items:baseline;gap:8px;padding:3px 6px;font-size:11.5px}
|
|
1702
1733
|
.balance-pop__name{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
|
|
1703
1734
|
color:var(--dsw-alias-label-primary,#e6e6e8)}
|
|
1704
1735
|
.balance-pop__meta{flex:none;color:var(--dsw-alias-label-tertiary,#9a9a9e);font-size:10.5px;font-variant-numeric:tabular-nums}
|
|
@@ -1706,7 +1737,40 @@ window.__ModuleLoader__.load({
|
|
|
1706
1737
|
font-variant-numeric:tabular-nums}
|
|
1707
1738
|
/* 会话行前的小色条:按金额排序后给个视觉锚点 */
|
|
1708
1739
|
.balance-pop__swatch{flex:none;width:3px;height:11px;border-radius:2px;background:rgba(77,107,254,.85)}
|
|
1740
|
+
/* 单列行的色块收一档(2026-11-27 用户:「左边的色块也要调整大小」):
|
|
1741
|
+
单列行高从 26px 压到 20px(见下面那条 padding),色块按同一比例从 3×11 收到 3×8
|
|
1742
|
+
—— 占行高 40.7% → 39%,跟改前视觉一致。两列格子里的色块保持 3×11:
|
|
1743
|
+
那格里行本来就是两行高,跟单列不是一个尺度。 */
|
|
1744
|
+
.balance-pop__row--nested > .balance-pop__swatch,
|
|
1745
|
+
.balance-pop__grid--one > .balance-pop__row:not(.balance-pop__row--full) > .balance-pop__swatch{
|
|
1746
|
+
width:3px;height:8px;border-radius:1.5px}
|
|
1709
1747
|
.balance-pop__swatch--plugin{background:rgba(127,127,127,.55)}
|
|
1748
|
+
/* 父级分组栏(2026-11-27:「如果父级是一样的 添加一个展开和收起的栏」):
|
|
1749
|
+
同一项目目录下有多个会话时,上面多一行组头,点它展开 / 收起组内的会话行。
|
|
1750
|
+
⚠️ 组头用 div、不用 button:面板在 flex 列里,button 自带 UA 的
|
|
1751
|
+
font/padding/边框会把它顶成 30px 以上,还会把箭头挤歪。
|
|
1752
|
+
role/tabIndex 只是为了键盘可达,点击走 onClick。 */
|
|
1753
|
+
.balance-pop__group{display:flex;align-items:baseline;gap:6px;min-width:0;padding:5px 6px 4px;border-radius:7px;
|
|
1754
|
+
font-size:11.5px;line-height:16px;color:var(--dsw-alias-label-secondary,#b9b9bd);cursor:pointer;user-select:none}
|
|
1755
|
+
.balance-pop__group:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(127,127,127,.08))}
|
|
1756
|
+
/* 箭头用 CSS 三角画,不用 ▸ 字符:那个字符在很多字体里被渲染成一个点,
|
|
1757
|
+
在高 DPI 下几乎看不见(预览图里就是个小方块)。 */
|
|
1758
|
+
.balance-pop__group-caret{flex:none;align-self:center;display:inline-flex;align-items:center;justify-content:center;
|
|
1759
|
+
width:10px;height:10px;color:var(--dsw-alias-label-tertiary,#9a9aa0);
|
|
1760
|
+
transition:transform .12s ease;transform-origin:50% 50%}
|
|
1761
|
+
.balance-pop__group-caret::before{content:"";display:block;width:0;height:0;
|
|
1762
|
+
border-left:4px solid currentColor;border-top:3.5px solid transparent;border-bottom:3.5px solid transparent}
|
|
1763
|
+
.balance-pop__group--open .balance-pop__group-caret{transform:rotate(90deg)}
|
|
1764
|
+
.balance-pop__group-name{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
|
|
1765
|
+
font-weight:600;color:var(--dsw-alias-label-primary,#e6e6e8)}
|
|
1766
|
+
.balance-pop__group-meta{flex:none;font-size:10.5px;font-variant-numeric:tabular-nums;
|
|
1767
|
+
color:var(--dsw-alias-label-tertiary,#9a9aa0)}
|
|
1768
|
+
/* 组内会话行缩进一档,视觉上挂到组头下面。
|
|
1769
|
+
单列压一档(2026-11-27 用户:「如果是单列的话 每块小一点 左边的色块也要调整大小」):
|
|
1770
|
+
两列格子是被半宽逼出来的紧凑排法,单列沿用同样的 padding 就变成一行一个、又高又稀 ——
|
|
1771
|
+
行高 26px 降到 20px(padding 上下 6 → 3、字号 12 → 11.5),缩进仍是 19px。
|
|
1772
|
+
⚠️ 别再往下压:padding 2px 时行高只剩 18.5px,两行会对成一坨(实测过)。 */
|
|
1773
|
+
.balance-pop__row--nested{padding:3px 6px 3px 19px;font-size:11.5px}
|
|
1710
1774
|
/* 网页工具费那一行的色块:与同步费的蓝区分开 */
|
|
1711
1775
|
.balance-pop__swatch--web{background:var(--dsw-alias-state-warning-primary,#d97706)}
|
|
1712
1776
|
.balance-pop__empty{padding:18px 12px;text-align:center;font-size:12px;color:var(--dsw-alias-label-tertiary,#9a9a9e)}
|
|
@@ -1829,6 +1893,26 @@ window.__ModuleLoader__.load({
|
|
|
1829
1893
|
.balance-pop__tip-hourcost{display:inline-block;transform-origin:right center;animation:balance-pop-tip-push .16s cubic-bezier(.22,.72,.28,1) both}
|
|
1830
1894
|
@keyframes balance-pop-tip-push{from{transform:scaleX(.9)}to{transform:scaleX(1)}}
|
|
1831
1895
|
@media(prefers-reduced-motion:reduce){.balance-pop__tip-cost,.balance-pop__tip-hourcost{animation:none}}
|
|
1896
|
+
/* 面板行的悬停提示(2026-11-27:「我说的小浮窗是鼠标悬停时显示的码」)。
|
|
1897
|
+
⚠️ 这三处原来挂的是**原生 title** → 灰底方框、裸 UUID、配色/圆角/层级都不归主题管
|
|
1898
|
+
(同日用户:「这个小浮窗的样式不对」)。当时把 title 全删了,结果**功能一起没了**
|
|
1899
|
+
(用户:「这个小浮窗直接不显示了」)—— 删样式不等于删功能,正确解法是自绘。
|
|
1900
|
+
固定定位 + portal 到 body:面板本身 overflow:hidden,贴着行下方渲染会被裁掉。
|
|
1901
|
+
z-index 必须**高于 .balance-pop 的 10050**,否则被面板压住。 */
|
|
1902
|
+
.balance-pop__code-tip{box-sizing:border-box;position:fixed;z-index:10060;
|
|
1903
|
+
max-width:min(340px,calc(100vw - 24px));padding:5px 9px;
|
|
1904
|
+
border:1px solid var(--dsw-alias-border-l2,#45454d);border-radius:6px;
|
|
1905
|
+
background:var(--dsw-alias-bg-module-platform,#27272b);
|
|
1906
|
+
box-shadow:0 6px 18px rgba(0,0,0,.28);
|
|
1907
|
+
color:var(--dsw-alias-label-primary,#f4f4f5);
|
|
1908
|
+
font-size:11px;line-height:1.45;white-space:normal;
|
|
1909
|
+
pointer-events:none;animation:balance-heatmap-tooltip-in .12s ease-out both}
|
|
1910
|
+
.balance-pop__code-tip--above{transform:translateY(-100%)}
|
|
1911
|
+
.balance-pop__code-tip-title{display:block;font-weight:500;overflow:hidden;
|
|
1912
|
+
text-overflow:ellipsis;white-space:nowrap}
|
|
1913
|
+
.balance-pop__code-tip-sub{display:block;margin-top:2px;font-size:10.5px;
|
|
1914
|
+
color:var(--dsw-alias-label-tertiary,#9a9aa0);font-variant-numeric:tabular-nums;
|
|
1915
|
+
word-break:break-all}
|
|
1832
1916
|
/* 当前时刻的白条:两层 drop-shadow 做泛光(近处锐、远处散)。
|
|
1833
1917
|
2026-11-26 用户:「白条可以添加泛光效果」。 */
|
|
1834
1918
|
.balance-pop__now{stroke:rgba(255,255,255,.92);stroke-width:1.4;filter:drop-shadow(0 0 2.5px rgba(255,255,255,.8)) drop-shadow(0 0 7px rgba(255,255,255,.35))}
|
|
@@ -1986,6 +2070,23 @@ window.__ModuleLoader__.load({
|
|
|
1986
2070
|
.balance-settings__group-note--warn{border-color:color-mix(in srgb,#d97706 34%,transparent);background:color-mix(in srgb,#d97706 12%,transparent);color:color-mix(in srgb,#d97706 78%,#e8e8ea)}
|
|
1987
2071
|
.balance-settings__group-note--warn .balance-settings__group-note-icon{color:#d97706;opacity:1}.balance-settings__hint-warn{display:block;margin-top:3px;color:#d97706;font-weight:600}
|
|
1988
2072
|
.balance-settings__hint-error{display:block;margin-top:3px;color:#e5484d;font-weight:600}
|
|
2073
|
+
/* 同步两行的模式说明(2026-11-27):从组级提示拆下来的,各自跟在所属行说明文字后面。
|
|
2074
|
+
必须 display:block 另起一行 —— 和上一句 inline 拼在一起会变成一长串。
|
|
2075
|
+
⚠️ **要有框**(用户:「提示框成圆角矩形」):纯文字看不出这是条提示,和普通说明混在一起。
|
|
2076
|
+
样式跟 notice / newcue / group-note 同一套 —— 8px 圆角、.5px 26% 边、10% 半透明底
|
|
2077
|
+
(半透明,不是 var(--dsw-alias-base) 实心;实心在深色底上会变成一块色卡)。
|
|
2078
|
+
宽度用 fit-content **收缩到内容宽**:这两句长短不一,拉满整行会变成两条大色带压过正文。
|
|
2079
|
+
⚠️ width:fit-content + padding 必须配 box-sizing:border-box,否则溢出父宽(DSH 没有全局 border-box)。 */
|
|
2080
|
+
.balance-settings__hint-mode{
|
|
2081
|
+
display:block;box-sizing:border-box;width:fit-content;max-width:100%;
|
|
2082
|
+
margin-top:6px;padding:4px 10px;border-radius:var(--dsw-radius-md,8px);
|
|
2083
|
+
border:.5px solid color-mix(in srgb,#d97706 26%,transparent);
|
|
2084
|
+
background:color-mix(in srgb,#d97706 10%,transparent);
|
|
2085
|
+
font-size:12px;line-height:18px;color:#f2ab55}
|
|
2086
|
+
.balance-settings__hint-mode--free{
|
|
2087
|
+
border-color:color-mix(in srgb,#9a9a9e 26%,transparent);
|
|
2088
|
+
background:color-mix(in srgb,#9a9a9e 10%,transparent);
|
|
2089
|
+
color:#b9b9bd}
|
|
1989
2090
|
.balance-settings__sync-grid{display:grid;grid-template-columns:auto 1fr;gap:7px 16px;font-size:12px;line-height:1.5;align-items:baseline}
|
|
1990
2091
|
.balance-settings__sync-key{color:#9a9a9e;white-space:nowrap}
|
|
1991
2092
|
.balance-settings__sync-val{color:#e8e8ea}
|
|
@@ -1995,8 +2096,11 @@ window.__ModuleLoader__.load({
|
|
|
1995
2096
|
.balance-settings__sync-sub{display:block;margin-top:1px;font-size:11px;font-weight:400;line-height:16px;color:#9a9a9e;word-break:break-all}
|
|
1996
2097
|
.balance-settings__row-actions{display:flex;align-items:center;gap:8px;justify-content:flex-end}
|
|
1997
2098
|
/* 进度条压成一行(track 左 + label 右):竖排时 track 2px + gap 4px + label 15px = 27px,
|
|
1998
|
-
同步过程中整块卡片会明显抽一下。横排只占 13px,且 label 靠右不挤标题。
|
|
1999
|
-
.balance-
|
|
2099
|
+
同步过程中整块卡片会明显抽一下。横排只占 13px,且 label 靠右不挤标题。
|
|
2100
|
+
⚠️ 它住在 .balance-settings__below 里(块级、不是 flex 子项),所以**不许**再写
|
|
2101
|
+
order / flex —— 2026-11-27 就是靠「flex:1 0 100%」把它当成「能在行内换行的第 4 项」,
|
|
2102
|
+
结果参数传错位置时它挤进 .balance-settings__row,把左边说明文字压成一列竖排单字。 */
|
|
2103
|
+
.balance-settings__progress{display:flex;align-items:center;gap:8px;margin-top:5px;min-height:13px}
|
|
2000
2104
|
/* 轨道很细:它是「还在动」的提示,不该抢走金额和按钮的注意力 */
|
|
2001
2105
|
.balance-settings__progress-track{flex:1 1 auto;min-width:40px;height:2px;border-radius:2px;background:rgba(255,255,255,.08);overflow:hidden}
|
|
2002
2106
|
.balance-settings__progress-fill{height:100%;border-radius:2px;background:rgba(255,255,255,.55);transition:width .35s ease}
|
|
@@ -2004,6 +2108,28 @@ window.__ModuleLoader__.load({
|
|
|
2004
2108
|
.balance-settings__progress-fill--indeterminate{width:35%;animation:balance-progress-scan 1.2s ease-in-out infinite}
|
|
2005
2109
|
@keyframes balance-progress-scan{0%{transform:translateX(-100%)}100%{transform:translateX(300%)}}
|
|
2006
2110
|
.balance-settings__progress-label{flex:0 1 auto;min-width:0;font-size:11px;line-height:13px;color:var(--dsw-alias-label-tertiary,#9a9a9e);text-align:right;font-variant-numeric:tabular-nums;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
2111
|
+
/* 弹窗里那份(2026-11-27 进度条从行内搬进来):轨道粗一档、阶段文案在轨道**上方**左对齐。
|
|
2112
|
+
label 在 DOM 里仍排在轨道后面,靠 order:-1 提到前面 —— 别再靠调换 JSX 顺序改,
|
|
2113
|
+
行内那份万一回来还要用同一套 DOM。 */
|
|
2114
|
+
.balance-settings__progress--dialog{flex-direction:column;align-items:stretch;gap:6px;margin-top:0;min-height:0}
|
|
2115
|
+
.balance-settings__progress--dialog .balance-settings__progress-track{height:6px;border-radius:3px;background:rgba(255,255,255,.10)}
|
|
2116
|
+
.balance-settings__progress--dialog .balance-settings__progress-fill{border-radius:3px;background:rgba(255,255,255,.62)}
|
|
2117
|
+
.balance-settings__progress--dialog .balance-settings__progress-label{order:-1;flex:0 0 auto;font-size:11.5px;line-height:16px;text-align:left}
|
|
2118
|
+
/* 同步弹窗(自绘,不依赖 primitives.Modal)。
|
|
2119
|
+
fixed + portal 到 body:设置卡片挂在 slot 里,自己画遮罩会被祖先的层叠上下文裁掉。
|
|
2120
|
+
⚠️ 2026-11-27 第二轮:进度态与结果态**共用这一个壳**(用户:「两个同步的弹窗用一个窗口
|
|
2121
|
+
不要加载完就换窗口」)。所以宽度一次定死 460px —— 两份内容共用一个壳,壳就不许再变宽变窄,
|
|
2122
|
+
否则「换内容」还是会被看成「换窗口」。结果可能很长(失败时十几行诊断),
|
|
2123
|
+
max-height + 内容区自滚,标题与按钮钉住不动。 */
|
|
2124
|
+
.balance-sync-mask{position:fixed;left:0;top:0;right:0;bottom:0;z-index:2147483000;display:flex;align-items:center;justify-content:center;background:rgba(0,0,0,.48)}
|
|
2125
|
+
.balance-sync-dialog{box-sizing:border-box;width:min(460px,calc(100vw - 48px));max-height:calc(100vh - 64px);padding:18px 20px 16px;border-radius:14px;background:#232324;border:1px solid rgba(255,255,255,.08);box-shadow:0 18px 48px rgba(0,0,0,.45);color:#e8e8ea;text-align:left;display:flex;flex-direction:column}
|
|
2126
|
+
.balance-sync-dialog__title{flex:none;font-size:14px;font-weight:600;line-height:20px;margin-bottom:14px}
|
|
2127
|
+
.balance-sync-dialog__running{flex:none}
|
|
2128
|
+
.balance-sync-dialog__body{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;margin-right:-8px;padding-right:8px}
|
|
2129
|
+
.balance-sync-dialog__note{flex:none;margin-top:14px;font-size:13.5px;line-height:1.65;font-weight:600;color:#f2ab55}
|
|
2130
|
+
.balance-sync-dialog__actions{flex:none;margin-top:16px;display:flex;justify-content:flex-end}
|
|
2131
|
+
.balance-sync-dialog__btn{box-sizing:border-box;appearance:none;border:1px solid rgba(255,255,255,.14);background:rgba(255,255,255,.08);color:#e8e8ea;font-family:inherit;font-size:12px;line-height:18px;padding:5px 14px;border-radius:8px;cursor:pointer}
|
|
2132
|
+
.balance-sync-dialog__btn:hover{background:rgba(255,255,255,.14)}
|
|
2007
2133
|
.balance-settings__mode-mini{display:inline-flex;flex:none;align-items:center;border-radius:6px;background:rgba(255,255,255,.06);padding:1px;gap:1px}
|
|
2008
2134
|
.balance-settings__mode-mini-btn{appearance:none;border:0;background:transparent;color:#9a9a9e;font-size:11px;line-height:16px;padding:1px 7px;border-radius:5px;cursor:pointer;font-family:inherit;transition:background .12s,color .12s}
|
|
2009
2135
|
.balance-settings__mode-mini-btn:hover{color:#e8e8ea}
|
|
@@ -3293,10 +3419,10 @@ const CN_CALENDAR_SOURCES = [
|
|
|
3293
3419
|
["todaySessionLimit", "2.1.0"], // 今日消耗扫描上限:多开对话 / 多跑子代理时把今日汇总算全
|
|
3294
3420
|
["showUsagePill", "2.1.6"], // 2.1.6:消耗行搬成对话界面右下角小浮窗(两行:本会话估算 / 金额)
|
|
3295
3421
|
["diag", "2.2.6"], // 2.2.6:设置页「数据诊断」—— 一键出结论 + 复制 + 查出问题给「修复」
|
|
3296
|
-
["aggCacheMax", "2.3.
|
|
3297
|
-
["syncedPricingAt", "2.3.
|
|
3298
|
-
["syncModePricing", "2.3.
|
|
3299
|
-
["syncModeCalendar", "2.3.
|
|
3422
|
+
["aggCacheMax", "2.3.7"], // 2.3.7:聚合缓存条数上限(原来写死 320,会话多的人装不下)
|
|
3423
|
+
["syncedPricingAt", "2.3.7"], // 2.3.7:一键同步官方价与时段(官网改价不用等插件发版)
|
|
3424
|
+
["syncModePricing", "2.3.7"], // 2.3.7:价格同步走模型还是免费
|
|
3425
|
+
["syncModeCalendar", "2.3.7"], // 2.3.7:节假日同步走模型还是免费
|
|
3300
3426
|
]);
|
|
3301
3427
|
|
|
3302
3428
|
/** NEW_TAGS 的 key → 设置项中文名。横幅要写「本版新增:消耗行加载动效」,
|
|
@@ -3683,9 +3809,13 @@ const CN_CALENDAR_SOURCES = [
|
|
|
3683
3809
|
return calendarInFlight;
|
|
3684
3810
|
}
|
|
3685
3811
|
|
|
3686
|
-
/** 手动同步:POST 让服务端去拉当年 ±1 年的国务院公告并落盘。
|
|
3687
|
-
|
|
3688
|
-
|
|
3812
|
+
/** 手动同步:POST 让服务端去拉当年 ±1 年的国务院公告并落盘。
|
|
3813
|
+
* `mode` 必须跟着请求走(2026-11-27:「我选的免费怎么还消耗我都token」):
|
|
3814
|
+
* 设置页的开关是 350ms 防抖保存,点完「免费」立刻点同步时保存请求还没落,
|
|
3815
|
+
* 服务端读已保存的设置就会照模型路径烧 token。带在 query 里以眼前的选择为准。 */
|
|
3816
|
+
async function syncCalendar(mode) {
|
|
3817
|
+
const q = mode === "free" || mode === "model" ? "&mode=" + mode : "";
|
|
3818
|
+
const res = await fetch("/balance-api?calendar=1" + q, {
|
|
3689
3819
|
method: "POST",
|
|
3690
3820
|
headers: { accept: "application/json" },
|
|
3691
3821
|
});
|
|
@@ -3724,6 +3854,101 @@ const CN_CALENDAR_SOURCES = [
|
|
|
3724
3854
|
return Math.min(100, Math.max(0, ((done + w) / total) * 100));
|
|
3725
3855
|
}
|
|
3726
3856
|
|
|
3857
|
+
/** 同步弹窗(自绘,portal 到 body)。
|
|
3858
|
+
* 为什么不用官方 `primitives.Modal`:2026-11-27 用户报「并没有弹窗啊」——
|
|
3859
|
+
* 这条路在官方 Modal 上查不到原因(模块能 require、导出里确实有 Modal、
|
|
3860
|
+
* 结果弹窗也一直用它)。而「同步中」这张是唯一**必须一开跑就出现**的反馈,
|
|
3861
|
+
* 赌不起,所以自己画:官方 Modal 在不在都不影响它。
|
|
3862
|
+
* Esc / 点遮罩 / 点按钮都只是**收起窗口**,不中断服务端那趟同步。
|
|
3863
|
+
*
|
|
3864
|
+
* ⚠️ 2026-11-27 第二轮:用户「两个同步的弹窗用一个窗口 不要加载完就换窗口」。
|
|
3865
|
+
* 原来是「进度一张自绘窗、结果一张官方 Modal」—— 壳不同、位置不同、大小不同,
|
|
3866
|
+
* 同步一结束就是关一张开一张,看着像换了窗口。现在**壳只此一个**:
|
|
3867
|
+
* `phase === "running"` 时渲染进度条,`phase === "result"` 时渲染 `children`
|
|
3868
|
+
* (结果 / 报错内容)。标题、按钮文案由调用方按阶段给,窗口本体不重建、不换位。
|
|
3869
|
+
* 所以 `open` 要写成「弹窗开关 && kind 不是 idle」,别在结果阶段把它关掉。 */
|
|
3870
|
+
const SyncProgressDialog = (props) => {
|
|
3871
|
+
const open = props.open === true;
|
|
3872
|
+
const onClose = typeof props.onClose === "function" ? props.onClose : () => {};
|
|
3873
|
+
// ⚠️ 同步中**锁住弹窗**(2026-11-27 用户:「不要后台同步 因为有人以为后台同步就可以
|
|
3874
|
+
// 切到对话了 一定告诫用户不要离开这个弹窗」)。原来进度态那颗按钮叫「后台同步」,
|
|
3875
|
+
// 点了就关窗、同步照跑 —— 用户会读成「可以切去对话了」,走了就再也看不到进度和结果。
|
|
3876
|
+
// 现在进度态**根本不给按钮**,Esc 与点遮罩也不关;只有结果态能关(「知道了」)。
|
|
3877
|
+
// 代价是同步期间关不掉窗口,但同步本身有服务端超时,而「误以为能走」是实打实的坑。
|
|
3878
|
+
// ⚠️ result / locked 必须写在 useEffect **之前**(effect 里要用 locked,且 hook 顺序固定)。
|
|
3879
|
+
const result = props.phase === "result";
|
|
3880
|
+
const locked = !result;
|
|
3881
|
+
// hook 必须写在任何 return 之前(铁律 2)。
|
|
3882
|
+
react.useEffect(() => {
|
|
3883
|
+
if (!open || locked) return undefined;
|
|
3884
|
+
const onKey = (event) => {
|
|
3885
|
+
if (event && event.key === "Escape") onClose();
|
|
3886
|
+
};
|
|
3887
|
+
document.addEventListener("keydown", onKey);
|
|
3888
|
+
return () => document.removeEventListener("keydown", onKey);
|
|
3889
|
+
}, [open, locked, onClose]);
|
|
3890
|
+
if (!open) return null;
|
|
3891
|
+
const pct = Number(props.pct) || 0;
|
|
3892
|
+
const scanning = !result && (props.indeterminate === true || pct <= 0);
|
|
3893
|
+
const node = jsx.jsxs("div", {
|
|
3894
|
+
className: "balance-sync-mask",
|
|
3895
|
+
onClick: locked ? undefined : onClose,
|
|
3896
|
+
children: [
|
|
3897
|
+
jsx.jsxs("div", {
|
|
3898
|
+
className: "balance-sync-dialog",
|
|
3899
|
+
onClick: (event) => {
|
|
3900
|
+
if (event && typeof event.stopPropagation === "function") event.stopPropagation();
|
|
3901
|
+
},
|
|
3902
|
+
children: [
|
|
3903
|
+
jsx.jsx("div", { className: "balance-sync-dialog__title", children: props.title || "正在同步" }),
|
|
3904
|
+
// 进度态与结果态**共用这一个壳**,只在中间这段换内容:
|
|
3905
|
+
// 结果可能很长(失败时十几行诊断),所以内容区自己滚,标题和按钮钉住。
|
|
3906
|
+
result
|
|
3907
|
+
? jsx.jsx("div", { className: "balance-sync-dialog__body", children: props.children })
|
|
3908
|
+
: jsx.jsxs("div", {
|
|
3909
|
+
className: "balance-sync-dialog__running",
|
|
3910
|
+
children: [
|
|
3911
|
+
jsx.jsxs("div", {
|
|
3912
|
+
className: "balance-settings__progress balance-settings__progress--dialog",
|
|
3913
|
+
children: [
|
|
3914
|
+
jsx.jsx("div", {
|
|
3915
|
+
className: "balance-settings__progress-track",
|
|
3916
|
+
children: jsx.jsx("div", {
|
|
3917
|
+
className:
|
|
3918
|
+
"balance-settings__progress-fill"
|
|
3919
|
+
+ (scanning ? " balance-settings__progress-fill--indeterminate" : ""),
|
|
3920
|
+
style: scanning ? undefined : { width: pct + "%" },
|
|
3921
|
+
}),
|
|
3922
|
+
}),
|
|
3923
|
+
jsx.jsx("span", {
|
|
3924
|
+
className: "balance-settings__progress-label",
|
|
3925
|
+
children: props.label || "正在同步…",
|
|
3926
|
+
}),
|
|
3927
|
+
],
|
|
3928
|
+
}),
|
|
3929
|
+
jsx.jsx("div", { className: "balance-sync-dialog__note", children: props.note || "" }),
|
|
3930
|
+
],
|
|
3931
|
+
}),
|
|
3932
|
+
// 进度态没有按钮:不给「后台同步」这类会被读成「可以走了」的出口。
|
|
3933
|
+
locked
|
|
3934
|
+
? null
|
|
3935
|
+
: jsx.jsx("div", {
|
|
3936
|
+
className: "balance-sync-dialog__actions",
|
|
3937
|
+
children: jsx.jsx("button", {
|
|
3938
|
+
type: "button",
|
|
3939
|
+
className: "balance-sync-dialog__btn",
|
|
3940
|
+
onClick: onClose,
|
|
3941
|
+
children: props.closeLabel || "知道了",
|
|
3942
|
+
}),
|
|
3943
|
+
}),
|
|
3944
|
+
],
|
|
3945
|
+
}),
|
|
3946
|
+
],
|
|
3947
|
+
});
|
|
3948
|
+
// 没有 body(非浏览器环境)时退回内联节点,绝不抛错。
|
|
3949
|
+
return typeof document !== "undefined" && document.body ? createPortal(node, document.body) : node;
|
|
3950
|
+
};
|
|
3951
|
+
|
|
3727
3952
|
function emitSettings() {
|
|
3728
3953
|
// 逐个订阅者隔离:设置热更新必须送达所有订阅者。
|
|
3729
3954
|
for (const listener of settingsListeners) {
|
|
@@ -4728,20 +4953,32 @@ const WEB_TOOL_FREE_FROM = Date.parse("2026-11-18T12:00:00+08:00");
|
|
|
4728
4953
|
* ⚠️ 位置没变时必须返回同一个对象,否则 RO 回调 → setState → 重渲染 →
|
|
4729
4954
|
* 尺寸变化 → RO 回调,转成死循环。 */
|
|
4730
4955
|
const place = react.useCallback(() => {
|
|
4731
|
-
if (!anchorRect) return;
|
|
4732
4956
|
const el = ref.current;
|
|
4733
4957
|
if (el == null) return;
|
|
4734
4958
|
const vw = typeof window === "undefined" ? 1200 : window.innerWidth;
|
|
4735
4959
|
const vh = typeof window === "undefined" ? 800 : window.innerHeight;
|
|
4736
4960
|
const w = el.offsetWidth > 0 ? el.offsetWidth : Math.min(wide ? 498 : 330, vw - 20);
|
|
4737
4961
|
const h = el.offsetHeight > 0 ? el.offsetHeight : 260;
|
|
4962
|
+
// ⚠️ `anchorRect` **允许为空**(2026-11-27:「这个小浮窗直接不显示了」)。
|
|
4963
|
+
// 点开时热区可能那一刻量不到矩形:`rectOf` 对 0×0 的元素返回 null,
|
|
4964
|
+
// 折叠中的侧栏、入场动画中途、刚切完会话的那一帧都会这样;
|
|
4965
|
+
// 调用处 `rectOf(el) ?? rectOf(event.currentTarget)` 两个都 null 就传进来 null。
|
|
4966
|
+
// 原来这里第一行是 `if (!anchorRect) return;` —— 于是 box 永远是 null、
|
|
4967
|
+
// 面板永远停在 left:-9999px + visibility:hidden,**看起来就是点了没反应**。
|
|
4968
|
+
// 那个成因当时没能向用户确证,所以不再赌任何一条路径:拿不到锚点就落在
|
|
4969
|
+
// 视口中部偏下,保证**只要组件渲染出来就一定可见、可读、可关**。
|
|
4970
|
+
const num = (v) => typeof v === "number" && Number.isFinite(v);
|
|
4971
|
+
const anchor = anchorRect != null && num(anchorRect.top) && num(anchorRect.bottom)
|
|
4972
|
+
&& num(anchorRect.left) && num(anchorRect.width)
|
|
4973
|
+
? anchorRect
|
|
4974
|
+
: { left: Math.round(vw / 2), width: 0, top: Math.round(vh * 0.62), bottom: Math.round(vh * 0.62) };
|
|
4738
4975
|
// GAP 让开小三角(自身 11px、旋转后探出约 6px)+ 4px 呼吸。
|
|
4739
4976
|
// 原来 10 太紧,内容一高就贴到 anchor 脸上。
|
|
4740
4977
|
const GAP = 12;
|
|
4741
|
-
const wantTop =
|
|
4978
|
+
const wantTop = anchor.top - GAP - h;
|
|
4742
4979
|
const above = wantTop >= 8;
|
|
4743
|
-
const top = above ? wantTop : Math.min(vh - h - 8,
|
|
4744
|
-
const cx =
|
|
4980
|
+
const top = above ? wantTop : Math.min(vh - h - 8, anchor.bottom + GAP);
|
|
4981
|
+
const cx = anchor.left + anchor.width / 2;
|
|
4745
4982
|
const left = Math.max(8, Math.min(vw - w - 8, cx - w / 2));
|
|
4746
4983
|
const next = {
|
|
4747
4984
|
left: Math.round(left),
|
|
@@ -4843,6 +5080,50 @@ const WEB_TOOL_FREE_FROM = Date.parse("2026-11-18T12:00:00+08:00");
|
|
|
4843
5080
|
});
|
|
4844
5081
|
}
|
|
4845
5082
|
|
|
5083
|
+
/** 反推服务端 steps 的切分粒度(分钟)。
|
|
5084
|
+
*
|
|
5085
|
+
* 什么时候需要它:服务端**没给** `stepMin`(旧快照 / 旧服务端 / 某条 return 分支漏发字段),
|
|
5086
|
+
* 而 `step` 号本身又不可能自己说明单位 —— 把 3 分钟粒度的 step 当分钟读,
|
|
5087
|
+
* 一整天的消耗会全挤进前面几分之一,曲线陡升后拉成一条平线。
|
|
5088
|
+
* (2026-11-27 真踩:`readTodaySnapshot` 漏了 `stepMin`,5.8 小时的消耗被压进前 1.95 小时,
|
|
5089
|
+
* 用户原话「好像在加载 导致全集在前面了」。)
|
|
5090
|
+
*
|
|
5091
|
+
* 判据是**逐小时对账**:`hourly[i]` 是第 i 小时的钱、`steps` 是更细的同一份钱,
|
|
5092
|
+
* 按粒度 g 把每个 step 换算成时刻 `step*g` 分钟,落在第 i 小时内的那些加起来就该等于 `hourly[i]`。
|
|
5093
|
+
* 取让这个误差最小的 g。
|
|
5094
|
+
*
|
|
5095
|
+
* ⚠️ 别改成「看最后一个 step 落不落在最后一个有钱的小时里」—— 凌晨判不出来:
|
|
5096
|
+
* 00:30 时 1 分钟(step 30)和 3 分钟(step 10)都能落在第 0 小时里,两种都满足。
|
|
5097
|
+
* 对账用的是**全部 24 小时**的分布,凌晨也有区分度。
|
|
5098
|
+
*
|
|
5099
|
+
* 候选只放能整除 1440 的,且从小到大;误差相同取小的(宁可细一点,别把数据铺到明天去)。 */
|
|
5100
|
+
function inferStepMin(rows, byHour) {
|
|
5101
|
+
const CANDS = [1, 3, 5, 6, 10, 12, 15, 20, 30, 60];
|
|
5102
|
+
if (!Array.isArray(rows) || rows.length === 0) return 1;
|
|
5103
|
+
const hours = Array.isArray(byHour) ? byHour : [];
|
|
5104
|
+
const hourSum = hours.reduce((s, v) => s + (Number(v) || 0), 0);
|
|
5105
|
+
// hourly 也是空的(或全是 0)就没有对账的基准,只能按最细的来
|
|
5106
|
+
if (!(hourSum > 1e-9)) return 1;
|
|
5107
|
+
let best = 1;
|
|
5108
|
+
let bestErr = Infinity;
|
|
5109
|
+
for (const g of CANDS) {
|
|
5110
|
+
const per = new Array(24).fill(0);
|
|
5111
|
+
for (const r of rows) {
|
|
5112
|
+
const h = Math.floor((r.step * g) / 60);
|
|
5113
|
+
if (h >= 0 && h < 24) per[h] += r.cost;
|
|
5114
|
+
}
|
|
5115
|
+
let err = 0;
|
|
5116
|
+
for (let h = 0; h < 24; h += 1) err += Math.abs(per[h] - (Number(hours[h]) || 0));
|
|
5117
|
+
// 相对误差:额大的一天和额小的一天不能用同一个绝对值门槛
|
|
5118
|
+
const rel = err / hourSum;
|
|
5119
|
+
if (rel < bestErr - 1e-9) {
|
|
5120
|
+
bestErr = rel;
|
|
5121
|
+
best = g;
|
|
5122
|
+
}
|
|
5123
|
+
}
|
|
5124
|
+
return best;
|
|
5125
|
+
}
|
|
5126
|
+
|
|
4846
5127
|
/** 今日各对话花了多少:按金额降序,末位单列插件自耗(同步费不属于任何会话)。 */
|
|
4847
5128
|
function TodayBreakdown({ today, onClose, anchorRect, bare }) {
|
|
4848
5129
|
const rows = react.useMemo(() => {
|
|
@@ -4860,6 +5141,113 @@ const WEB_TOOL_FREE_FROM = Date.parse("2026-11-18T12:00:00+08:00");
|
|
|
4860
5141
|
list.sort((a, b) => b.cost - a.cost);
|
|
4861
5142
|
return list;
|
|
4862
5143
|
}, [today]);
|
|
5144
|
+
// 父级分组栏的展开状态:`{ [父级目录名]: true }` 表示这一组**被收起**。
|
|
5145
|
+
// ⚠️ 只记「被点过」的组 → 新出现的组天然是展开的,不需要初始化。
|
|
5146
|
+
// ⚠️ hooks 必须都在第一个 return 之前(bare 分支在下面 60 行处 early return)。
|
|
5147
|
+
const [collapsedGroups, setCollapsedGroups] = react.useState({});
|
|
5148
|
+
const toggleGroup = react.useCallback((key) => {
|
|
5149
|
+
setCollapsedGroups((prev) => ({ ...prev, [key]: prev[key] !== true }));
|
|
5150
|
+
}, []);
|
|
5151
|
+
// ─── 行的悬停提示(自绘,不用原生 title)──────────────────────────────
|
|
5152
|
+
// 会话行悬停显示**完整标题 + 会话 ID**(2026-11-27 用户:「我说的小浮窗是
|
|
5153
|
+
// 鼠标悬停时显示的码」—— 就是那个 UUID);「插件同步 / 网页工具」悬停显示口径解释。
|
|
5154
|
+
// 位置放在行**下方**、左对齐再夹进视口:行宽就是整个面板,居中对齐会把提示
|
|
5155
|
+
// 甩到面板正中、跟鼠标离得很远。快到窗口底部时翻到行的上方。
|
|
5156
|
+
const [rowTip, setRowTip] = react.useState(null);
|
|
5157
|
+
const showRowTip = react.useCallback((event, title, sub) => {
|
|
5158
|
+
const el = event && event.currentTarget;
|
|
5159
|
+
if (el == null || typeof el.getBoundingClientRect !== "function") return;
|
|
5160
|
+
const r = el.getBoundingClientRect();
|
|
5161
|
+
const vw0 = typeof window === "undefined" ? 1200 : window.innerWidth;
|
|
5162
|
+
const vh0 = typeof window === "undefined" ? 800 : window.innerHeight;
|
|
5163
|
+
const above = r.bottom + 6 > vh0 - 56;
|
|
5164
|
+
setRowTip({
|
|
5165
|
+
title,
|
|
5166
|
+
sub: sub || "",
|
|
5167
|
+
above,
|
|
5168
|
+
top: above ? Math.max(8, r.top - 6) : r.bottom + 6,
|
|
5169
|
+
left: Math.max(8, Math.min(vw0 - 348, r.left)),
|
|
5170
|
+
});
|
|
5171
|
+
}, []);
|
|
5172
|
+
const hideRowTip = react.useCallback(() => setRowTip(null), []);
|
|
5173
|
+
// 父级(会话所在的项目目录):服务端给 `{ [会话键]: { key, label } }`。
|
|
5174
|
+
// 取不到就整表平铺 —— 分组只是展示,缺信息不该影响金额。
|
|
5175
|
+
const parents = today && today.sessionParents && typeof today.sessionParents === "object"
|
|
5176
|
+
? today.sessionParents
|
|
5177
|
+
: {};
|
|
5178
|
+
/** 按父级归组,并保持「金额降序」这个原有次序:组的次序 = 组内最贵那条的次序。 */
|
|
5179
|
+
const groups = react.useMemo(() => {
|
|
5180
|
+
const list = [];
|
|
5181
|
+
const byKey = new Map();
|
|
5182
|
+
for (const r of rows) {
|
|
5183
|
+
const p = parents[r.id];
|
|
5184
|
+
// ⚠️ 拿不到父级的会话**各自成组**(key 带上自己的 id),不能都塞进同一个 "" 组:
|
|
5185
|
+
// 不然两个无主会话会被当成「同一父级」收进一个折叠栏里,那个栏的名字还没法起。
|
|
5186
|
+
const key = p != null && typeof p.key === "string" && p.key !== "" ? p.key : "?" + r.id;
|
|
5187
|
+
let g = byKey.get(key);
|
|
5188
|
+
if (g === undefined) {
|
|
5189
|
+
g = {
|
|
5190
|
+
key,
|
|
5191
|
+
label: p != null && typeof p.label === "string" ? p.label : "",
|
|
5192
|
+
rows: [],
|
|
5193
|
+
cost: 0,
|
|
5194
|
+
};
|
|
5195
|
+
byKey.set(key, g);
|
|
5196
|
+
list.push(g);
|
|
5197
|
+
}
|
|
5198
|
+
g.rows.push(r);
|
|
5199
|
+
g.cost += r.cost;
|
|
5200
|
+
}
|
|
5201
|
+
return list;
|
|
5202
|
+
}, [rows, parents]);
|
|
5203
|
+
/** 一条会话行。nested=true 时缩进,挂在组头下面。 */
|
|
5204
|
+
const sessionRow = (r, nested) => jsx.jsxs("div", {
|
|
5205
|
+
className: "balance-pop__row" + (nested === true ? " balance-pop__row--nested" : ""),
|
|
5206
|
+
// 悬停给完整标题 + 会话 ID:标题在行内被 ellipsis 截掉时,这里是唯一看全的地方
|
|
5207
|
+
onMouseEnter: (event) => showRowTip(event, r.title, r.id),
|
|
5208
|
+
onMouseLeave: hideRowTip,
|
|
5209
|
+
children: [
|
|
5210
|
+
jsx.jsx("span", { className: "balance-pop__swatch" }),
|
|
5211
|
+
jsx.jsx("span", { className: "balance-pop__name", children: r.title }),
|
|
5212
|
+
jsx.jsx("span", { className: "balance-pop__meta", children: popTokens(r.tokens) }),
|
|
5213
|
+
jsx.jsx("span", { className: "balance-pop__amount", children: popMoney(r.cost) }),
|
|
5214
|
+
],
|
|
5215
|
+
}, r.id);
|
|
5216
|
+
// 一个父级下只有**一个**会话时不画组头 —— 多一层壳只是噪音,平铺更好读。
|
|
5217
|
+
// 两个以上才折叠:组头写父级名 + 会话数 + 该组合计,点一下收起 / 展开。
|
|
5218
|
+
const groupNodes = groups.map((g) => {
|
|
5219
|
+
if (g.rows.length <= 1) return sessionRow(g.rows[0], false);
|
|
5220
|
+
const open = collapsedGroups[g.key] !== true;
|
|
5221
|
+
return jsx.jsxs("div", {
|
|
5222
|
+
className: "balance-pop__group-block",
|
|
5223
|
+
children: [
|
|
5224
|
+
jsx.jsxs("div", {
|
|
5225
|
+
className: "balance-pop__group" + (open ? " balance-pop__group--open" : ""),
|
|
5226
|
+
role: "button",
|
|
5227
|
+
tabIndex: 0,
|
|
5228
|
+
onClick: () => toggleGroup(g.key),
|
|
5229
|
+
onKeyDown: (e) => {
|
|
5230
|
+
if (e && (e.key === "Enter" || e.key === " ")) {
|
|
5231
|
+
if (typeof e.preventDefault === "function") e.preventDefault();
|
|
5232
|
+
toggleGroup(g.key);
|
|
5233
|
+
}
|
|
5234
|
+
},
|
|
5235
|
+
children: [
|
|
5236
|
+
jsx.jsx("span", { className: "balance-pop__group-caret" }),
|
|
5237
|
+
jsx.jsx("span", {
|
|
5238
|
+
className: "balance-pop__group-name",
|
|
5239
|
+
children: g.label !== "" ? g.label : "其他会话",
|
|
5240
|
+
}),
|
|
5241
|
+
jsx.jsx("span", {
|
|
5242
|
+
className: "balance-pop__group-meta",
|
|
5243
|
+
children: g.rows.length + " 个会话 · " + popMoney(g.cost),
|
|
5244
|
+
}),
|
|
5245
|
+
],
|
|
5246
|
+
}),
|
|
5247
|
+
open ? g.rows.map((r) => sessionRow(r, true)) : null,
|
|
5248
|
+
],
|
|
5249
|
+
}, "g:" + g.key);
|
|
5250
|
+
});
|
|
4863
5251
|
const pluginCost = Number(today && today.pluginCost) || 0;
|
|
4864
5252
|
const pluginCalls = Number(today && today.pluginCalls) || 0;
|
|
4865
5253
|
// 网页工具费:同样不在任何会话账上。不单列的话「合计 − 会话 − 同步」会剩一截
|
|
@@ -4874,34 +5262,32 @@ const WEB_TOOL_FREE_FROM = Date.parse("2026-11-18T12:00:00+08:00");
|
|
|
4874
5262
|
+ (webCost > 1e-9 ? " + 工具 " + popMoney(webCost) : "") + ")";
|
|
4875
5263
|
const body = rows.length === 0 && pluginCost <= 0
|
|
4876
5264
|
? jsx.jsx("div", { className: "balance-pop__empty", children: "今天还没有消耗" })
|
|
4877
|
-
: jsx.jsxs(
|
|
5265
|
+
: jsx.jsxs("div", {
|
|
5266
|
+
// ⚠️ 2026-11-27 用户:「每行显示两个」—— 会话行改成**两列网格**,一屏能多看几条。
|
|
5267
|
+
// 只有「单会话、无组头」的裸会话行才占一格;组头块和下面两条整行计费项
|
|
5268
|
+
// (插件同步 / 网页工具)都靠 CSS `grid-column:1/-1` 横跨整行。
|
|
5269
|
+
// `--one`:今天只有一条会话时让它独占整行,别留半格空白。
|
|
5270
|
+
className: "balance-pop__grid" + (rows.length <= 1 ? " balance-pop__grid--one" : ""),
|
|
4878
5271
|
children: [
|
|
4879
|
-
rows.map(
|
|
4880
|
-
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
? jsx.jsxs("div", {
|
|
4891
|
-
className: "balance-pop__row",
|
|
4892
|
-
title: "价格 / 节假日同步时插件自己发的模型调用(不在任何会话里)",
|
|
4893
|
-
children: [
|
|
4894
|
-
jsx.jsx("span", { className: "balance-pop__swatch balance-pop__swatch--plugin" }),
|
|
4895
|
-
jsx.jsx("span", { className: "balance-pop__name", children: "插件同步" }),
|
|
4896
|
-
jsx.jsx("span", { className: "balance-pop__meta", children: pluginCalls + " 次" }),
|
|
4897
|
-
jsx.jsx("span", { className: "balance-pop__amount", children: popMoney(pluginCost) }),
|
|
4898
|
-
],
|
|
4899
|
-
}, "__plugin")
|
|
4900
|
-
: null,
|
|
5272
|
+
// ⚠️ 这里原来是直接 `rows.map(...)` 平铺。现在改成分组节点:
|
|
5273
|
+
// 同一父级(项目目录)下有多个会话时,先出一行可展开 / 收起的组头,
|
|
5274
|
+
// 组内会话行缩进挂在下面(2026-11-27 用户:「如果父级是一样的
|
|
5275
|
+
// 添加一个展开和收起的栏」)。只有一个会话的父级不画组头。
|
|
5276
|
+
// 会话行本身用 `sessionRow()` 生成,别在 JSX 里再内联一份 ——
|
|
5277
|
+
// 两处渲染同一个行结构,改一处漏一处的坑踩过。
|
|
5278
|
+
groupNodes,
|
|
5279
|
+
// ⚠️ **顺序:网页工具在前、插件同步收尾**(2026-11-27 用户:「插件同步计费默认最低端」)
|
|
5280
|
+
// ——「最低端」是**位置**,不是价格档。原来插件同步在前、网页工具在后,
|
|
5281
|
+
// 两者都在时插件同步就成了倒数第二,和「末位单列插件自耗」的约定不符。
|
|
5282
|
+
// 插件同步是今天所有会话之外的最后一笔(插件自己烧的),放最底下一眼能扫到。
|
|
4901
5283
|
webCost > 1e-9
|
|
4902
5284
|
? jsx.jsxs("div", {
|
|
4903
|
-
className: "balance-pop__row",
|
|
4904
|
-
|
|
5285
|
+
className: "balance-pop__row balance-pop__row--full",
|
|
5286
|
+
// 原来这里也有原生 title(解释按次计费),同一天被删干净了;
|
|
5287
|
+
// 现在改自绘提示。
|
|
5288
|
+
onMouseEnter: (event) => showRowTip(event, "网页工具",
|
|
5289
|
+
"网页搜索 / 网页抓取按次计费,¥0.005 / 次,不乘峰谷倍率"),
|
|
5290
|
+
onMouseLeave: hideRowTip,
|
|
4905
5291
|
children: [
|
|
4906
5292
|
jsx.jsx("span", { className: "balance-pop__swatch balance-pop__swatch--web" }),
|
|
4907
5293
|
jsx.jsx("span", { className: "balance-pop__name", children: "网页工具" }),
|
|
@@ -4910,8 +5296,43 @@ const WEB_TOOL_FREE_FROM = Date.parse("2026-11-18T12:00:00+08:00");
|
|
|
4910
5296
|
],
|
|
4911
5297
|
}, "__web")
|
|
4912
5298
|
: null,
|
|
5299
|
+
pluginCost > 0
|
|
5300
|
+
? jsx.jsxs("div", {
|
|
5301
|
+
className: "balance-pop__row balance-pop__row--full",
|
|
5302
|
+
// 「N 次」是**模型调用次数**,不是「你点了几次同步」(2026-11-27 用户:
|
|
5303
|
+
// 「为什么我点一次同步它算两次」)。节假日同步按年份循环,补几年就调几次模型:
|
|
5304
|
+
// 11 月之后要补「今年 + 明年」两年 → 点一次 = 2 次调用 = 2 笔 token。
|
|
5305
|
+
// 价格同步是一次抓取 + 最多一次模型解析,所以通常只记 1 次。
|
|
5306
|
+
// ⚠️ 这段解释原来在**原生 title** 里(灰框、不跟主题),2026-11-27 先被删干净、
|
|
5307
|
+
// 用户随即报「这个小浮窗直接不显示了」—— 现在改成自绘提示(showRowTip)。
|
|
5308
|
+
onMouseEnter: (event) => showRowTip(event, "插件同步",
|
|
5309
|
+
"「N 次」是模型调用次数:节假日按年份逐年调模型,11 月前后要补今年 + 明年,点一次会记 2 次"),
|
|
5310
|
+
onMouseLeave: hideRowTip,
|
|
5311
|
+
children: [
|
|
5312
|
+
jsx.jsx("span", { className: "balance-pop__swatch balance-pop__swatch--plugin" }),
|
|
5313
|
+
jsx.jsx("span", { className: "balance-pop__name", children: "插件同步" }),
|
|
5314
|
+
jsx.jsx("span", { className: "balance-pop__meta", children: pluginCalls + " 次调用" }),
|
|
5315
|
+
jsx.jsx("span", { className: "balance-pop__amount", children: popMoney(pluginCost) }),
|
|
5316
|
+
],
|
|
5317
|
+
}, "__plugin")
|
|
5318
|
+
: null,
|
|
4913
5319
|
],
|
|
4914
5320
|
});
|
|
5321
|
+
// 悬停提示挂 portal:面板 overflow:hidden,贴行下方渲染会被裁掉。
|
|
5322
|
+
// createPortal 不是 hook,放在 early return 之前之后都安全。
|
|
5323
|
+
const rowTipNode = rowTip === null || typeof document === "undefined"
|
|
5324
|
+
? null
|
|
5325
|
+
: createPortal(jsx.jsx("div", {
|
|
5326
|
+
className: "balance-pop__code-tip" + (rowTip.above ? " balance-pop__code-tip--above" : ""),
|
|
5327
|
+
style: { top: rowTip.top + "px", left: rowTip.left + "px" },
|
|
5328
|
+
role: "tooltip",
|
|
5329
|
+
children: [
|
|
5330
|
+
jsx.jsx("span", { className: "balance-pop__code-tip-title", children: rowTip.title }),
|
|
5331
|
+
rowTip.sub !== ""
|
|
5332
|
+
? jsx.jsx("span", { className: "balance-pop__code-tip-sub", children: rowTip.sub })
|
|
5333
|
+
: null,
|
|
5334
|
+
],
|
|
5335
|
+
}), document.body);
|
|
4915
5336
|
// bare:只给内容,不套弹窗壳 —— 合并进「今日消耗时间线」那个面板时用
|
|
4916
5337
|
// (2026-11-27 用户:「这两个浮窗合并吧 然后这两个选中改成整体」)。
|
|
4917
5338
|
// ⚠️ 必须排在 useMemo 之后:这里 early return,hook 一条都不能漏在前面。
|
|
@@ -4929,6 +5350,7 @@ const WEB_TOOL_FREE_FROM = Date.parse("2026-11-18T12:00:00+08:00");
|
|
|
4929
5350
|
})
|
|
4930
5351
|
: null,
|
|
4931
5352
|
body,
|
|
5353
|
+
rowTipNode,
|
|
4932
5354
|
],
|
|
4933
5355
|
});
|
|
4934
5356
|
}
|
|
@@ -4937,7 +5359,7 @@ const WEB_TOOL_FREE_FROM = Date.parse("2026-11-18T12:00:00+08:00");
|
|
|
4937
5359
|
title: "今日消耗明细",
|
|
4938
5360
|
subtitle,
|
|
4939
5361
|
onClose,
|
|
4940
|
-
children: body,
|
|
5362
|
+
children: [body, rowTipNode],
|
|
4941
5363
|
});
|
|
4942
5364
|
}
|
|
4943
5365
|
|
|
@@ -5017,19 +5439,34 @@ const WEB_TOOL_FREE_FROM = Date.parse("2026-11-18T12:00:00+08:00");
|
|
|
5017
5439
|
if (!Number.isInteger(h) || h < 0 || h > 23) continue;
|
|
5018
5440
|
byHour[h] += Number(slot && slot.cost) || 0;
|
|
5019
5441
|
}
|
|
5020
|
-
//
|
|
5442
|
+
// 分钟级粒度(服务端 byStep):钱**真正发生在哪一格**就落在哪一格。
|
|
5021
5443
|
// 原来只有 hourly,只能把整小时的量平均摊成 12 段 —— 长时间没动、10:11 突然花一笔,
|
|
5022
5444
|
// 摊完就成了「10:00 起匀速爬坡」,和事实不符
|
|
5023
5445
|
// (2026-11-27 用户:「有的时候不用平摊 比如 我很长时间没用 但是在10:11分产生消耗
|
|
5024
5446
|
// 就要指定在这个时间段」)。有 steps 就按它落位,没有才退回平摊。
|
|
5025
|
-
|
|
5447
|
+
// ⚠️ 粒度**以服务端为准**(响应里的 `stepMin`),不写死。2026-11-27 服务端从 1 分钟
|
|
5448
|
+
// 改成 3 分钟(用户:「改成3分钟粒度吧 减轻性能开销」,折线点数 1441 → 481),
|
|
5449
|
+
// 但如果只刷新页面、没重启 DSH,服务端还是旧的 1 分钟 —— 写死 3 会让每一笔
|
|
5450
|
+
// 三倍错位(第 100 分钟的钱跑到第 300 分钟)。
|
|
5451
|
+
// ⚠️ 但**读不到也不能一律按 1 分钟**:服务端的快照路径(readTodaySnapshot)一度漏发
|
|
5452
|
+
// `stepMin`,于是 3 分钟粒度的 step 0~116 被当成「第 0~116 分钟」,
|
|
5453
|
+
// 5.8 小时的消耗全挤进前 1.95 小时 → 曲线陡升后拉成一条平线
|
|
5454
|
+
// (2026-11-27 用户:「好像在加载 导致全集在前面了」)。
|
|
5455
|
+
// 所以读不到就**反推**:拿 steps 按候选粒度铺开,跟 hourly 逐小时对账,取最吻合的那个。
|
|
5456
|
+
const stepMinRaw = Math.round(Number(today && today.stepMin));
|
|
5457
|
+
const rawSteps = (Array.isArray(today && today.steps) ? today.steps : [])
|
|
5458
|
+
.map((it) => ({ step: Math.floor(Number(it && it.step)), cost: Number(it && it.cost) || 0 }))
|
|
5459
|
+
.filter((r) => Number.isInteger(r.step) && r.step >= 0 && Math.abs(r.cost) >= 1e-12);
|
|
5460
|
+
const STEP_MIN = stepMinRaw > 0 && 1440 % stepMinRaw === 0
|
|
5461
|
+
? stepMinRaw
|
|
5462
|
+
: inferStepMin(rawSteps, byHour);
|
|
5463
|
+
const STEPS_PER_HOUR = Math.round(60 / STEP_MIN);
|
|
5464
|
+
const STEPS = STEPS_PER_HOUR * 24;
|
|
5465
|
+
const stepCost = new Array(STEPS).fill(0);
|
|
5026
5466
|
let hasStepData = false;
|
|
5027
|
-
for (const
|
|
5028
|
-
|
|
5029
|
-
|
|
5030
|
-
const v = Number(it && it.cost) || 0;
|
|
5031
|
-
if (Math.abs(v) < 1e-12) continue;
|
|
5032
|
-
stepCost5[k] += v;
|
|
5467
|
+
for (const r of rawSteps) {
|
|
5468
|
+
if (r.step >= STEPS) continue;
|
|
5469
|
+
stepCost[r.step] += r.cost;
|
|
5033
5470
|
hasStepData = true;
|
|
5034
5471
|
}
|
|
5035
5472
|
// 差额**按比例**摊到有消耗的小时上:hourly 只统计会话消耗,今日总额里还有同步费用
|
|
@@ -5041,47 +5478,29 @@ const WEB_TOOL_FREE_FROM = Date.parse("2026-11-18T12:00:00+08:00");
|
|
|
5041
5478
|
const dayTotal = Number(today && today.cost) || 0;
|
|
5042
5479
|
const hourlySum = byHour.reduce((s, v) => s + v, 0);
|
|
5043
5480
|
const scale = hourlySum > 1e-9 && dayTotal > hourlySum + 1e-9 ? dayTotal / hourlySum : 1;
|
|
5044
|
-
// 采样粒度 = **5 分钟**(2026-11-27 用户:「每小时分成 12 段 就是从 0 点开始
|
|
5045
|
-
// 0 点 5 分 0 点 10 分 以此类推」)。每小时的钱平均分成 12 份,
|
|
5046
|
-
// 于是折线上 0:00 / 0:05 / 0:10 … 都落在真实的数据点上,
|
|
5047
|
-
// 而不是像小时粒度那样在 0:00→1:00 之间硬插一条直线
|
|
5048
|
-
// (那样 0:04 会报 ¥0.08,而这一小时实际已经花了 ¥1.20)。
|
|
5049
|
-
// 改粒度只动 STEP_MIN,STEPS 和下面所有换算都跟着走。
|
|
5050
|
-
const STEP_MIN = 1;
|
|
5051
|
-
const STEPS_PER_HOUR = 60 / STEP_MIN;
|
|
5052
|
-
const STEPS = 24 * STEPS_PER_HOUR;
|
|
5053
5481
|
let acc = 0;
|
|
5054
5482
|
const pts = [{ at: 0, acc: 0 }];
|
|
5055
5483
|
if (hasStepData) {
|
|
5056
|
-
//
|
|
5057
|
-
//
|
|
5058
|
-
//
|
|
5059
|
-
//
|
|
5060
|
-
//
|
|
5061
|
-
//
|
|
5062
|
-
|
|
5063
|
-
|
|
5064
|
-
const
|
|
5065
|
-
for (let k = 0; k < STEPS; k += 1) {
|
|
5066
|
-
const h = Math.floor(k / STEPS_PER_HOUR);
|
|
5067
|
-
hourStepSum[h] += stepCost5[k];
|
|
5068
|
-
if (stepCost5[k] > 1e-12) hourStepCount[h] += 1;
|
|
5069
|
-
}
|
|
5070
|
-
const stepSum = hourStepSum.reduce((s, v) => s + v, 0);
|
|
5484
|
+
// 每一格按**自己的**真实金额累加,不做任何平摊。
|
|
5485
|
+
// ⚠️ 2026-11-27 删掉了原来那条「该小时有 ≥20 格非零就整小时均分」的分支
|
|
5486
|
+
// (用户:「某个时间段突然用的很多 然后某个时间段突然不怎么用了 他应该是呈现一个坡的
|
|
5487
|
+
// 平摊机制是不是会补这个坡」—— 会,那个坡会被抹成匀速直线。实测 05:00 那一小时
|
|
5488
|
+
// 中途差 ¥1.22,占该小时 41%)。那条判据本身是反的:密的时候每格本来就有值、
|
|
5489
|
+
// 连线自然成坡,不需要摊;疏的时候恰恰是「孤立台阶」,而它反而走精确分支。
|
|
5490
|
+
// 差额仍**按比例**放大到有消耗的格上(同步费这类钱没有时刻归属),
|
|
5491
|
+
// 等比缩放不改形状,没消耗的格恒为 0。
|
|
5492
|
+
const stepSum = stepCost.reduce((s, v) => s + v, 0);
|
|
5071
5493
|
const stepScale = stepSum > 1e-9 && dayTotal > stepSum + 1e-9 ? dayTotal / stepSum : 1;
|
|
5072
5494
|
for (let k = 0; k < STEPS; k += 1) {
|
|
5073
|
-
|
|
5074
|
-
|
|
5075
|
-
? (hourStepSum[h] * stepScale) / STEPS_PER_HOUR
|
|
5076
|
-
: stepCost5[k] * stepScale;
|
|
5077
|
-
acc += v;
|
|
5078
|
-
pts.push({ at: (k + 1) * STEP_MIN / 60, acc });
|
|
5495
|
+
acc += stepCost[k] * stepScale;
|
|
5496
|
+
pts.push({ at: ((k + 1) * STEP_MIN) / 60, acc });
|
|
5079
5497
|
}
|
|
5080
5498
|
} else {
|
|
5081
|
-
// 服务端没给 steps(旧版本 /
|
|
5499
|
+
// 服务端没给 steps(旧版本 / 旧快照 / 粒度对不上):退回整小时平摊。
|
|
5500
|
+
// ⚠️ 它同样不会补没用的时段:byHour[没消耗的小时] = 0,摊 0 还是 0。
|
|
5082
5501
|
for (let k = 0; k < STEPS; k += 1) {
|
|
5083
5502
|
acc += (byHour[Math.floor(k / STEPS_PER_HOUR)] * scale) / STEPS_PER_HOUR;
|
|
5084
|
-
pts.push({ at: (k + 1) * STEP_MIN / 60, acc });
|
|
5503
|
+
pts.push({ at: ((k + 1) * STEP_MIN) / 60, acc });
|
|
5085
5504
|
}
|
|
5086
5505
|
}
|
|
5087
5506
|
// ⚠️ 累计终值不能小于今日总额。hourly 全空但 today.cost 有钱的时候
|
|
@@ -5097,12 +5516,17 @@ const WEB_TOOL_FREE_FROM = Date.parse("2026-11-18T12:00:00+08:00");
|
|
|
5097
5516
|
// ¥5.00 → ¥5 → 刻度 1..5
|
|
5098
5517
|
// ¥5.50 → ¥10 → 5~20 这一档每 5,下一级就是 10,中间没有 6/7/8/9
|
|
5099
5518
|
// 早前那版直接抬到档位「边界」(¥3.74 → ¥5),等于把没到的两级也画出来,太满。
|
|
5519
|
+
// ⚠️ 50 以上**每 50 一档**(2026-11-27 用户:「超过50应该就显示100 往后就是50 50的刻度了」)。
|
|
5520
|
+
// 早前是每 100 一档(100/200/300),¥120 会被抬到 ¥200 —— 上面一半是空的,
|
|
5521
|
+
// 曲线整天贴在中线以下。现在 ¥120 → ¥150,只多抬一档。
|
|
5522
|
+
// 边界对齐:t=50 走上一档(return 50);t=50.01 → 100;t=100 → 100;t=101 → 150。
|
|
5523
|
+
// 没有硬性天花板 —— t 多大就抬到多少,只是步长固定 50。
|
|
5100
5524
|
const maxY = (() => {
|
|
5101
5525
|
const t = total > 1e-9 ? total : 0.01;
|
|
5102
5526
|
if (t <= 5) return Math.ceil(t);
|
|
5103
5527
|
if (t <= 20) return Math.ceil(t / 5) * 5;
|
|
5104
5528
|
if (t <= 50) return Math.ceil(t / 10) * 10;
|
|
5105
|
-
return Math.ceil(t /
|
|
5529
|
+
return Math.ceil(t / 50) * 50;
|
|
5106
5530
|
})();
|
|
5107
5531
|
return { ok: true, pts, total, maxY, hourly: byHour, scale, STEP_MIN, STEPS_PER_HOUR, STEPS, activeHours: byHour.filter((v) => v > 0).length };
|
|
5108
5532
|
}, [today]);
|
|
@@ -5162,13 +5586,18 @@ const WEB_TOOL_FREE_FROM = Date.parse("2026-11-18T12:00:00+08:00");
|
|
|
5162
5586
|
// 加宽是为了让「每小时 60 分钟」在横轴上真的分得开(2026-11-27 用户:
|
|
5163
5587
|
// 「每小时拆成60份 然后可以拉长一点 显示的全一点」)。
|
|
5164
5588
|
const W = 494;
|
|
5165
|
-
//
|
|
5589
|
+
// 高度:色块 494 宽。
|
|
5166
5590
|
// 124 是「太高了」那版(2.7:1 偏方),100 是更早「扁得厉害」那版(3.5:1)。
|
|
5167
5591
|
// 高度 116 → 128(2026-11-27):上面多出来的 12px 给纵轴最顶一档刻度。
|
|
5168
5592
|
// 原来 PAD_T = 6,顶档(maxY)的 baseline 只能在 11,11px 字的顶部落在 2px:
|
|
5169
5593
|
// 几乎贴着 SVG 上沿,看上去就是「最顶上的刻度被切了一半」
|
|
5170
5594
|
// (2026-11-27 用户两次:「最顶上的刻度」「顶上还是这样啊」)。
|
|
5171
|
-
|
|
5595
|
+
// 128 → 144(2026-11-27 用户:「适当的拉高一点折线图呢」):128 的**绘图区**
|
|
5596
|
+
// 只有 82px(H − FRAME_T 2 − FRAME_B 16 − INSET_Y 28),一天的累计坡挤在
|
|
5597
|
+
// 一条窄带里,坡度和拐点都看不出来。加 16px 后绘图区 98px(+20%),
|
|
5598
|
+
// 高宽比 3.86:1 → 3.43:1。别再往上走 —— 那会踩回「太高了」那版的老印象。
|
|
5599
|
+
// ⚠️ 只有 viewBox 用它("0 0 W H"),SVG 自带等比缩放,改这一个数就够。
|
|
5600
|
+
const H = 144;
|
|
5172
5601
|
// 2026-11-26 用户:「外面的框不要了」—— 只剩带圆角的色带本身,
|
|
5173
5602
|
// FRAME 现在只表示「绘图区到 SVG 边缘的留白」,不再画任何边框。
|
|
5174
5603
|
const FRAME_L = 2;
|
|
@@ -5186,7 +5615,11 @@ const WEB_TOOL_FREE_FROM = Date.parse("2026-11-18T12:00:00+08:00");
|
|
|
5186
5615
|
// 16 只够「¥5」(约 17px)—— 多一位就从画布左边被裁掉。
|
|
5187
5616
|
// 用户截图里「¥15」只剩一半,看上去就是「顶部刻度看不清」
|
|
5188
5617
|
// (2026-11-27 用户:「顶部的刻度」)。
|
|
5189
|
-
|
|
5618
|
+
// 26 → 34(2026-11-27):纵轴上界改成「>50 每 50 一档」之后,三位数刻度
|
|
5619
|
+
// (¥100 / ¥150 / ¥200)变成常态,而「¥150」约 29px、「¥200」约 27px,
|
|
5620
|
+
// 26 的留白仍然会把 ¥ 削掉一截(预览图里 ¥200 看着像 £200)。
|
|
5621
|
+
// 34 = 29px 字宽 + 右端 x=32 上留 3px 肉;¥200 左端落在 7px、¥150 落在 5px。
|
|
5622
|
+
const INSET_X = 34;
|
|
5190
5623
|
// 上下内缩不对称已不可行:下面要留给时间轴,上面要留给顶档刻度。
|
|
5191
5624
|
// 14 让 PAD_T = 16,顶档 baseline 落在 19 左右,字顶离上沿 ~11px,彻底不碰边。
|
|
5192
5625
|
const INSET_Y = 14;
|
|
@@ -5238,15 +5671,15 @@ const WEB_TOOL_FREE_FROM = Date.parse("2026-11-18T12:00:00+08:00");
|
|
|
5238
5671
|
const tailAt = Math.max(0, Math.min(24, nowHour));
|
|
5239
5672
|
const lastAt = clipped.length > 0 ? clipped[clipped.length - 1].at : -1;
|
|
5240
5673
|
if (tailAt > 1e-9 && tailAt - lastAt > 1e-9) {
|
|
5241
|
-
//
|
|
5242
|
-
const sp = model.STEPS_PER_HOUR ||
|
|
5243
|
-
const kIdx = Math.min(model.STEPS ||
|
|
5674
|
+
// 索引按**一格**算(STEPS_PER_HOUR 格 = 1 小时,3 分钟粒度下是 20 格)
|
|
5675
|
+
const sp = model.STEPS_PER_HOUR || 20;
|
|
5676
|
+
const kIdx = Math.min(model.STEPS || 480, Math.floor(tailAt * sp));
|
|
5244
5677
|
const p0 = model.pts[kIdx] ? model.pts[kIdx].acc : 0;
|
|
5245
5678
|
clipped.push({ at: tailAt, acc: p0 });
|
|
5246
5679
|
}
|
|
5247
5680
|
}
|
|
5248
|
-
//
|
|
5249
|
-
//
|
|
5681
|
+
// 折线上的采样点标记。曲线是 **3 分钟**一格(见 STEP_MIN)——
|
|
5682
|
+
// 一格一颗的话一小时 20 颗、凌晨那截直接糊成实线,所以只按整点打。
|
|
5250
5683
|
// 打点的语义是「这一段有数据」,不是「这里是采样边界」。只打有消耗的小时。
|
|
5251
5684
|
// 逐帧插值纵轴上限:每一帧都用真实坐标重算,
|
|
5252
5685
|
// 所以描边粗细、圆点大小、文字字号全都不变,变的只是位置。
|
|
@@ -5438,7 +5871,7 @@ const WEB_TOOL_FREE_FROM = Date.parse("2026-11-18T12:00:00+08:00");
|
|
|
5438
5871
|
};
|
|
5439
5872
|
// 按「某个时刻 + 鼠标纵坐标」出胶囊。抽成独立函数是为了让**滚轮/方向键**能复用:
|
|
5440
5873
|
// 图宽 474 铺 24 小时,一分钟只占 0.33px —— 鼠标动一像素就跨 3 分钟,
|
|
5441
|
-
// 再宽的卡片也治不好(要
|
|
5874
|
+
// 再宽的卡片也治不好(要 480px 才 3 分钟/px)。所以精确定位交给滚轮/方向键,
|
|
5442
5875
|
// 指针只负责落个大概位置(2026-11-27 用户:「怎么还是只能3分钟的看」)。
|
|
5443
5876
|
// 构造胶囊数据(纯函数)。抽出来是为了**常显**:鼠标不在图上时
|
|
5444
5877
|
// 渲染层直接用 buildHover(nowHour) 算一份「此刻」的,不再需要先把鼠标摆上去。
|
|
@@ -5448,13 +5881,13 @@ const WEB_TOOL_FREE_FROM = Date.parse("2026-11-18T12:00:00+08:00");
|
|
|
5448
5881
|
// 段内插值是纯猜测:这一小时花了 ¥1.20,但不知道是哪一分钟,
|
|
5449
5882
|
// 按 4/60 摊出来是 ¥0.08,跟「已经花了 ¥1.20」完全对不上
|
|
5450
5883
|
// (2026-11-27 用户拿着 0:04 的截图问「这个是准确数值是吗」)。
|
|
5451
|
-
//
|
|
5452
|
-
// ⚠️
|
|
5453
|
-
//
|
|
5884
|
+
// 现在每一格报它自己那一份,误差 ≤ byHour/STEPS_PER_HOUR。
|
|
5885
|
+
// ⚠️ 兜底值必须与 STEP_MIN 同值(3 分钟 ⇒ 20)—— 早前是 12(5 分钟),
|
|
5886
|
+
// 模型里字段缺失时会静默退回粗粒度吸附,胶囊上的时刻就只在整 5 分上跳
|
|
5454
5887
|
// (2026-11-27 用户指着「06:54 累计」说「我说的是这个显示每分钟」)。
|
|
5455
|
-
const sp = model.STEPS_PER_HOUR ||
|
|
5456
|
-
const stepIdx = Math.min(model.STEPS ||
|
|
5457
|
-
// pts[i] 存的是第 i+1
|
|
5888
|
+
const sp = model.STEPS_PER_HOUR || 20;
|
|
5889
|
+
const stepIdx = Math.min(model.STEPS || 480, Math.max(0, Math.round(hour * sp)));
|
|
5890
|
+
// pts[i] 存的是第 i+1 格**末**的累计(pts[i].at = (i+1)*STEP_MIN/60),
|
|
5458
5891
|
// 所以要取 segHour 那一刻的累计,索引是 stepIdx-1 而不是 stepIdx(差一分钟)。
|
|
5459
5892
|
const accIdx = stepIdx - 1;
|
|
5460
5893
|
const a0 = accIdx >= 0 && model.pts[accIdx] ? model.pts[accIdx].acc : 0;
|
|
@@ -9603,7 +10036,8 @@ function UsageCostLine({ useProjection, sessionId }) {
|
|
|
9603
10036
|
? jsx.jsxs("span", {
|
|
9604
10037
|
key: "team",
|
|
9605
10038
|
className: "balance-usage-team",
|
|
9606
|
-
|
|
10039
|
+
// 原来这里是原生 title(「含 N 个团队成员(智能体团队)的消耗」),hover 弹灰框,
|
|
10040
|
+
// 跟浮窗主题完全不搭。圆片上本来就写着「团队 2」,解释不需要 hover 也有。
|
|
9607
10041
|
children: ["团队 ", String(teamCount)],
|
|
9608
10042
|
})
|
|
9609
10043
|
: null,
|
|
@@ -10635,6 +11069,20 @@ function UsageCostLine({ useProjection, sessionId }) {
|
|
|
10635
11069
|
if (calendarSync.kind === "syncing") return calendarSync.text || "正在同步…";
|
|
10636
11070
|
return "尚未同步,正在用插件内置表。";
|
|
10637
11071
|
})();
|
|
11072
|
+
// 进度条现在只画在弹窗里,百分比与阶段文案提到这里算一次,
|
|
11073
|
+
// 免得 JSX 里再写一段 IIFE(行内那份已随进度条一起搬走)。
|
|
11074
|
+
const calendarProgressPctVal = calendarProgressPct(calendarProgress);
|
|
11075
|
+
const calendarProgressText = (() => {
|
|
11076
|
+
const p = calendarProgress;
|
|
11077
|
+
if (p == null || p.label == null || p.label === "") {
|
|
11078
|
+
return calendarSync.text || "正在同步…";
|
|
11079
|
+
}
|
|
11080
|
+
const total = Number(p.total) || 0;
|
|
11081
|
+
const done = Number(p.done) || 0;
|
|
11082
|
+
if (total <= 1) return p.label;
|
|
11083
|
+
const cur = p.phase === "done" ? done : Math.min(total, done + 1);
|
|
11084
|
+
return String(cur) + "/" + String(total) + " · " + p.label;
|
|
11085
|
+
})();
|
|
10638
11086
|
// 同步期间每 400ms 问一次进度。setTimeout 递归而不用 setInterval:
|
|
10639
11087
|
// 一次请求挂住时不会堆出几条并发;组件卸载立刻停。
|
|
10640
11088
|
react.useEffect(() => {
|
|
@@ -10668,14 +11116,24 @@ function UsageCostLine({ useProjection, sessionId }) {
|
|
|
10668
11116
|
const onSyncCalendar = async () => {
|
|
10669
11117
|
if (calendarBusy) return;
|
|
10670
11118
|
setCalendarSync({ kind: "syncing", text: "正在搜索国务院公告并解析,约 10 秒…" });
|
|
11119
|
+
// 进度条只在弹窗里(2026-11-27:「如果用户点同步 弹出弹窗 并提醒用户不要离开
|
|
11120
|
+
// 并且弹窗里面是进度条 原先的进度条移到弹窗里」)。弹窗一开就显示,
|
|
11121
|
+
// 结果到了还是这张弹窗切换内容(kind 从 syncing 变 ok/error)—— 不另开一张。
|
|
11122
|
+
setCalendarModal(true);
|
|
10671
11123
|
try {
|
|
10672
|
-
|
|
11124
|
+
// 以**用户眼前选中的那个开关**为准,不等 350ms 的保存落盘(见 syncCalendar 注释)
|
|
11125
|
+
const data = await syncCalendar(value.syncModeCalendar === "free" ? "free" : "model");
|
|
10673
11126
|
if (data && data.ok === true) {
|
|
10674
11127
|
// 成功不另拼一句文案:syncCalendar() 内部已经 adoptCalendar(data) 刷新了缓存,
|
|
10675
11128
|
// calendarSummary 会带着新的同步时刻自己重渲染;这里只把状态切成 ok(绿色)。
|
|
10676
11129
|
// 另存一份结果给弹窗用(同步到哪几年、加了多少天、这次花了多少 token)。
|
|
10677
11130
|
setCalendarSync({ kind: "ok", text: "", result: data });
|
|
10678
11131
|
setCalendarModal(true);
|
|
11132
|
+
// 这次同步走模型烧的 token 已经记进服务端账本(notePluginSpend),
|
|
11133
|
+
// 但手里这份 today 是同步之前的 —— 不主动拉一次,「插件同步 N 次 / ¥x」
|
|
11134
|
+
// 就要等到下一次 today 轮询才变(2026-11-27 用户:「更新速度有延迟」)。
|
|
11135
|
+
// 服务端那边同一笔记账也会作废今日缓存,两边合起来才是「点完就变」。
|
|
11136
|
+
void fetchTodayOnce(true);
|
|
10679
11137
|
} else {
|
|
10680
11138
|
setCalendarSync({
|
|
10681
11139
|
kind: "error",
|
|
@@ -10750,9 +11208,14 @@ function UsageCostLine({ useProjection, sessionId }) {
|
|
|
10750
11208
|
const onSyncPricing = () => {
|
|
10751
11209
|
if (pricingSync.kind === "syncing") return;
|
|
10752
11210
|
setPricingSync({ kind: "syncing", text: "正在抓官网并解析,约 5 秒…" });
|
|
11211
|
+
// 价格同步也先弹窗(2026-11-27:「点同步 弹出弹窗 并提醒用户不要离开」):
|
|
11212
|
+
// 它没有进度接口,所以只有一条来回扫的轨道 + 明确的时间预期,不伪造百分比。
|
|
11213
|
+
setPricingModal(true);
|
|
10753
11214
|
void (async () => {
|
|
10754
11215
|
try {
|
|
10755
|
-
|
|
11216
|
+
// 同节假日:带上眼前选中的同步方式,别等服务端那份可能还没保存的设置
|
|
11217
|
+
const modeQuery = "&mode=" + (value.syncModePricing === "free" ? "free" : "model");
|
|
11218
|
+
const res = await fetch("/balance-api?sync=1" + modeQuery, {
|
|
10756
11219
|
method: "POST",
|
|
10757
11220
|
headers: { "Content-Type": "application/json" },
|
|
10758
11221
|
body: "{}",
|
|
@@ -10770,6 +11233,9 @@ function UsageCostLine({ useProjection, sessionId }) {
|
|
|
10770
11233
|
at: Date.now(),
|
|
10771
11234
|
});
|
|
10772
11235
|
setPricingModal(true);
|
|
11236
|
+
// 同节假日:这次同步的 token 已记进服务端账本,主动拉一次今日,
|
|
11237
|
+
// 免得「插件同步」那行等下一拍轮询才更新(2026-11-27:「更新速度有延迟」)。
|
|
11238
|
+
void fetchTodayOnce(true);
|
|
10773
11239
|
// 服务端已经写盘了,本地缓存跟上,界面立刻显示新价
|
|
10774
11240
|
if (data.settings) {
|
|
10775
11241
|
settingsCache = {
|
|
@@ -11217,6 +11683,23 @@ function UsageCostLine({ useProjection, sessionId }) {
|
|
|
11217
11683
|
}, opt.value)),
|
|
11218
11684
|
});
|
|
11219
11685
|
|
|
11686
|
+
// 每行自己的模式说明(2026-11-27 用户:「把这个整体的提示撤了 设置成每项的提示」)。
|
|
11687
|
+
// 原来是一条覆盖两行的 group-note(「两行都走模型,会产生少量 token 消耗…」),
|
|
11688
|
+
// 用户看「价格与时段」那一行时得回头对一句「两行都…」才知道这行花不花钱。
|
|
11689
|
+
// 现在挪进各自行的 hint:**用哪种模式就说哪种模式的代价**,免费只说免费的事。
|
|
11690
|
+
// 金额按实测给的量级:账本 29 次调用 ¥0.0603,单次折合 ¥0.002 上下,写「不到 ¥0.01」留足余量。
|
|
11691
|
+
// ⚠️ 必须自己另起一行(display:block),否则会和上一句连成一长串 ——
|
|
11692
|
+
// 同 hint-warn / hint-error 的做法;走模型才用警示橙,免费用普通灰,别整行染橙。
|
|
11693
|
+
const syncModeTip = (key) => {
|
|
11694
|
+
const free = value[key] === "free";
|
|
11695
|
+
return jsx.jsx("span", {
|
|
11696
|
+
className: "balance-settings__hint-mode" + (free ? " balance-settings__hint-mode--free" : ""),
|
|
11697
|
+
children: free
|
|
11698
|
+
? "当前免费:不调用模型、不产生消耗;官网改版后可能读不出来。"
|
|
11699
|
+
: "当前走模型:会产生少量 token 消耗(单次折合不到 ¥0.01)。",
|
|
11700
|
+
});
|
|
11701
|
+
};
|
|
11702
|
+
|
|
11220
11703
|
const choiceRow = (key, label, hint, options, extra) => row(key, label, hint, jsx.jsx("div", {
|
|
11221
11704
|
className: "balance-settings__segmented",
|
|
11222
11705
|
role: "radiogroup",
|
|
@@ -11466,6 +11949,8 @@ function UsageCostLine({ useProjection, sessionId }) {
|
|
|
11466
11949
|
jsx.jsxs("span", {
|
|
11467
11950
|
children: [
|
|
11468
11951
|
"抓一次官网,把最新价与时段覆盖到本地配置。",
|
|
11952
|
+
// 这一行自己的模式说明(原来归组级提示管,2026-11-27 拆下来)
|
|
11953
|
+
syncModeTip("syncModePricing"),
|
|
11469
11954
|
pricingSync.kind === "error"
|
|
11470
11955
|
? jsx.jsx("span", {
|
|
11471
11956
|
className: "balance-settings__hint-error",
|
|
@@ -11492,6 +11977,10 @@ function UsageCostLine({ useProjection, sessionId }) {
|
|
|
11492
11977
|
jsx.jsxs("span", {
|
|
11493
11978
|
children: [
|
|
11494
11979
|
"同步当年放假与调休日期,全天按空闲价计费。",
|
|
11980
|
+
// 同上:节假日这一行自己的模式说明。它一次同步会按年份循环调模型
|
|
11981
|
+
// (11 月之后是「今年 + 明年」两趟),所以和价格行不是同一笔量级 ——
|
|
11982
|
+
// 但仍是「不到 ¥0.01」一档,具体次数看当年目标年份。
|
|
11983
|
+
syncModeTip("syncModeCalendar"),
|
|
11495
11984
|
calendar.fetchedAt > 0
|
|
11496
11985
|
? null
|
|
11497
11986
|
: jsx.jsx("span", {
|
|
@@ -11525,63 +12014,20 @@ function UsageCostLine({ useProjection, sessionId }) {
|
|
|
11525
12014
|
}),
|
|
11526
12015
|
],
|
|
11527
12016
|
}),
|
|
11528
|
-
//
|
|
11529
|
-
//
|
|
11530
|
-
//
|
|
11531
|
-
|
|
11532
|
-
|
|
11533
|
-
|
|
11534
|
-
|
|
11535
|
-
|
|
11536
|
-
className: "balance-settings__progress-track",
|
|
11537
|
-
children: jsx.jsx("div", {
|
|
11538
|
-
className:
|
|
11539
|
-
"balance-settings__progress-fill" +
|
|
11540
|
-
(calendarProgressPct(calendarProgress) > 0 || calendarProgress?.total > 0
|
|
11541
|
-
? ""
|
|
11542
|
-
: " balance-settings__progress-fill--indeterminate"),
|
|
11543
|
-
style:
|
|
11544
|
-
calendarProgressPct(calendarProgress) > 0 || calendarProgress?.total > 0
|
|
11545
|
-
? { width: calendarProgressPct(calendarProgress) + "%" }
|
|
11546
|
-
: undefined,
|
|
11547
|
-
}),
|
|
11548
|
-
}),
|
|
11549
|
-
jsx.jsx("span", {
|
|
11550
|
-
className: "balance-settings__progress-label",
|
|
11551
|
-
children: (() => {
|
|
11552
|
-
const p = calendarProgress;
|
|
11553
|
-
if (p == null || p.label == null || p.label === "") {
|
|
11554
|
-
return calendarSync.text || "正在同步…";
|
|
11555
|
-
}
|
|
11556
|
-
const total = Number(p.total) || 0;
|
|
11557
|
-
const done = Number(p.done) || 0;
|
|
11558
|
-
if (total <= 1) return p.label;
|
|
11559
|
-
const cur = p.phase === "done" ? done : Math.min(total, done + 1);
|
|
11560
|
-
return String(cur) + "/" + String(total) + " · " + p.label;
|
|
11561
|
-
})(),
|
|
11562
|
-
}),
|
|
11563
|
-
],
|
|
11564
|
-
})
|
|
11565
|
-
: null,
|
|
12017
|
+
// ⚠️ 第 5 个参数是 extra(行内、说明文字与控件之间),第 6 个才是 below。
|
|
12018
|
+
// 2026-11-27 这里少写了一个 null,进度条落到 extra 位 → 它带着 flex:1 0 100%
|
|
12019
|
+
// 把整行占满,左边「法定节假日」被压成一列竖排单字(用户截图就是这个)。
|
|
12020
|
+
// 现在显式占住 extra(null),进度条走 below,在整行**下面**独立一行。
|
|
12021
|
+
null,
|
|
12022
|
+
// 进度条已经搬进弹窗(2026-11-27 用户:「原先的进度条移到弹窗里」),
|
|
12023
|
+
// 这行下面不再常驻任何东西 —— below 位留 null,行高与原来一致。
|
|
12024
|
+
null,
|
|
11566
12025
|
),
|
|
11567
|
-
],
|
|
11568
|
-
|
|
11569
|
-
|
|
11570
|
-
|
|
11571
|
-
|
|
11572
|
-
return { text: "两行都用免费模式,不调用模型、不产生任何消耗。代价是官网改版后可能读不出来。" };
|
|
11573
|
-
}
|
|
11574
|
-
if (p === "model" && c2 === "model") {
|
|
11575
|
-
return {
|
|
11576
|
-
text: "两行都走模型,会产生少量 token 消耗(合计折合不到 ¥0.02)。",
|
|
11577
|
-
tone: "warn",
|
|
11578
|
-
};
|
|
11579
|
-
}
|
|
11580
|
-
return {
|
|
11581
|
-
text: (p === "model" ? "价格" : "节假日") + "那行走模型,会产生少量 token 消耗;另一行走免费模式,不花钱。",
|
|
11582
|
-
tone: "warn",
|
|
11583
|
-
};
|
|
11584
|
-
})()),
|
|
12026
|
+
]),
|
|
12027
|
+
// ⚠️ 这里原来有第 4 个参数(group-note),一条覆盖两行的「两行都走模型…」。
|
|
12028
|
+
// 2026-11-27 用户:「把这个整体的提示撤了 设置成每项的提示」—— 已拆进上面两行的
|
|
12029
|
+
// hint(见 syncModeTip)。**别再往 sync 组加组级提示**:哪一行花不花钱是行自己的事,
|
|
12030
|
+
// 组级那一句在只有一行走模型时还得绕个弯说「另一行不花钱」。
|
|
11585
12031
|
|
|
11586
12032
|
group("balance", "余额", [
|
|
11587
12033
|
numberRow("refreshIntervalSec", "余额刷新间隔", "轮询间隔;对话产生新消耗时也会顺带刷新。", 5, 3600, "秒"),
|
|
@@ -11787,242 +12233,280 @@ function UsageCostLine({ useProjection, sessionId }) {
|
|
|
11787
12233
|
],
|
|
11788
12234
|
}) : null,
|
|
11789
12235
|
|
|
11790
|
-
//
|
|
11791
|
-
//
|
|
11792
|
-
//
|
|
11793
|
-
|
|
11794
|
-
|
|
11795
|
-
|
|
11796
|
-
|
|
11797
|
-
|
|
11798
|
-
|
|
11799
|
-
|
|
11800
|
-
|
|
11801
|
-
|
|
11802
|
-
|
|
11803
|
-
|
|
11804
|
-
|
|
11805
|
-
|
|
11806
|
-
|
|
11807
|
-
|
|
11808
|
-
|
|
11809
|
-
|
|
11810
|
-
|
|
11811
|
-
|
|
11812
|
-
|
|
11813
|
-
|
|
11814
|
-
|
|
11815
|
-
|
|
11816
|
-
|
|
11817
|
-
|
|
11818
|
-
|
|
11819
|
-
|
|
11820
|
-
|
|
11821
|
-
|
|
11822
|
-
|
|
11823
|
-
|
|
11824
|
-
|
|
11825
|
-
|
|
11826
|
-
|
|
11827
|
-
|
|
11828
|
-
|
|
11829
|
-
|
|
11830
|
-
|
|
11831
|
-
|
|
11832
|
-
|
|
11833
|
-
|
|
11834
|
-
|
|
11835
|
-
|
|
11836
|
-
|
|
11837
|
-
|
|
11838
|
-
|
|
11839
|
-
|
|
11840
|
-
|
|
11841
|
-
|
|
11842
|
-
|
|
11843
|
-
|
|
11844
|
-
|
|
11845
|
-
|
|
11846
|
-
|
|
11847
|
-
|
|
11848
|
-
|
|
11849
|
-
|
|
11850
|
-
|
|
11851
|
-
|
|
11852
|
-
|
|
11853
|
-
|
|
11854
|
-
|
|
11855
|
-
|
|
11856
|
-
|
|
11857
|
-
|
|
11858
|
-
|
|
11859
|
-
|
|
11860
|
-
|
|
11861
|
-
|
|
11862
|
-
|
|
11863
|
-
|
|
11864
|
-
|
|
11865
|
-
|
|
11866
|
-
|
|
11867
|
-
|
|
11868
|
-
|
|
11869
|
-
|
|
11870
|
-
|
|
11871
|
-
|
|
12236
|
+
// 价格同步:进度 → 结果**同一张窗**(2026-11-27 用户:「两个同步的弹窗用一个窗口
|
|
12237
|
+
// 不要加载完就换窗口」)。原来进度走自绘窗、结果走 primitives.Modal,同步一结束
|
|
12238
|
+
// 就是关一张开一张,壳不同、位置不同、大小不同。现在 kind 一变只换**壳里的内容**。
|
|
12239
|
+
// ⚠️ open 必须写成「弹窗开关 && 不是 idle」—— 结果阶段把它关掉就又是换窗口了。
|
|
12240
|
+
// 抓官网 + 解析没有分阶段进度,所以只有一条扫描轨道(indeterminate),绝不写假百分比。
|
|
12241
|
+
jsx.jsx(SyncProgressDialog, {
|
|
12242
|
+
open: pricingModal && pricingSync.kind !== "idle",
|
|
12243
|
+
phase: pricingSync.kind === "syncing" ? "running" : "result",
|
|
12244
|
+
title:
|
|
12245
|
+
pricingSync.kind === "syncing"
|
|
12246
|
+
? "正在同步模型价格"
|
|
12247
|
+
: pricingSync.kind === "ok"
|
|
12248
|
+
? "价格与时段已同步"
|
|
12249
|
+
: "价格同步没成功",
|
|
12250
|
+
label: pricingSync.text || "正在抓官网并解析…",
|
|
12251
|
+
indeterminate: true,
|
|
12252
|
+
note: "⚠️ 同步期间请不要离开这个弹窗 —— 离开这次同步就失效了,还会白白浪费 token。同步到的数据只作展示用。",
|
|
12253
|
+
onClose: () => setPricingModal(false),
|
|
12254
|
+
children:
|
|
12255
|
+
pricingSync.kind === "error"
|
|
12256
|
+
? jsx.jsxs("div", {
|
|
12257
|
+
className: "balance-settings__sync",
|
|
12258
|
+
children: [
|
|
12259
|
+
jsx.jsx("div", {
|
|
12260
|
+
className: "balance-settings__sync-note",
|
|
12261
|
+
style: { marginTop: 0 },
|
|
12262
|
+
children: pricingSync.error || "同步失败",
|
|
12263
|
+
}),
|
|
12264
|
+
pricingSync.hint
|
|
12265
|
+
? jsx.jsx("div", { className: "balance-settings__sync-note", children: pricingSync.hint })
|
|
12266
|
+
: null,
|
|
12267
|
+
],
|
|
12268
|
+
})
|
|
12269
|
+
: jsx.jsxs("div", {
|
|
12270
|
+
className: "balance-settings__sync",
|
|
12271
|
+
children: [
|
|
12272
|
+
jsx.jsxs("div", {
|
|
12273
|
+
className: "balance-settings__sync-grid",
|
|
12274
|
+
children: [
|
|
12275
|
+
jsx.jsx("span", { className: "balance-settings__sync-key", children: "高峰时段" }),
|
|
12276
|
+
jsx.jsx("span", { className: "balance-settings__sync-val", children: (pricingSync.parsed?.peakWindowsText ?? "—") + "(工作日北京时间)" }),
|
|
12277
|
+
jsx.jsx("span", { className: "balance-settings__sync-key", children: "高峰倍率" }),
|
|
12278
|
+
jsx.jsx("span", { className: "balance-settings__sync-val", children: "×" + (pricingSync.parsed?.peakMultiplier ?? "—") + "(高峰价 = 空闲价 × 倍率)" }),
|
|
12279
|
+
jsx.jsx("span", { className: "balance-settings__sync-key", children: "flash 输入" }),
|
|
12280
|
+
jsx.jsx("span", { className: "balance-settings__sync-val", children: "未命中 ¥" + (pricingSync.parsed?.priceFlash?.inputCnyPerMillion ?? "—") + " · 命中 ¥" + (pricingSync.parsed?.priceFlash?.cacheReadCnyPerMillion ?? "—") + " / 百万 tokens" }),
|
|
12281
|
+
jsx.jsx("span", { className: "balance-settings__sync-key", children: "flash 输出" }),
|
|
12282
|
+
jsx.jsx("span", { className: "balance-settings__sync-val", children: "¥" + (pricingSync.parsed?.priceFlash?.outputCnyPerMillion ?? "—") + " / 百万 tokens" }),
|
|
12283
|
+
jsx.jsx("span", { className: "balance-settings__sync-key", children: "pro 输入" }),
|
|
12284
|
+
jsx.jsx("span", { className: "balance-settings__sync-val", children: "未命中 ¥" + (pricingSync.parsed?.pricePro?.inputCnyPerMillion ?? "—") + " · 命中 ¥" + (pricingSync.parsed?.pricePro?.cacheReadCnyPerMillion ?? "—") + " / 百万 tokens" }),
|
|
12285
|
+
jsx.jsx("span", { className: "balance-settings__sync-key", children: "pro 输出" }),
|
|
12286
|
+
jsx.jsx("span", { className: "balance-settings__sync-val", children: "¥" + (pricingSync.parsed?.pricePro?.outputCnyPerMillion ?? "—") + " / 百万 tokens" }),
|
|
12287
|
+
jsx.jsx("span", { className: "balance-settings__sync-key", children: "解析方式" }),
|
|
12288
|
+
jsx.jsx("span", {
|
|
12289
|
+
className: "balance-settings__sync-val" + (pricingSync.how === "model" ? " balance-settings__sync-val--warn" : ""),
|
|
12290
|
+
children:
|
|
12291
|
+
pricingSync.how === "model"
|
|
12292
|
+
? [
|
|
12293
|
+
"模型解析",
|
|
12294
|
+
// 模型名单独一块、独占一行:整串 "deepseek-official/deepseek-v4-flash"
|
|
12295
|
+
// 太长,跟着「模型解析」挤会从 "v4-" 后面硬断成两截。
|
|
12296
|
+
jsx.jsx("span", { className: "balance-settings__sync-sub", children: "(" + (pricingSync.model || "未知模型") + ")" }, "model"),
|
|
12297
|
+
]
|
|
12298
|
+
: "没走模型(退回内置规则,未消耗 token)",
|
|
12299
|
+
}),
|
|
12300
|
+
// 选了模型却没走成 —— 把服务端给的原因原样摆出来,别让人对着「没走模型」猜
|
|
12301
|
+
pricingSync.how !== "model" && pricingSync.modelSkipReason
|
|
12302
|
+
? jsx.jsxs("div", {
|
|
12303
|
+
style: { display: "contents" },
|
|
12304
|
+
children: [
|
|
12305
|
+
jsx.jsx("span", { className: "balance-settings__sync-key", children: "模型没跑成" }),
|
|
12306
|
+
jsx.jsx("span", {
|
|
12307
|
+
className: "balance-settings__sync-val balance-settings__sync-val--warn",
|
|
12308
|
+
style: { wordBreak: "break-all", lineHeight: "17px" },
|
|
12309
|
+
children: pricingSync.modelSkipReason,
|
|
12310
|
+
}),
|
|
12311
|
+
],
|
|
12312
|
+
})
|
|
12313
|
+
: null,
|
|
12314
|
+
pricingSync.how !== "model" && pricingSync.modelSkipReason !== "" && pricingSync.chunkShape
|
|
12315
|
+
? jsx.jsxs("div", {
|
|
12316
|
+
style: { display: "contents" },
|
|
12317
|
+
children: [
|
|
12318
|
+
jsx.jsx("span", { className: "balance-settings__sync-key", children: "流结构" }),
|
|
12319
|
+
jsx.jsx("span", {
|
|
12320
|
+
className: "balance-settings__sync-val",
|
|
12321
|
+
style: { wordBreak: "break-all", lineHeight: "16px", fontSize: "10.5px" },
|
|
12322
|
+
children: pricingSync.chunkShape,
|
|
12323
|
+
}),
|
|
12324
|
+
],
|
|
12325
|
+
})
|
|
12326
|
+
: null,
|
|
12327
|
+
jsx.jsx("span", { className: "balance-settings__sync-key", children: "本次消耗" }),
|
|
12328
|
+
jsx.jsx("span", {
|
|
12329
|
+
className: "balance-settings__sync-val" + (pricingSync.usage ? " balance-settings__sync-val--cost" : ""),
|
|
12330
|
+
children: syncCostText(pricingSync.usage),
|
|
12331
|
+
}),
|
|
12332
|
+
],
|
|
12333
|
+
}),
|
|
12334
|
+
jsx.jsx("div", {
|
|
12335
|
+
className: "balance-settings__sync-note",
|
|
12336
|
+
children: "已写入本地配置,升级插件不会覆盖。这些是目录价,展示时按上面倍率区分高峰 / 空闲。",
|
|
12337
|
+
}),
|
|
12338
|
+
],
|
|
12339
|
+
}),
|
|
12340
|
+
}),
|
|
11872
12341
|
|
|
11873
|
-
//
|
|
11874
|
-
//
|
|
11875
|
-
//
|
|
11876
|
-
|
|
11877
|
-
|
|
11878
|
-
|
|
11879
|
-
|
|
11880
|
-
|
|
11881
|
-
|
|
11882
|
-
|
|
11883
|
-
|
|
11884
|
-
|
|
11885
|
-
|
|
11886
|
-
|
|
11887
|
-
|
|
11888
|
-
|
|
11889
|
-
|
|
12342
|
+
// 节假日同步:进度 → 结果**同一张窗**(2026-11-27 用户:「两个同步的弹窗用一个窗口
|
|
12343
|
+
// 不要加载完就换窗口」)。原来进度走自绘、成功 / 失败各走一张官方 Modal,同步一结束
|
|
12344
|
+
// 就是关一张开一张。现在 kind 一变只换壳里的内容:标题、正文、按钮文案。
|
|
12345
|
+
// ⚠️ open 必须写成「弹窗开关 && 不是 idle」—— 结果阶段关掉就又变成换窗口了。
|
|
12346
|
+
jsx.jsx(SyncProgressDialog, {
|
|
12347
|
+
open: calendarModal && calendarSync.kind !== "idle",
|
|
12348
|
+
phase: calendarSync.kind === "syncing" ? "running" : "result",
|
|
12349
|
+
// 标题必须反映真实结果:只要还有年份没拿到(failedYears),就不能写「已同步」——
|
|
12350
|
+
// 2026-11-26 用户看到「已同步」同时看到「模型没跑成」,两句互相打脸。
|
|
12351
|
+
title:
|
|
12352
|
+
calendarSync.kind === "syncing"
|
|
12353
|
+
? "正在同步法定节假日"
|
|
12354
|
+
: calendarSync.kind === "error"
|
|
12355
|
+
? "节假日同步没成功"
|
|
12356
|
+
: (Array.isArray(calendarSync.result?.failedYears) && calendarSync.result.failedYears.length > 0)
|
|
12357
|
+
? "法定节假日部分同步"
|
|
12358
|
+
: "法定节假日已同步",
|
|
12359
|
+
label: calendarProgressText,
|
|
12360
|
+
pct: calendarProgressPctVal,
|
|
12361
|
+
note: "⚠️ 同步期间请不要离开这个弹窗 —— 离开这次同步就失效了,还会白白浪费 token。同步到的数据只作展示用。",
|
|
12362
|
+
onClose: () => setCalendarModal(false),
|
|
12363
|
+
children:
|
|
12364
|
+
calendarSync.kind === "error"
|
|
12365
|
+
? jsx.jsxs("div", {
|
|
12366
|
+
className: "balance-settings__sync-grid",
|
|
12367
|
+
children: [
|
|
12368
|
+
jsx.jsx("span", { className: "balance-settings__sync-key", children: "结果" }),
|
|
12369
|
+
jsx.jsx("span", { className: "balance-settings__sync-val balance-settings__sync-val--warn", children: calendarSync.text || "同步失败" }),
|
|
12370
|
+
...(calendarSyncResult?.modelSkipReason
|
|
12371
|
+
? [
|
|
12372
|
+
jsx.jsx("span", { className: "balance-settings__sync-key", children: "模型没跑成" }),
|
|
12373
|
+
jsx.jsx("span", {
|
|
12374
|
+
className: "balance-settings__sync-val balance-settings__sync-val--warn",
|
|
12375
|
+
style: { wordBreak: "break-all", lineHeight: "17px" },
|
|
12376
|
+
children: calendarSyncResult.modelSkipReason,
|
|
12377
|
+
}),
|
|
12378
|
+
]
|
|
12379
|
+
: []),
|
|
12380
|
+
...(calendarSyncResult?.chunkCount != null
|
|
12381
|
+
? [
|
|
12382
|
+
jsx.jsx("span", { className: "balance-settings__sync-key", children: "收到 chunk" }),
|
|
12383
|
+
jsx.jsx("span", { className: "balance-settings__sync-val", children: String(calendarSyncResult.chunkCount) }),
|
|
12384
|
+
]
|
|
12385
|
+
: []),
|
|
12386
|
+
...(calendarSyncResult?.chunkShape
|
|
12387
|
+
? [
|
|
12388
|
+
jsx.jsx("span", { className: "balance-settings__sync-key", children: "流结构" }),
|
|
12389
|
+
jsx.jsx("span", {
|
|
12390
|
+
className: "balance-settings__sync-val",
|
|
12391
|
+
style: { wordBreak: "break-all", lineHeight: "16px", fontSize: "10.5px" },
|
|
12392
|
+
children: calendarSyncResult.chunkShape,
|
|
12393
|
+
}),
|
|
12394
|
+
]
|
|
12395
|
+
: []),
|
|
12396
|
+
...(calendarSyncResult?.candidates
|
|
12397
|
+
? [
|
|
12398
|
+
jsx.jsx("span", { className: "balance-settings__sync-key", children: "候选模型" }),
|
|
12399
|
+
jsx.jsx("span", {
|
|
12400
|
+
className: "balance-settings__sync-val",
|
|
12401
|
+
style: { wordBreak: "break-all", lineHeight: "16px", fontSize: "10.5px" },
|
|
12402
|
+
children: calendarSyncResult.candidates,
|
|
12403
|
+
}),
|
|
12404
|
+
]
|
|
12405
|
+
: []),
|
|
12406
|
+
...(calendarSyncResult?.modelListRaw
|
|
12407
|
+
? [
|
|
12408
|
+
jsx.jsx("span", { className: "balance-settings__sync-key", children: "模型列表" }),
|
|
12409
|
+
jsx.jsx("span", {
|
|
12410
|
+
className: "balance-settings__sync-val",
|
|
12411
|
+
style: { wordBreak: "break-all", lineHeight: "15px", fontSize: "10px" },
|
|
12412
|
+
children: calendarSyncResult.modelListRaw,
|
|
12413
|
+
}),
|
|
12414
|
+
]
|
|
12415
|
+
: []),
|
|
12416
|
+
...(Array.isArray(calendarSyncResult?.failedYears) && calendarSyncResult.failedYears.length > 0
|
|
12417
|
+
? [
|
|
12418
|
+
jsx.jsx("span", { className: "balance-settings__sync-key", children: "失败年份" }),
|
|
12419
|
+
jsx.jsx("span", { className: "balance-settings__sync-val", children: calendarSyncResult.failedYears.join(" / ") }),
|
|
12420
|
+
]
|
|
12421
|
+
: []),
|
|
12422
|
+
],
|
|
12423
|
+
})
|
|
12424
|
+
: jsx.jsxs("div", {
|
|
12425
|
+
className: "balance-settings__sync",
|
|
12426
|
+
children: [
|
|
12427
|
+
jsx.jsxs("div", {
|
|
12428
|
+
className: "balance-settings__sync-grid",
|
|
12429
|
+
children: [
|
|
12430
|
+
jsx.jsx("span", { className: "balance-settings__sync-key", children: "同步年份" }),
|
|
11890
12431
|
jsx.jsx("span", {
|
|
11891
|
-
className: "balance-settings__sync-val
|
|
11892
|
-
|
|
11893
|
-
|
|
12432
|
+
className: "balance-settings__sync-val",
|
|
12433
|
+
children: Array.isArray(calendarSync.result?.years) && calendarSync.result.years.length > 0
|
|
12434
|
+
? calendarSync.result.years.join(" / ")
|
|
12435
|
+
: "没有变化",
|
|
11894
12436
|
}),
|
|
11895
|
-
|
|
11896
|
-
: []),
|
|
11897
|
-
...(calendarSyncResult?.chunkCount != null
|
|
11898
|
-
? [
|
|
11899
|
-
jsx.jsx("span", { className: "balance-settings__sync-key", children: "收到 chunk" }),
|
|
11900
|
-
jsx.jsx("span", { className: "balance-settings__sync-val", children: String(calendarSyncResult.chunkCount) }),
|
|
11901
|
-
]
|
|
11902
|
-
: []),
|
|
11903
|
-
...(calendarSyncResult?.chunkShape
|
|
11904
|
-
? [
|
|
11905
|
-
jsx.jsx("span", { className: "balance-settings__sync-key", children: "流结构" }),
|
|
12437
|
+
jsx.jsx("span", { className: "balance-settings__sync-key", children: "新增天数" }),
|
|
11906
12438
|
jsx.jsx("span", {
|
|
11907
12439
|
className: "balance-settings__sync-val",
|
|
11908
|
-
|
|
11909
|
-
|
|
12440
|
+
children: Number(calendarSync.result?.added ?? 0) > 0
|
|
12441
|
+
? calendarSync.result.added + " 天"
|
|
12442
|
+
: "0 天(已是最新)",
|
|
11910
12443
|
}),
|
|
11911
|
-
|
|
11912
|
-
: []),
|
|
11913
|
-
...(calendarSyncResult?.candidates
|
|
11914
|
-
? [
|
|
11915
|
-
jsx.jsx("span", { className: "balance-settings__sync-key", children: "候选模型" }),
|
|
12444
|
+
jsx.jsx("span", { className: "balance-settings__sync-key", children: "日历总量" }),
|
|
11916
12445
|
jsx.jsx("span", {
|
|
11917
12446
|
className: "balance-settings__sync-val",
|
|
11918
|
-
|
|
11919
|
-
|
|
12447
|
+
children: (calendar.count ?? 0) + " 天"
|
|
12448
|
+
+ (Array.isArray(calendar.missing) && calendar.missing.length > 0
|
|
12449
|
+
? "(" + calendar.missing.join(" / ") + " 待公布)"
|
|
12450
|
+
: ""),
|
|
11920
12451
|
}),
|
|
11921
|
-
|
|
11922
|
-
|
|
11923
|
-
|
|
11924
|
-
|
|
11925
|
-
|
|
12452
|
+
// 失败年份要进弹窗:光有「模型没跑成」看不出是哪一年没拿到。
|
|
12453
|
+
...(Array.isArray(calendarSync.result?.failedYears) && calendarSync.result.failedYears.length > 0
|
|
12454
|
+
? [
|
|
12455
|
+
jsx.jsx("span", { className: "balance-settings__sync-key", children: "失败年份" }),
|
|
12456
|
+
jsx.jsx("span", {
|
|
12457
|
+
className: "balance-settings__sync-val balance-settings__sync-val--warn",
|
|
12458
|
+
children: calendarSync.result.failedYears.join(" / ") + "(沿用本地数据)",
|
|
12459
|
+
}),
|
|
12460
|
+
]
|
|
12461
|
+
: []),
|
|
12462
|
+
jsx.jsx("span", { className: "balance-settings__sync-key", children: "数据来源" }),
|
|
11926
12463
|
jsx.jsx("span", {
|
|
11927
12464
|
className: "balance-settings__sync-val",
|
|
11928
|
-
|
|
11929
|
-
|
|
12465
|
+
children: calendarSync.result?.usage
|
|
12466
|
+
? "模型搜索国务院公告"
|
|
12467
|
+
: "没走模型(取的是第三方 JSON,未消耗 token)",
|
|
11930
12468
|
}),
|
|
11931
|
-
|
|
11932
|
-
|
|
11933
|
-
|
|
11934
|
-
|
|
11935
|
-
jsx.jsx("span", { className: "balance-settings__sync-key", children: "
|
|
11936
|
-
jsx.jsx("span", {
|
|
11937
|
-
|
|
11938
|
-
|
|
11939
|
-
|
|
11940
|
-
|
|
11941
|
-
|
|
11942
|
-
|
|
11943
|
-
|
|
11944
|
-
|
|
11945
|
-
|
|
11946
|
-
|
|
11947
|
-
|
|
11948
|
-
|
|
11949
|
-
|
|
11950
|
-
|
|
11951
|
-
|
|
11952
|
-
|
|
11953
|
-
|
|
11954
|
-
|
|
11955
|
-
|
|
11956
|
-
|
|
11957
|
-
|
|
11958
|
-
|
|
11959
|
-
|
|
11960
|
-
|
|
11961
|
-
|
|
11962
|
-
|
|
11963
|
-
|
|
11964
|
-
|
|
11965
|
-
|
|
11966
|
-
|
|
11967
|
-
|
|
11968
|
-
|
|
11969
|
-
|
|
11970
|
-
|
|
11971
|
-
|
|
11972
|
-
: "0 天(已是最新)",
|
|
11973
|
-
}),
|
|
11974
|
-
jsx.jsx("span", { className: "balance-settings__sync-key", children: "日历总量" }),
|
|
11975
|
-
jsx.jsx("span", {
|
|
11976
|
-
className: "balance-settings__sync-val",
|
|
11977
|
-
children: (calendar.count ?? 0) + " 天"
|
|
11978
|
-
+ (Array.isArray(calendar.missing) && calendar.missing.length > 0
|
|
11979
|
-
? "(" + calendar.missing.join(" / ") + " 待公布)"
|
|
11980
|
-
: ""),
|
|
11981
|
-
}),
|
|
11982
|
-
// 失败年份要进弹窗:光有「模型没跑成」看不出是哪一年没拿到。
|
|
11983
|
-
...(Array.isArray(calendarSync.result?.failedYears) && calendarSync.result.failedYears.length > 0
|
|
11984
|
-
? [
|
|
11985
|
-
jsx.jsx("span", { className: "balance-settings__sync-key", children: "失败年份" }),
|
|
11986
|
-
jsx.jsx("span", {
|
|
11987
|
-
className: "balance-settings__sync-val balance-settings__sync-val--warn",
|
|
11988
|
-
children: calendarSync.result.failedYears.join(" / ") + "(沿用本地数据)",
|
|
11989
|
-
}),
|
|
11990
|
-
]
|
|
11991
|
-
: []),
|
|
11992
|
-
jsx.jsx("span", { className: "balance-settings__sync-key", children: "数据来源" }),
|
|
11993
|
-
jsx.jsx("span", {
|
|
11994
|
-
className: "balance-settings__sync-val",
|
|
11995
|
-
children: calendarSync.result?.usage
|
|
11996
|
-
? "模型搜索国务院公告"
|
|
11997
|
-
: "没走模型(取的是第三方 JSON,未消耗 token)",
|
|
11998
|
-
}),
|
|
11999
|
-
jsx.jsx("span", { className: "balance-settings__sync-key", children: "本次消耗" }),
|
|
12000
|
-
jsx.jsx("span", {
|
|
12001
|
-
className: "balance-settings__sync-val" + (calendarSync.result?.usage ? " balance-settings__sync-val--cost" : ""),
|
|
12002
|
-
children: syncCostText(calendarSync.result?.usage),
|
|
12003
|
-
}),
|
|
12004
|
-
// 选了模型却没花钱,一定有个原因 —— 别让用户对着「未消耗 token」猜。
|
|
12005
|
-
// 用数组展开而不是 Fragment:项目的 jsx 工厂里没有 Fragment,别赌。
|
|
12006
|
-
...(calendarSync.result?.modelSkipReason
|
|
12007
|
-
? [
|
|
12008
|
-
jsx.jsx("span", { className: "balance-settings__sync-key", children: "模型没跑成" }),
|
|
12009
|
-
jsx.jsx("span", {
|
|
12010
|
-
className: "balance-settings__sync-val balance-settings__sync-val--warn",
|
|
12011
|
-
style: { wordBreak: "break-all", lineHeight: "17px" },
|
|
12012
|
-
children: calendarSync.result.modelSkipReason,
|
|
12013
|
-
}),
|
|
12014
|
-
]
|
|
12015
|
-
: []),
|
|
12016
|
-
],
|
|
12017
|
-
}),
|
|
12018
|
-
jsx.jsx("div", {
|
|
12019
|
-
className: "balance-settings__sync-note",
|
|
12020
|
-
children: "法定节假日全天按空闲价计费,调休上班的周末按工作日峰谷算。已写入本地配置,升级插件不会覆盖。",
|
|
12021
|
-
}),
|
|
12022
|
-
],
|
|
12023
|
-
}),
|
|
12024
|
-
})
|
|
12025
|
-
: null,
|
|
12469
|
+
// 「数据来源」说的是材料从哪来,「解析方式」说的是谁把材料变成日期 ——
|
|
12470
|
+
// 两件事,原来只写了前一半,用户对着弹窗问「怎么假期同步没有显示解析方式」
|
|
12471
|
+
// (2026-11-27)。模型名由服务端 calendarStatus() 的 `model` 带回来,
|
|
12472
|
+
// 走免费模式时是空串 → 显示内置规则。
|
|
12473
|
+
jsx.jsx("span", { className: "balance-settings__sync-key", children: "解析方式" }),
|
|
12474
|
+
jsx.jsx("span", {
|
|
12475
|
+
className: "balance-settings__sync-val" + (calendarSync.result?.usage ? " balance-settings__sync-val--warn" : ""),
|
|
12476
|
+
children: calendarSync.result?.usage
|
|
12477
|
+
? [
|
|
12478
|
+
"模型解析",
|
|
12479
|
+
// 同价格那边:模型名单独占一行,整串跟着「模型解析」会从 "v4-" 后面硬断
|
|
12480
|
+
jsx.jsx("span", { className: "balance-settings__sync-sub", children: "(" + (calendarSync.result?.model || "未知模型") + ")" }, "model"),
|
|
12481
|
+
]
|
|
12482
|
+
: "内置规则(未走模型,未消耗 token)",
|
|
12483
|
+
}),
|
|
12484
|
+
jsx.jsx("span", { className: "balance-settings__sync-key", children: "本次消耗" }),
|
|
12485
|
+
jsx.jsx("span", {
|
|
12486
|
+
className: "balance-settings__sync-val" + (calendarSync.result?.usage ? " balance-settings__sync-val--cost" : ""),
|
|
12487
|
+
children: syncCostText(calendarSync.result?.usage),
|
|
12488
|
+
}),
|
|
12489
|
+
// 选了模型却没花钱,一定有个原因 —— 别让用户对着「未消耗 token」猜。
|
|
12490
|
+
// 用数组展开而不是 Fragment:项目的 jsx 工厂里没有 Fragment,别赌。
|
|
12491
|
+
...(calendarSync.result?.modelSkipReason
|
|
12492
|
+
? [
|
|
12493
|
+
jsx.jsx("span", { className: "balance-settings__sync-key", children: "模型没跑成" }),
|
|
12494
|
+
jsx.jsx("span", {
|
|
12495
|
+
className: "balance-settings__sync-val balance-settings__sync-val--warn",
|
|
12496
|
+
style: { wordBreak: "break-all", lineHeight: "17px" },
|
|
12497
|
+
children: calendarSync.result.modelSkipReason,
|
|
12498
|
+
}),
|
|
12499
|
+
]
|
|
12500
|
+
: []),
|
|
12501
|
+
],
|
|
12502
|
+
}),
|
|
12503
|
+
jsx.jsx("div", {
|
|
12504
|
+
className: "balance-settings__sync-note",
|
|
12505
|
+
children: "法定节假日全天按空闲价计费,调休上班的周末按工作日峰谷算。已写入本地配置,升级插件不会覆盖。",
|
|
12506
|
+
}),
|
|
12507
|
+
],
|
|
12508
|
+
}),
|
|
12509
|
+
}),
|
|
12026
12510
|
|
|
12027
12511
|
// 关掉侧边栏入口后的提醒:直接用 DSH 官方 Modal 渲染。
|
|
12028
12512
|
tipModal && sidebarTip
|