mirror of
https://github.com/Wei-Shaw/claude-relay-service.git
synced 2026-01-23 09:38:02 +00:00
feat: 支持apikey测试claude端点
This commit is contained in:
@@ -96,7 +96,7 @@
|
||||
>统计时间范围</span
|
||||
>
|
||||
</div>
|
||||
<div class="flex w-full gap-2 md:w-auto">
|
||||
<div class="flex w-full items-center gap-2 md:w-auto">
|
||||
<button
|
||||
class="flex flex-1 items-center justify-center gap-1 px-4 py-2 text-xs font-medium md:flex-none md:gap-2 md:px-6 md:text-sm"
|
||||
:class="['period-btn', { active: statsPeriod === 'daily' }]"
|
||||
@@ -115,6 +115,16 @@
|
||||
<i class="fas fa-calendar-alt text-xs md:text-sm" />
|
||||
本月
|
||||
</button>
|
||||
<!-- 测试按钮 - 仅在单Key模式下显示 -->
|
||||
<button
|
||||
v-if="!multiKeyMode"
|
||||
class="test-btn flex items-center justify-center gap-1 px-4 py-2 text-xs font-medium md:gap-2 md:px-6 md:text-sm"
|
||||
:disabled="loading"
|
||||
@click="openTestModal"
|
||||
>
|
||||
<i class="fas fa-vial text-xs md:text-sm" />
|
||||
测试
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -147,6 +157,14 @@
|
||||
<TutorialView />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- API Key 测试弹窗 -->
|
||||
<ApiKeyTestModal
|
||||
:api-key-name="statsData?.name || ''"
|
||||
:api-key-value="apiKey"
|
||||
:show="showTestModal"
|
||||
@close="closeTestModal"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -165,6 +183,7 @@ import LimitConfig from '@/components/apistats/LimitConfig.vue'
|
||||
import AggregatedStatsCard from '@/components/apistats/AggregatedStatsCard.vue'
|
||||
import ModelUsageStats from '@/components/apistats/ModelUsageStats.vue'
|
||||
import TutorialView from './TutorialView.vue'
|
||||
import ApiKeyTestModal from '@/components/apikeys/ApiKeyTestModal.vue'
|
||||
|
||||
const route = useRoute()
|
||||
const apiStatsStore = useApiStatsStore()
|
||||
@@ -191,6 +210,19 @@ const {
|
||||
|
||||
const { queryStats, switchPeriod, loadStatsWithApiId, loadOemSettings, reset } = apiStatsStore
|
||||
|
||||
// 测试弹窗状态
|
||||
const showTestModal = ref(false)
|
||||
|
||||
// 打开测试弹窗
|
||||
const openTestModal = () => {
|
||||
showTestModal.value = true
|
||||
}
|
||||
|
||||
// 关闭测试弹窗
|
||||
const closeTestModal = () => {
|
||||
showTestModal.value = false
|
||||
}
|
||||
|
||||
// 处理键盘快捷键
|
||||
const handleKeyDown = (event) => {
|
||||
// Ctrl/Cmd + Enter 查询
|
||||
@@ -513,6 +545,36 @@ watch(apiKey, (newValue) => {
|
||||
border-color: rgba(107, 114, 128, 0.8);
|
||||
}
|
||||
|
||||
/* 测试按钮样式 */
|
||||
.test-btn {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
border-radius: 12px;
|
||||
font-weight: 500;
|
||||
letter-spacing: 0.025em;
|
||||
transition: all 0.3s ease;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
|
||||
color: white;
|
||||
box-shadow:
|
||||
0 4px 10px -2px rgba(6, 182, 212, 0.3),
|
||||
0 2px 4px -1px rgba(6, 182, 212, 0.1);
|
||||
}
|
||||
|
||||
.test-btn:hover:not(:disabled) {
|
||||
transform: translateY(-1px);
|
||||
box-shadow:
|
||||
0 8px 15px -3px rgba(6, 182, 212, 0.4),
|
||||
0 4px 6px -2px rgba(6, 182, 212, 0.15);
|
||||
}
|
||||
|
||||
.test-btn:disabled {
|
||||
opacity: 0.5;
|
||||
cursor: not-allowed;
|
||||
transform: none;
|
||||
}
|
||||
|
||||
/* Tab 胶囊按钮样式 */
|
||||
.tab-pill-button {
|
||||
padding: 0.5rem 1rem;
|
||||
|
||||
Reference in New Issue
Block a user