From 58cbb607505dda4a1cee6e01b9f76e267ad3c261 Mon Sep 17 00:00:00 2001 From: Zyy Date: Sun, 22 Nov 2026 01:02:28 +0800 Subject: [PATCH] fix(accounts): move CPR link detection to the quota card Co-authored-by: Codex --- deploy/README.md | 2 +- docs/api.md | 2 +- .../accounts/components/AccountTableActions.vue | 15 +-------------- .../components/account-quota-panel/index.vue | 10 ++++++---- frontend/src/views/accounts/index.vue | 2 -- 5 files changed, 9 insertions(+), 22 deletions(-) diff --git a/deploy/README.md b/deploy/README.md index d3afa6dc8..fc78ad6d6 100644 --- a/deploy/README.md +++ b/deploy/README.md @@ -438,7 +438,7 @@ PostgreSQL/Redis 启动密码。日常校验使用 `config --quiet` 在下游导入或编辑 OpenAI API Key 账号,填写上游 API 地址和该 Key,后台自动发现 CPR 互联能力。 地址包含自定义前缀时保留完整前缀,后台在该地址下请求 `cpr/link`。 -可在账号行的「更多操作」中选择「检测 CPR 互联」手动识别。识别成功后账号显示为 CPR,展开可查看上游密钥限制和刷新额度。普通账号并发留空时跟随上游有效的正数上限。上游明确关闭共享或不支持互联时,账号显示为 API +展开账号行,点击「账号额度」右上角的链环图标可手动检测 CPR 互联。识别成功后账号显示为 CPR,可在「上游额度」查看上游密钥限制和刷新额度。普通账号并发留空时跟随上游有效的正数上限。上游明确关闭共享或不支持互联时,账号显示为 API 第三方网关通过插件实现相同协议也可被识别,不按软件名称判定兼容。 上游明确返回 Key 预算耗尽时,下游暂停该账号;后续同步确认允许使用后自动恢复,普通限流冷却独立保留。 diff --git a/docs/api.md b/docs/api.md index 0408ff8ce..459a296b4 100644 --- a/docs/api.md +++ b/docs/api.md @@ -1386,7 +1386,7 @@ Key 消费窗口的 `localUsage` 按各自 `[resetAt - windowSeconds, resetAt)` - 收到有效快照时显示 CPR 互联。明确返回不支持协议(HTTP 404、405、501),或返回 `403 peer_sharing_disabled` 时,清除互联身份和共享数据,显示普通 API Key - 普通 401/403 保留原识别结果并清除已撤销的共享内容。超时、限流、服务异常或无效响应保留原识别结果和已有观测。无观测时 `observedAt` 与 `pool` 为 `null`,额度窗口为空 -- 可探测但尚未识别为互联的 API Key,可在账号行的「更多操作」中选择「检测 CPR 互联」。识别成功后可在额度卡点击「刷新额度」。明确不支持协议的连接停止周期探测,共享关闭的连接按授权退避周期复查 +- 可探测但尚未识别为互联的 API Key 支持手动检测。明确不支持协议的连接停止周期探测,共享关闭的连接按授权退避周期复查 账号地址、密钥或出口变更使旧观测与识别身份失效,重新识别当前连接。 账号停用后停止同步,重新启用后按当前连接的识别结果恢复后台任务 diff --git a/frontend/src/views/accounts/components/AccountTableActions.vue b/frontend/src/views/accounts/components/AccountTableActions.vue index 88368bf8c..0bee32248 100644 --- a/frontend/src/views/accounts/components/AccountTableActions.vue +++ b/frontend/src/views/accounts/components/AccountTableActions.vue @@ -3,7 +3,7 @@ import type { Account } from '@/api' import { ZIconButton, ZMenuItem } from '@codex-proxy/ui' -import { Download, KeyRound, Link2, Pencil, Power, RefreshCw, RotateCcw, Trash2, Wifi } from '@lucide/vue' +import { Download, KeyRound, Pencil, Power, RefreshCw, RotateCcw, Trash2, Wifi } from '@lucide/vue' import { computed } from 'vue' import { useI18n } from 'vue-i18n' @@ -15,7 +15,6 @@ const props = defineProps<{ downloadingCatalog: boolean recovering: boolean refreshing: boolean - refreshingQuota: boolean testing: boolean togglingScheduling: boolean }>() @@ -26,7 +25,6 @@ const emit = defineEmits<{ recover: [accountId: string] test: [account: Account] refresh: [accountId: string] - discoverPeer: [accountId: string] reauthorize: [account: Account] downloadModelCatalog: [account: Account] toggleScheduling: [account: Account] @@ -67,17 +65,6 @@ const credentialEligible = computed(() => props.account.authenticationKind === ' {{ t('accounts.connectionTest.title') }} - - - {{ t('accounts.actions.discoverPeer') }} - Boolean(props.account.planType) || props.account.authenticationKind === 'api_key') const hasForecast = computed(() => props.account.authenticationKind !== 'api_key') const hasPersonalInfo = computed(() => props.account.capabilities.profile || props.account.capabilities.subscription) -const canRefresh = computed(() => props.account.capabilities.quotaRefresh || props.account.upstream?.discovered) +const needsPeerDiscovery = computed(() => props.account.upstream?.discovered === false) +const canRefresh = computed(() => props.account.capabilities.quotaRefresh || props.account.upstream != null) const hasActions = computed(() => hasPersonalInfo.value || hasForecast.value || canRefresh.value || props.account.capabilities.resetCredits) const lastRefreshed = computed(() => { const { upstream, quota } = props.account @@ -112,7 +113,7 @@ watch(hasPersonalInfo, (available) => { { - + + diff --git a/frontend/src/views/accounts/index.vue b/frontend/src/views/accounts/index.vue index 2b50aee5b..bd3e9cd0e 100644 --- a/frontend/src/views/accounts/index.vue +++ b/frontend/src/views/accounts/index.vue @@ -353,13 +353,11 @@ const { :downloading-catalog="downloadingCatalogAccountIds.has(row.id)" :recovering="recoveringAccountIds.has(row.id)" :refreshing="refreshingAccountIds.has(row.id)" - :refreshing-quota="refreshingQuotaAccountIds.has(row.id)" :testing="testingAccountId === row.id" :toggling-scheduling="togglingSchedulingAccountIds.has(row.id)" @edit="openAccountEdit" @delete="requestDeleteAccount" @download-model-catalog="handleDownloadModelCatalog" - @discover-peer="handleRefreshQuota" @recover="handleRecover" @refresh="handleRefresh" @reauthorize="openReauthorizeAccount"