mirror of
https://github.com/zyycn/codex-proxy-rs.git
synced 2026-11-23 00:00:28 +00:00
fix(accounts): move CPR link detection to the quota card
Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
+1
-1
@@ -438,7 +438,7 @@ PostgreSQL/Redis 启动密码。日常校验使用 `config --quiet`
|
||||
|
||||
在下游导入或编辑 OpenAI API Key 账号,填写上游 API 地址和该 Key,后台自动发现 CPR 互联能力。
|
||||
地址包含自定义前缀时保留完整前缀,后台在该地址下请求 `cpr/link`。
|
||||
可在账号行的「更多操作」中选择「检测 CPR 互联」手动识别。识别成功后账号显示为 CPR,展开可查看上游密钥限制和刷新额度。普通账号并发留空时跟随上游有效的正数上限。上游明确关闭共享或不支持互联时,账号显示为 API
|
||||
展开账号行,点击「账号额度」右上角的链环图标可手动检测 CPR 互联。识别成功后账号显示为 CPR,可在「上游额度」查看上游密钥限制和刷新额度。普通账号并发留空时跟随上游有效的正数上限。上游明确关闭共享或不支持互联时,账号显示为 API
|
||||
|
||||
第三方网关通过插件实现相同协议也可被识别,不按软件名称判定兼容。
|
||||
上游明确返回 Key 预算耗尽时,下游暂停该账号;后续同步确认允许使用后自动恢复,普通限流冷却独立保留。
|
||||
|
||||
+1
-1
@@ -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 支持手动检测。明确不支持协议的连接停止周期探测,共享关闭的连接按授权退避周期复查
|
||||
|
||||
账号地址、密钥或出口变更使旧观测与识别身份失效,重新识别当前连接。
|
||||
账号停用后停止同步,重新启用后按当前连接的识别结果恢复后台任务
|
||||
|
||||
@@ -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 === '
|
||||
</template>
|
||||
{{ t('accounts.connectionTest.title') }}
|
||||
</ZMenuItem>
|
||||
<ZMenuItem
|
||||
v-if="account.upstream && !account.upstream.discovered"
|
||||
:loading="refreshingQuota"
|
||||
:disabled="refreshingQuota"
|
||||
@click.stop="emit('discoverPeer', account.id)"
|
||||
>
|
||||
<template #icon>
|
||||
<Link2 class="size-3.5 text-z-text-quaternary" />
|
||||
</template>
|
||||
{{ t('accounts.actions.discoverPeer') }}
|
||||
</ZMenuItem>
|
||||
<ZMenuItem
|
||||
:loading="togglingScheduling"
|
||||
:disabled="togglingScheduling"
|
||||
|
||||
@@ -3,7 +3,7 @@ import type { Account } from '@/api'
|
||||
|
||||
import { ZEmpty, ZScrollbar } from '@codex-proxy/ui'
|
||||
|
||||
import { ChartNoAxesCombined, RefreshCw, UserRound } from '@lucide/vue'
|
||||
import { ChartNoAxesCombined, Link2, RefreshCw, UserRound } from '@lucide/vue'
|
||||
|
||||
import { computed, shallowRef, watch } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
@@ -45,7 +45,8 @@ const forecastOpen = shallowRef(false)
|
||||
const hasPlanBadge = computed(() => 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) => {
|
||||
</QuotaActionButton>
|
||||
<QuotaActionButton
|
||||
v-if="canRefresh"
|
||||
:label="t('accounts.quotaForecast.refreshQuota')"
|
||||
:label="needsPeerDiscovery ? t('accounts.actions.discoverPeer') : t('accounts.quotaForecast.refreshQuota')"
|
||||
:loading="refreshing"
|
||||
:disabled="refreshing"
|
||||
@click="emit('refreshQuota', account.id)"
|
||||
@@ -120,7 +121,8 @@ watch(hasPersonalInfo, (available) => {
|
||||
<template #loading>
|
||||
<RefreshCw class="size-3.5 animate-spin motion-reduce:animate-none" />
|
||||
</template>
|
||||
<RefreshCw class="size-3.5" />
|
||||
<Link2 v-if="needsPeerDiscovery" class="size-3.5" />
|
||||
<RefreshCw v-else class="size-3.5" />
|
||||
</QuotaActionButton>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user