fix(frontend): upstream account edit fields and mixed_scheduling on create
- EditAccountModal: add Base URL / API Key fields for upstream type - EditAccountModal: initialize editBaseUrl from credentials on upstream account open - EditAccountModal: save upstream credentials (base_url, api_key) on submit - CreateAccountModal: pass mixed_scheduling extra when creating upstream account
This commit is contained in:
@@ -2714,7 +2714,8 @@ const handleSubmit = async () => {
|
|||||||
|
|
||||||
submitting.value = true
|
submitting.value = true
|
||||||
try {
|
try {
|
||||||
await createAccountAndFinish(form.platform, 'upstream', credentials)
|
const extra = mixedScheduling.value ? { mixed_scheduling: true } : undefined
|
||||||
|
await createAccountAndFinish(form.platform, 'upstream', credentials, extra)
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
appStore.showError(error.response?.data?.detail || t('admin.accounts.failedToCreate'))
|
appStore.showError(error.response?.data?.detail || t('admin.accounts.failedToCreate'))
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@@ -364,6 +364,30 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Upstream fields (only for upstream type) -->
|
||||||
|
<div v-if="account.type === 'upstream'" class="space-y-4">
|
||||||
|
<div>
|
||||||
|
<label class="input-label">{{ t('admin.accounts.upstream.baseUrl') }}</label>
|
||||||
|
<input
|
||||||
|
v-model="editBaseUrl"
|
||||||
|
type="text"
|
||||||
|
class="input"
|
||||||
|
placeholder="https://s.konstants.xyz"
|
||||||
|
/>
|
||||||
|
<p class="input-hint">{{ t('admin.accounts.upstream.baseUrlHint') }}</p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="input-label">{{ t('admin.accounts.upstream.apiKey') }}</label>
|
||||||
|
<input
|
||||||
|
v-model="editApiKey"
|
||||||
|
type="password"
|
||||||
|
class="input font-mono"
|
||||||
|
placeholder="sk-..."
|
||||||
|
/>
|
||||||
|
<p class="input-hint">{{ t('admin.accounts.leaveEmptyToKeep') }}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- Antigravity model restriction (applies to all antigravity types) -->
|
<!-- Antigravity model restriction (applies to all antigravity types) -->
|
||||||
<!-- Antigravity 只支持模型映射模式,不支持白名单模式 -->
|
<!-- Antigravity 只支持模型映射模式,不支持白名单模式 -->
|
||||||
<div v-if="account.platform === 'antigravity'" class="border-t border-gray-200 pt-4 dark:border-dark-600">
|
<div v-if="account.platform === 'antigravity'" class="border-t border-gray-200 pt-4 dark:border-dark-600">
|
||||||
@@ -1244,6 +1268,9 @@ watch(
|
|||||||
} else {
|
} else {
|
||||||
selectedErrorCodes.value = []
|
selectedErrorCodes.value = []
|
||||||
}
|
}
|
||||||
|
} else if (newAccount.type === 'upstream' && newAccount.credentials) {
|
||||||
|
const credentials = newAccount.credentials as Record<string, unknown>
|
||||||
|
editBaseUrl.value = (credentials.base_url as string) || ''
|
||||||
} else {
|
} else {
|
||||||
const platformDefaultUrl =
|
const platformDefaultUrl =
|
||||||
newAccount.platform === 'openai'
|
newAccount.platform === 'openai'
|
||||||
@@ -1584,6 +1611,22 @@ const handleSubmit = async () => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updatePayload.credentials = newCredentials
|
||||||
|
} else if (props.account.type === 'upstream') {
|
||||||
|
const currentCredentials = (props.account.credentials as Record<string, unknown>) || {}
|
||||||
|
const newCredentials: Record<string, unknown> = { ...currentCredentials }
|
||||||
|
|
||||||
|
newCredentials.base_url = editBaseUrl.value.trim()
|
||||||
|
|
||||||
|
if (editApiKey.value.trim()) {
|
||||||
|
newCredentials.api_key = editApiKey.value.trim()
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!applyTempUnschedConfig(newCredentials)) {
|
||||||
|
submitting.value = false
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
updatePayload.credentials = newCredentials
|
updatePayload.credentials = newCredentials
|
||||||
} else {
|
} else {
|
||||||
// For oauth/setup-token types, only update intercept_warmup_requests if changed
|
// For oauth/setup-token types, only update intercept_warmup_requests if changed
|
||||||
|
|||||||
Reference in New Issue
Block a user