mirror of
https://github.com/Wei-Shaw/claude-relay-service.git
synced 2026-01-23 00:53:33 +00:00
fix(admin-spa): 修复API Key创建后直接消失的问题
- 修正NewApiKeyModal组件的prop名从apiKeyData改为apiKey - 修正CreateApiKeyModal中emit的数据从result.apiKey改为result.data - 补充创建和编辑API Key时缺失的enableModelRestriction和enableClientRestriction字段 - 确保所有字段名与旧版保持一致 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -557,11 +557,13 @@ const createApiKey = async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 模型限制
|
// 模型限制
|
||||||
|
data.enableModelRestriction = form.enableModelRestriction
|
||||||
if (form.enableModelRestriction && form.restrictedModels.length > 0) {
|
if (form.enableModelRestriction && form.restrictedModels.length > 0) {
|
||||||
data.restrictedModels = form.restrictedModels
|
data.restrictedModels = form.restrictedModels
|
||||||
}
|
}
|
||||||
|
|
||||||
// 客户端限制
|
// 客户端限制
|
||||||
|
data.enableClientRestriction = form.enableClientRestriction
|
||||||
if (form.enableClientRestriction && form.allowedClients.length > 0) {
|
if (form.enableClientRestriction && form.allowedClients.length > 0) {
|
||||||
data.allowedClients = form.allowedClients
|
data.allowedClients = form.allowedClients
|
||||||
}
|
}
|
||||||
@@ -570,7 +572,7 @@ const createApiKey = async () => {
|
|||||||
|
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
showToast('API Key 创建成功', 'success')
|
showToast('API Key 创建成功', 'success')
|
||||||
emit('success', result.apiKey)
|
emit('success', result.data)
|
||||||
emit('close')
|
emit('close')
|
||||||
} else {
|
} else {
|
||||||
showToast(result.message || '创建失败', 'error')
|
showToast(result.message || '创建失败', 'error')
|
||||||
|
|||||||
@@ -447,6 +447,7 @@ const updateApiKey = async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 模型限制
|
// 模型限制
|
||||||
|
data.enableModelRestriction = form.enableModelRestriction
|
||||||
if (form.enableModelRestriction && form.restrictedModels.length > 0) {
|
if (form.enableModelRestriction && form.restrictedModels.length > 0) {
|
||||||
data.restrictedModels = form.restrictedModels
|
data.restrictedModels = form.restrictedModels
|
||||||
} else {
|
} else {
|
||||||
@@ -454,6 +455,7 @@ const updateApiKey = async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 客户端限制
|
// 客户端限制
|
||||||
|
data.enableClientRestriction = form.enableClientRestriction
|
||||||
if (form.enableClientRestriction && form.allowedClients.length > 0) {
|
if (form.enableClientRestriction && form.allowedClients.length > 0) {
|
||||||
data.allowedClients = form.allowedClients
|
data.allowedClients = form.allowedClients
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -463,7 +463,7 @@
|
|||||||
|
|
||||||
<NewApiKeyModal
|
<NewApiKeyModal
|
||||||
v-if="showNewApiKeyModal"
|
v-if="showNewApiKeyModal"
|
||||||
:apiKeyData="newApiKeyData"
|
:apiKey="newApiKeyData"
|
||||||
@close="showNewApiKeyModal = false"
|
@close="showNewApiKeyModal = false"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user