mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-11-29 15:35:11 +00:00
fix: 完善上游 Sub2API 计费倍率探测与账号展示
This commit is contained in:
1 parent
bc50c9d013
commit
d2585097f3
30 files changed
+1311
-183
No files matched your search
@@ -854,6 +854,45 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Upstream billing auto probe (OpenAI API Key only) -->
|
||||
<div v-if="allOpenAIAPIKey" class="border-t border-gray-200 pt-4 dark:border-dark-600">
|
||||
<div class="mb-3 flex items-center justify-between">
|
||||
<div class="flex-1 pr-4">
|
||||
<label
|
||||
id="bulk-edit-upstream-billing-auto-probe-label"
|
||||
class="input-label mb-0"
|
||||
for="bulk-edit-upstream-billing-auto-probe-enabled"
|
||||
>
|
||||
{{ t('admin.accounts.upstreamBilling.autoProbe') }}
|
||||
</label>
|
||||
<p class="mt-1 text-xs text-gray-500 dark:text-gray-400">
|
||||
{{ t('admin.accounts.upstreamBilling.autoProbeHint') }}
|
||||
</p>
|
||||
</div>
|
||||
<input
|
||||
v-model="enableUpstreamBillingAutoProbe"
|
||||
id="bulk-edit-upstream-billing-auto-probe-enabled"
|
||||
type="checkbox"
|
||||
aria-controls="bulk-edit-upstream-billing-auto-probe"
|
||||
class="rounded border-gray-300 text-primary-600 focus:ring-primary-500"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
id="bulk-edit-upstream-billing-auto-probe"
|
||||
:class="!enableUpstreamBillingAutoProbe && 'pointer-events-none opacity-50'"
|
||||
role="group"
|
||||
aria-labelledby="bulk-edit-upstream-billing-auto-probe-label"
|
||||
>
|
||||
<Select
|
||||
v-model="upstreamBillingAutoProbeMode"
|
||||
:disabled="!enableUpstreamBillingAutoProbe"
|
||||
data-testid="bulk-edit-upstream-billing-auto-probe-select"
|
||||
:options="upstreamBillingAutoProbeOptions"
|
||||
aria-labelledby="bulk-edit-upstream-billing-auto-probe-label"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- OpenAI API Key WS mode -->
|
||||
<div v-if="allOpenAIAPIKey" class="border-t border-gray-200 pt-4 dark:border-dark-600">
|
||||
<div class="mb-3 flex items-center justify-between">
|
||||
@@ -1361,6 +1400,7 @@ const enableGroups = ref(false)
|
||||
const enableOpenAIPassthrough = ref(false)
|
||||
const enableOpenAIWSMode = ref(false)
|
||||
const enableOpenAIAPIKeyWSMode = ref(false)
|
||||
const enableUpstreamBillingAutoProbe = ref(false)
|
||||
const enableCodexCLIOnly = ref(false)
|
||||
const enableCodexCLIOnlyAppServer = ref(false)
|
||||
const enableOpenAICompactMode = ref(false)
|
||||
@@ -1391,6 +1431,7 @@ const groupIds = ref<number[]>([])
|
||||
const openaiPassthroughEnabled = ref(false)
|
||||
const openaiOAuthResponsesWebSocketV2Mode = ref<OpenAIWSMode>(OPENAI_WS_MODE_OFF)
|
||||
const openaiAPIKeyResponsesWebSocketV2Mode = ref<OpenAIWSMode>(OPENAI_WS_MODE_OFF)
|
||||
const upstreamBillingAutoProbeMode = ref<'enabled' | 'disabled'>('enabled')
|
||||
const codexCLIOnlyEnabled = ref(false)
|
||||
const codexCLIOnlyAppServerEnabled = ref(false)
|
||||
const openAICompactMode = ref<OpenAICompactMode>('auto')
|
||||
@@ -1421,6 +1462,10 @@ const statusOptions = computed(() => [
|
||||
{ value: 'active', label: t('common.active') },
|
||||
{ value: 'inactive', label: t('common.inactive') }
|
||||
])
|
||||
const upstreamBillingAutoProbeOptions = computed(() => [
|
||||
{ value: 'enabled', label: t('common.enabled') },
|
||||
{ value: 'disabled', label: t('common.disabled') }
|
||||
])
|
||||
const isOpenAIModelRestrictionDisabled = computed(
|
||||
() =>
|
||||
allOpenAIPassthroughCapable.value &&
|
||||
@@ -1648,6 +1693,10 @@ const buildUpdatePayload = (): Record<string, unknown> | null => {
|
||||
)
|
||||
}
|
||||
|
||||
if (enableUpstreamBillingAutoProbe.value) {
|
||||
updates.upstream_billing_probe_enabled = upstreamBillingAutoProbeMode.value === 'enabled'
|
||||
}
|
||||
|
||||
if (enableCodexCLIOnly.value) {
|
||||
const extra = ensureExtra()
|
||||
extra.codex_cli_only = codexCLIOnlyEnabled.value
|
||||
@@ -1770,6 +1819,7 @@ const handleSubmit = async () => {
|
||||
enableGroups.value ||
|
||||
enableOpenAIWSMode.value ||
|
||||
enableOpenAIAPIKeyWSMode.value ||
|
||||
enableUpstreamBillingAutoProbe.value ||
|
||||
enableCodexCLIOnly.value ||
|
||||
enableCodexCLIOnlyAppServer.value ||
|
||||
enableOpenAICompactMode.value ||
|
||||
@@ -1898,6 +1948,7 @@ watch(
|
||||
enableOpenAIPassthrough.value = false
|
||||
enableOpenAIWSMode.value = false
|
||||
enableOpenAIAPIKeyWSMode.value = false
|
||||
enableUpstreamBillingAutoProbe.value = false
|
||||
enableCodexCLIOnly.value = false
|
||||
enableCodexCLIOnlyAppServer.value = false
|
||||
enableOpenAICompactMode.value = false
|
||||
@@ -1924,6 +1975,7 @@ watch(
|
||||
groupIds.value = []
|
||||
openaiOAuthResponsesWebSocketV2Mode.value = OPENAI_WS_MODE_OFF
|
||||
openaiAPIKeyResponsesWebSocketV2Mode.value = OPENAI_WS_MODE_OFF
|
||||
upstreamBillingAutoProbeMode.value = 'enabled'
|
||||
codexCLIOnlyEnabled.value = false
|
||||
codexCLIOnlyAppServerEnabled.value = false
|
||||
openAICompactMode.value = 'auto'
|
||||
|
||||
Reference in new issue
Block a user