From 9a46ac3928ab294ec94d6f3c2b2703c44ad5bc66 Mon Sep 17 00:00:00 2001 From: Feng Yue <2525275@gmail.com> Date: Wed, 13 Aug 2025 20:31:25 +0800 Subject: [PATCH] chore: improve apikey interface --- .../src/components/user/CreateApiKeyModal.vue | 69 ++----------------- .../src/components/user/ViewApiKeyModal.vue | 59 +--------------- 2 files changed, 8 insertions(+), 120 deletions(-) diff --git a/web/admin-spa/src/components/user/CreateApiKeyModal.vue b/web/admin-spa/src/components/user/CreateApiKeyModal.vue index 38b97261..a752d7c6 100644 --- a/web/admin-spa/src/components/user/CreateApiKeyModal.vue +++ b/web/admin-spa/src/components/user/CreateApiKeyModal.vue @@ -3,7 +3,9 @@ v-if="show" class="fixed inset-0 z-50 h-full w-full overflow-y-auto bg-gray-600 bg-opacity-50" > -
+

Create New API Key

@@ -47,58 +49,6 @@ >
-
- - -

Set to 0 for unlimited tokens

-
- -
- -
-
- $ -
- -
-

Set to 0 for unlimited daily cost

-
- -
- - -

Leave empty for no expiration

-
-
@@ -242,18 +192,12 @@ const newApiKey = ref(null) const form = reactive({ name: '', - description: '', - tokenLimit: null, - dailyCostLimit: null, - expiresAt: '' + description: '' }) const resetForm = () => { form.name = '' form.description = '' - form.tokenLimit = null - form.dailyCostLimit = null - form.expiresAt = '' error.value = '' newApiKey.value = null } @@ -270,10 +214,7 @@ const handleSubmit = async () => { try { const apiKeyData = { name: form.name.trim(), - description: form.description.trim() || undefined, - tokenLimit: form.tokenLimit || undefined, - dailyCostLimit: form.dailyCostLimit || undefined, - expiresAt: form.expiresAt || undefined + description: form.description.trim() || undefined } const result = await userStore.createApiKey(apiKeyData) diff --git a/web/admin-spa/src/components/user/ViewApiKeyModal.vue b/web/admin-spa/src/components/user/ViewApiKeyModal.vue index e1daec3d..bcd316c7 100644 --- a/web/admin-spa/src/components/user/ViewApiKeyModal.vue +++ b/web/admin-spa/src/components/user/ViewApiKeyModal.vue @@ -3,7 +3,9 @@ v-if="show" class="fixed inset-0 z-50 h-full w-full overflow-y-auto bg-gray-600 bg-opacity-50" > -
+

API Key Details

@@ -195,61 +197,6 @@
- -
- -
-

- Set these environment variables to use this API key: -

-
-
- export ANTHROPIC_BASE_URL="http://your-server:3000/api/" - -
-
- export ANTHROPIC_AUTH_TOKEN="{{ apiKey.keyPreview || 'your-api-key' }}" - -
-
-
-
-