feat: align OpenAI bulk edit compact settings
This commit is contained in:
parent
c5a1a82223
commit
a161f9d045
@ -698,6 +698,87 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- OpenAI OAuth Codex CLI only -->
|
||||||
|
<div v-if="allOpenAIOAuth" class="border-t border-gray-200 pt-4 dark:border-dark-600">
|
||||||
|
<div class="mb-3 flex items-center justify-between">
|
||||||
|
<label
|
||||||
|
id="bulk-edit-openai-codex-cli-only-label"
|
||||||
|
class="input-label mb-0"
|
||||||
|
for="bulk-edit-openai-codex-cli-only-enabled"
|
||||||
|
>
|
||||||
|
{{ t('admin.accounts.openai.codexCLIOnly') }}
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
v-model="enableCodexCLIOnly"
|
||||||
|
id="bulk-edit-openai-codex-cli-only-enabled"
|
||||||
|
type="checkbox"
|
||||||
|
aria-controls="bulk-edit-openai-codex-cli-only"
|
||||||
|
class="rounded border-gray-300 text-primary-600 focus:ring-primary-500"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
id="bulk-edit-openai-codex-cli-only"
|
||||||
|
:class="!enableCodexCLIOnly && 'pointer-events-none opacity-50'"
|
||||||
|
>
|
||||||
|
<p class="mb-3 text-xs text-gray-500 dark:text-gray-400">
|
||||||
|
{{ t('admin.accounts.openai.codexCLIOnlyDesc') }}
|
||||||
|
</p>
|
||||||
|
<button
|
||||||
|
id="bulk-edit-openai-codex-cli-only-toggle"
|
||||||
|
type="button"
|
||||||
|
:class="[
|
||||||
|
'relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-2',
|
||||||
|
codexCLIOnlyEnabled ? 'bg-primary-600' : 'bg-gray-200 dark:bg-dark-600'
|
||||||
|
]"
|
||||||
|
@click="codexCLIOnlyEnabled = !codexCLIOnlyEnabled"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
:class="[
|
||||||
|
'pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out',
|
||||||
|
codexCLIOnlyEnabled ? 'translate-x-5' : 'translate-x-0'
|
||||||
|
]"
|
||||||
|
/>
|
||||||
|
</button>
|
||||||
|
</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">
|
||||||
|
<label
|
||||||
|
id="bulk-edit-openai-apikey-ws-mode-label"
|
||||||
|
class="input-label mb-0"
|
||||||
|
for="bulk-edit-openai-apikey-ws-mode-enabled"
|
||||||
|
>
|
||||||
|
{{ t('admin.accounts.openai.wsMode') }}
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
v-model="enableOpenAIAPIKeyWSMode"
|
||||||
|
id="bulk-edit-openai-apikey-ws-mode-enabled"
|
||||||
|
type="checkbox"
|
||||||
|
aria-controls="bulk-edit-openai-apikey-ws-mode"
|
||||||
|
class="rounded border-gray-300 text-primary-600 focus:ring-primary-500"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
id="bulk-edit-openai-apikey-ws-mode"
|
||||||
|
:class="!enableOpenAIAPIKeyWSMode && 'pointer-events-none opacity-50'"
|
||||||
|
>
|
||||||
|
<p class="mb-3 text-xs text-gray-500 dark:text-gray-400">
|
||||||
|
{{ t('admin.accounts.openai.wsModeDesc') }}
|
||||||
|
</p>
|
||||||
|
<p class="mb-3 text-xs text-gray-500 dark:text-gray-400">
|
||||||
|
{{ t(openAIAPIKeyWSModeConcurrencyHintKey) }}
|
||||||
|
</p>
|
||||||
|
<Select
|
||||||
|
v-model="openaiAPIKeyResponsesWebSocketV2Mode"
|
||||||
|
data-testid="bulk-edit-openai-apikey-ws-mode-select"
|
||||||
|
:options="openAIWSModeOptions"
|
||||||
|
aria-labelledby="bulk-edit-openai-apikey-ws-mode-label"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- RPM Limit (仅全部为 Anthropic OAuth/SetupToken 时显示) -->
|
<!-- RPM Limit (仅全部为 Anthropic OAuth/SetupToken 时显示) -->
|
||||||
<div v-if="allAnthropicOAuthOrSetupToken" class="border-t border-gray-200 pt-4 dark:border-dark-600">
|
<div v-if="allAnthropicOAuthOrSetupToken" class="border-t border-gray-200 pt-4 dark:border-dark-600">
|
||||||
<div class="mb-3 flex items-center justify-between">
|
<div class="mb-3 flex items-center justify-between">
|
||||||
@ -1032,6 +1113,8 @@ const enableStatus = ref(false)
|
|||||||
const enableGroups = ref(false)
|
const enableGroups = ref(false)
|
||||||
const enableOpenAIPassthrough = ref(false)
|
const enableOpenAIPassthrough = ref(false)
|
||||||
const enableOpenAIWSMode = ref(false)
|
const enableOpenAIWSMode = ref(false)
|
||||||
|
const enableOpenAIAPIKeyWSMode = ref(false)
|
||||||
|
const enableCodexCLIOnly = ref(false)
|
||||||
const enableRpmLimit = ref(false)
|
const enableRpmLimit = ref(false)
|
||||||
|
|
||||||
// State - field values
|
// State - field values
|
||||||
@ -1055,6 +1138,8 @@ const status = ref<'active' | 'inactive'>('active')
|
|||||||
const groupIds = ref<number[]>([])
|
const groupIds = ref<number[]>([])
|
||||||
const openaiPassthroughEnabled = ref(false)
|
const openaiPassthroughEnabled = ref(false)
|
||||||
const openaiOAuthResponsesWebSocketV2Mode = ref<OpenAIWSMode>(OPENAI_WS_MODE_OFF)
|
const openaiOAuthResponsesWebSocketV2Mode = ref<OpenAIWSMode>(OPENAI_WS_MODE_OFF)
|
||||||
|
const openaiAPIKeyResponsesWebSocketV2Mode = ref<OpenAIWSMode>(OPENAI_WS_MODE_OFF)
|
||||||
|
const codexCLIOnlyEnabled = ref(false)
|
||||||
const rpmLimitEnabled = ref(false)
|
const rpmLimitEnabled = ref(false)
|
||||||
const bulkBaseRpm = ref<number | null>(null)
|
const bulkBaseRpm = ref<number | null>(null)
|
||||||
const bulkRpmStrategy = ref<'tiered' | 'sticky_exempt'>('tiered')
|
const bulkRpmStrategy = ref<'tiered' | 'sticky_exempt'>('tiered')
|
||||||
@ -1096,6 +1181,9 @@ const openAIWSModeOptions = computed(() => [
|
|||||||
const openAIWSModeConcurrencyHintKey = computed(() =>
|
const openAIWSModeConcurrencyHintKey = computed(() =>
|
||||||
resolveOpenAIWSModeConcurrencyHintKey(openaiOAuthResponsesWebSocketV2Mode.value)
|
resolveOpenAIWSModeConcurrencyHintKey(openaiOAuthResponsesWebSocketV2Mode.value)
|
||||||
)
|
)
|
||||||
|
const openAIAPIKeyWSModeConcurrencyHintKey = computed(() =>
|
||||||
|
resolveOpenAIWSModeConcurrencyHintKey(openaiAPIKeyResponsesWebSocketV2Mode.value)
|
||||||
|
)
|
||||||
|
|
||||||
// Model mapping helpers
|
// Model mapping helpers
|
||||||
const addModelMapping = () => {
|
const addModelMapping = () => {
|
||||||
@ -1274,6 +1362,19 @@ const buildUpdatePayload = (): Record<string, unknown> | null => {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (enableOpenAIAPIKeyWSMode.value) {
|
||||||
|
const extra = ensureExtra()
|
||||||
|
extra.openai_apikey_responses_websockets_v2_mode = openaiAPIKeyResponsesWebSocketV2Mode.value
|
||||||
|
extra.openai_apikey_responses_websockets_v2_enabled = isOpenAIWSModeEnabled(
|
||||||
|
openaiAPIKeyResponsesWebSocketV2Mode.value
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (enableCodexCLIOnly.value) {
|
||||||
|
const extra = ensureExtra()
|
||||||
|
extra.codex_cli_only = codexCLIOnlyEnabled.value
|
||||||
|
}
|
||||||
|
|
||||||
// RPM limit settings (写入 extra 字段)
|
// RPM limit settings (写入 extra 字段)
|
||||||
if (enableRpmLimit.value) {
|
if (enableRpmLimit.value) {
|
||||||
const extra = ensureExtra()
|
const extra = ensureExtra()
|
||||||
@ -1364,6 +1465,8 @@ const handleSubmit = async () => {
|
|||||||
enableStatus.value ||
|
enableStatus.value ||
|
||||||
enableGroups.value ||
|
enableGroups.value ||
|
||||||
enableOpenAIWSMode.value ||
|
enableOpenAIWSMode.value ||
|
||||||
|
enableOpenAIAPIKeyWSMode.value ||
|
||||||
|
enableCodexCLIOnly.value ||
|
||||||
enableRpmLimit.value ||
|
enableRpmLimit.value ||
|
||||||
userMsgQueueMode.value !== null
|
userMsgQueueMode.value !== null
|
||||||
|
|
||||||
@ -1462,6 +1565,8 @@ watch(
|
|||||||
enableGroups.value = false
|
enableGroups.value = false
|
||||||
enableOpenAIPassthrough.value = false
|
enableOpenAIPassthrough.value = false
|
||||||
enableOpenAIWSMode.value = false
|
enableOpenAIWSMode.value = false
|
||||||
|
enableOpenAIAPIKeyWSMode.value = false
|
||||||
|
enableCodexCLIOnly.value = false
|
||||||
enableRpmLimit.value = false
|
enableRpmLimit.value = false
|
||||||
|
|
||||||
// Reset all values
|
// Reset all values
|
||||||
@ -1481,6 +1586,8 @@ watch(
|
|||||||
status.value = 'active'
|
status.value = 'active'
|
||||||
groupIds.value = []
|
groupIds.value = []
|
||||||
openaiOAuthResponsesWebSocketV2Mode.value = OPENAI_WS_MODE_OFF
|
openaiOAuthResponsesWebSocketV2Mode.value = OPENAI_WS_MODE_OFF
|
||||||
|
openaiAPIKeyResponsesWebSocketV2Mode.value = OPENAI_WS_MODE_OFF
|
||||||
|
codexCLIOnlyEnabled.value = false
|
||||||
rpmLimitEnabled.value = false
|
rpmLimitEnabled.value = false
|
||||||
bulkBaseRpm.value = null
|
bulkBaseRpm.value = null
|
||||||
bulkRpmStrategy.value = 'tiered'
|
bulkRpmStrategy.value = 'tiered'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user