This commit is contained in:
Sakurasan
2025-04-20 02:59:08 +08:00
parent ed42f3ded7
commit fe0f2a7e88
2 changed files with 39 additions and 31 deletions

View File

@@ -60,24 +60,7 @@
<button type="button" @click="togglePasswordVisibility" tabindex="-1"
class="absolute inset-y-0 left-0 px-3 flex items-center text-base-content/60 hover:text-base-content/80 focus:outline-none focus:ring-0 rounded-r-md"
id="password-visibility-toggle">
<template v-if="newApiKey.type === 'openai'">
<img src="../../assets/openai.svg" class="w-5 h-5" alt="">
</template>
<template v-else-if="newApiKey.type === 'claude'">
<img src="../../assets/claude.svg" class="w-5 h-5" alt="">
</template>
<template v-else-if="newApiKey.type === 'gemini'">
<img src="../../assets/gemini.svg" class="w-5 h-5" alt="">
</template>
<template v-else-if="newApiKey.type ==='azure'">
<img src="../../assets/azure.svg" class="w-5 h-5" alt="">
</template>
<template v-else-if="newApiKey.type ==='github'">
<img src="../../assets/github.svg" class="w-5 h-5" alt="">
</template>
<template v-else="newApiKey.type">
<img src="../../assets/logo.svg" class="w-5 h-5" alt="">
</template>
<img :src="apiKeyImageUrl(newApiKey.type)" class="w-5 h-5" alt="">
</button>
</div>
</div>
@@ -260,6 +243,19 @@ const cancel = () => {
emit('closeModal', true)
}
const apiKeyImageMap = {
'openai': '/assets/openai.svg',
'claude': '/assets/claude.svg',
'gemini': '/assets/gemini.svg',
'azure': '/assets/azure.svg',
'github': '/assets/github.svg'
};
const apiKeyImageUrl = (keytype) => {
return apiKeyImageMap[keytype] || '/assets/logo.svg';
};
const createApiKey = async () => {
if (!isFormValid.value) {
setToast('Please fill in all required fields (Name, Type, API Key).', 'error')