Skip to content

Commit 76470e2

Browse files
committed
feat: update AddNewProvider component to support current provider type and enhance provider icon mapping
1 parent 96da8f9 commit 76470e2

3 files changed

Lines changed: 31 additions & 3 deletions

File tree

dashboard/src/components/provider/AddNewProvider.vue

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<v-dialog v-model="showDialog" max-width="1100px" min-height="95%">
2+
<v-dialog v-model="showDialog" max-width="1000px" >
33
<v-card :title="tm('dialogs.addProvider.title')">
44
<v-card-text style="overflow-y: auto;">
55
<v-tabs v-model="activeProviderTab" grow>
@@ -73,6 +73,8 @@
7373
import { useModuleI18n } from '@/i18n/composables';
7474
import { getProviderIcon, getProviderDescription } from '@/utils/providerUtils';
7575
76+
const AVAILABLE_PROVIDER_TABS = ['agent_runner', 'speech_to_text', 'text_to_speech', 'embedding', 'rerank'];
77+
7678
export default {
7779
name: 'AddNewProvider',
7880
props: {
@@ -83,6 +85,10 @@ export default {
8385
metadata: {
8486
type: Object,
8587
default: () => ({})
88+
},
89+
currentProviderType: {
90+
type: String,
91+
default: 'agent_runner'
8692
}
8793
},
8894
emits: ['update:show', 'select-template'],
@@ -92,7 +98,7 @@ export default {
9298
},
9399
data() {
94100
return {
95-
activeProviderTab: 'chat_completion'
101+
activeProviderTab: 'agent_runner'
96102
};
97103
},
98104
computed: {
@@ -105,7 +111,25 @@ export default {
105111
}
106112
},
107113
},
114+
watch: {
115+
show(value) {
116+
if (value) {
117+
this.syncActiveProviderTab();
118+
}
119+
},
120+
currentProviderType() {
121+
if (this.showDialog) {
122+
this.syncActiveProviderTab();
123+
}
124+
}
125+
},
108126
methods: {
127+
syncActiveProviderTab() {
128+
this.activeProviderTab = AVAILABLE_PROVIDER_TABS.includes(this.currentProviderType)
129+
? this.currentProviderType
130+
: 'agent_runner';
131+
},
132+
109133
closeDialog() {
110134
this.showDialog = false;
111135
},

dashboard/src/utils/providerUtils.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@ export function getProviderIcon(type) {
4040
'aihubmix': 'https://cdn.jsdelivr.net/npm/@lobehub/icons-static-svg@latest/icons/aihubmix-color.svg',
4141
'openrouter': 'https://cdn.jsdelivr.net/npm/@lobehub/icons-static-svg@latest/icons/openrouter.svg',
4242
"tokenpony": "https://tokenpony.cn/tokenpony-web/logo.png",
43-
"compshare": "https://compshare.cn/favicon.ico"
43+
"compshare": "https://compshare.cn/favicon.ico",
44+
"xinference": "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-svg@latest/icons/xinference-color.svg",
45+
"bailian": "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-svg@latest/icons/bailian-color.svg",
46+
"volcengine": 'https://cdn.jsdelivr.net/npm/@lobehub/icons-static-svg@latest/icons/volcengine-color.svg',
4447
};
4548
return icons[type] || '';
4649
}

dashboard/src/views/ProviderPage.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@
163163

164164
<!-- 添加提供商对话框 -->
165165
<AddNewProvider v-model:show="showAddProviderDialog" :metadata="configSchema"
166+
:current-provider-type="selectedProviderType"
166167
@select-template="selectProviderTemplate" />
167168

168169
<!-- 手动添加模型对话框 -->

0 commit comments

Comments
 (0)