From 654019d7eb33485f94b0247aeb242c9e92710b9c Mon Sep 17 00:00:00 2001 From: Lollipopdamn <2516731482@qq.com> Date: Thu, 12 Nov 2026 21:40:46 +0800 Subject: [PATCH] fix(ui): show rates and contain usage popovers --- LOCAL_FORK.md | 6 ++ backend/cmd/server/VERSION | 2 +- .../service/update_source_baselines.go | 4 +- docs/release-notes/v2.1.63.md | 14 +++++ .../account/UpstreamBillingRateCell.vue | 10 +-- .../__tests__/UpstreamBillingRateCell.spec.ts | 11 +++- .../admin/usage/UsageStatsCards.vue | 2 +- .../notes/upstream-sync-20261112-v2358.md | 51 +++++++++++++++ maintenance/upstream.lock.json | 63 +++++++++++++++---- 9 files changed, 136 insertions(+), 27 deletions(-) create mode 100644 docs/release-notes/v2.1.63.md create mode 100644 maintenance/notes/upstream-sync-20261112-v2358.md diff --git a/LOCAL_FORK.md b/LOCAL_FORK.md index 2282bda..15d2826 100644 --- a/LOCAL_FORK.md +++ b/LOCAL_FORK.md @@ -30,6 +30,12 @@ 原生支付模块已退役,充值使用链动小铺及兑换码。服务器部署继续使用备份和校验后的受控发布流程。 +## 二改 v2.3.58 选择性同步(2026-11-12) + +从正式 v2.3.54 审查至 v2.3.58,适配声明倍率始终显示数字,以及管理端、用户端用量缓存明细浮层的窄屏越界。保留现有倍率时效/峰值计算、原生厂商路由、真实终态用量与冷灰蓝主题。 + +仓库层统计缓存会与本地管理端缓存重叠,并让用户统计默认滞后最多 60 秒,暂缓采用;IP 自动风控/停用 Key、上游类型与余额探测、Auth Quiet 和定时器改版继续延期,退役原生支付不恢复。无迁移、依赖或运行配置变化。用户随后授权审查后提交 GitHub 并更新部署,个人版本推进至 v2.1.63,沿用 PR、CI、自有 Release/GHCR 和备份恢复校验流程。范围与同步验证见[同步记录](maintenance/notes/upstream-sync-20261112-v2358.md)及[发布说明](docs/release-notes/v2.1.63.md),最终制品与部署验收另存发布证据。 + ## 二改 v2.3.54 选择性同步(2026-11-12) 从正式 v2.3.50 审查至 v2.3.54,适配 Kimi/Moonshot 缓存响应头和跨域可读性、手动模型同步保留中转站的跨厂商模型,以及自定义错误码账号不被网络错误额外停调。官方默认及区域端点继续按厂商过滤,未配置自定义错误码的账号保留持续网络故障冷却;本地原生路由、计费、真实终态用量与冷灰蓝主题保持原契约。 diff --git a/backend/cmd/server/VERSION b/backend/cmd/server/VERSION index bd178cf..6a6199d 100644 --- a/backend/cmd/server/VERSION +++ b/backend/cmd/server/VERSION @@ -1 +1 @@ -2.1.62 +2.1.63 diff --git a/backend/internal/service/update_source_baselines.go b/backend/internal/service/update_source_baselines.go index 06e8e26..a4ee9e2 100644 --- a/backend/internal/service/update_source_baselines.go +++ b/backend/internal/service/update_source_baselines.go @@ -4,8 +4,8 @@ package service // this project's release version. A reviewed checkpoint does not imply every // feature was merged. Update only after the corresponding review/sync completes. const ( - forkImportedVersion = "2.3.54" - forkImportedCommit = "e30c61bb257b0c5840260b9d2cabcde0c3bd6369" + forkImportedVersion = "2.3.58" + forkImportedCommit = "28ff1b3d41dddb2959892e66f4b410b064a266d4" originalReviewedCommit = "10ba8f9b4dc2e6023d4a9879ab77b21841babd10" ) diff --git a/docs/release-notes/v2.1.63.md b/docs/release-notes/v2.1.63.md new file mode 100644 index 0000000..d0eff82 --- /dev/null +++ b/docs/release-notes/v2.1.63.md @@ -0,0 +1,14 @@ +选择性同步二改正式 v2.3.58,改进声明倍率显示并修复用量明细浮层的窄屏越界。 + +## 更新 + +- 上游声明倍率始终显示实际数字;开启倍率同步且与账号倍率相同时,也直接显示 `0.15x` 等数值。保留峰值重算、数据时效、失败/过期状态和手动刷新。 +- 管理员和用户的用量页缓存明细浮层改为右侧对齐,修复窄屏下明细超出视口和横向滚动的问题,保留悬停与键盘聚焦操作。 + +二改来源检查点从 v2.3.54 推进至 v2.3.58,原版仍为 v0.2.21。仓库层统计缓存、IP 自动风控/停用 Key、上游类型与余额探测、Auth Quiet 和定时器改版继续延期;退役支付模块不恢复。取舍与依据见[同步记录](../../maintenance/notes/upstream-sync-20261112-v2358.md)。 + +## 验证与范围 + +本地 30 项前端定向回归、3 项 i18n 完整性和 2 项来源检查点测试通过;类型检查、定向 lint、生产构建和资源路径校验通过。两端用量页 12 个浅深主题/视口布局场景,以及账号页 4 个主题/倍率列显隐组合的浏览器交互检查通过。发布前独立审查、最终 GitHub CI、制品身份与线上验收另存发布证据。 + +无依赖、数据库迁移或运行配置变化。保留本地原生路由、计费、真实终态用量与冷灰蓝主题;三份原有未跟踪用量测试保持原样且不纳入提交。 diff --git a/frontend/src/components/account/UpstreamBillingRateCell.vue b/frontend/src/components/account/UpstreamBillingRateCell.vue index 3c90268..72e8ba7 100644 --- a/frontend/src/components/account/UpstreamBillingRateCell.vue +++ b/frontend/src/components/account/UpstreamBillingRateCell.vue @@ -4,10 +4,10 @@
@@ -210,12 +210,6 @@ const statusClass = computed(() => { return '' }) const hasEffectiveRate = computed(() => effectiveRate.value !== '-') -const sameAsAccount = computed(() => - props.accountRateVisible === true && - props.account.extra?.upstream_billing_rate_sync_enabled === true && - hasEffectiveRate.value && !statusLabel.value && - currentEffectiveRate.value === (props.account.rate_multiplier ?? 1) -) const primaryValue = computed(() => hasEffectiveRate.value ? effectiveRate.value : statusLabel.value || '-') const formatDate = (value?: string) => value ? new Date(value).toLocaleString(undefined, { diff --git a/frontend/src/components/account/__tests__/UpstreamBillingRateCell.spec.ts b/frontend/src/components/account/__tests__/UpstreamBillingRateCell.spec.ts index f38368a..cb843eb 100644 --- a/frontend/src/components/account/__tests__/UpstreamBillingRateCell.spec.ts +++ b/frontend/src/components/account/__tests__/UpstreamBillingRateCell.spec.ts @@ -68,18 +68,25 @@ describe('UpstreamBillingRateCell', () => { vi.useRealTimers() }) - it('deduplicates only with a visible account-rate column and restores the number for peak or failed data', async () => { + it('keeps the numeric declared rate with either account-rate column visibility and for peak or failed data', async () => { const account = makeAccount({ rate_multiplier: 0.6, extra: { upstream_billing_rate_sync_enabled: true, upstream_billing_probe: { status: 'ok', data: billingData, received_at: '2026-07-13T00:00:00Z', fresh_until: '2026-07-14T00:00:00Z' } } }) const wrapper = mount(UpstreamBillingRateCell, { props: { account, now: Date.now(), accountRateVisible: true } }) const value = () => wrapper.get('[data-testid="upstream-billing-rate"]').text() - expect(value()).toBe('admin.accounts.upstreamBilling.sameAsAccount') + expect(value()).toBe('0.60x') await wrapper.setProps({ accountRateVisible: false }); expect(value()).toBe('0.60x') await wrapper.setProps({ accountRateVisible: true, now: Date.parse('2026-07-13T01:00:00Z') }); expect(value()).toBe('0.90x') await wrapper.setProps({ now: Date.now(), account: { ...account, extra: { ...account.extra, upstream_billing_probe: { ...account.extra!.upstream_billing_probe!, status: 'failed' } } } }); expect(value()).toBe('0.60x') + await wrapper.setProps({ account: { ...account, rate_multiplier: 0.15, extra: { + ...account.extra, + upstream_billing_probe: { ...account.extra!.upstream_billing_probe!, data: { + ...billingData, resolved_rate_multiplier: 0.15, effective_rate_multiplier: 0.15, peak_rate_enabled: false + } } + } } }) + expect(value()).toBe('0.15x') wrapper.unmount() }) diff --git a/frontend/src/components/admin/usage/UsageStatsCards.vue b/frontend/src/components/admin/usage/UsageStatsCards.vue index 3646b24..c4c3306 100644 --- a/frontend/src/components/admin/usage/UsageStatsCards.vue +++ b/frontend/src/components/admin/usage/UsageStatsCards.vue @@ -36,7 +36,7 @@ />