1414 <h3 >知识库类型<span style =" color : var (--color-error-500 )" >*</span ></h3 >
1515 <div class =" kb-type-cards" >
1616 <div
17- v-for =" (typeInfo, typeKey) in supportedKbTypes "
17+ v-for =" (typeInfo, typeKey) in orderedKbTypes "
1818 :key =" typeKey"
1919 class =" kb-type-card"
2020 :class =" { active: newDatabase.kb_type === typeKey }"
21+ :data-type =" typeKey"
2122 @click =" handleKbTypeChange(typeKey)"
2223 >
2324 <div class =" card-header" >
2425 <component :is =" getKbTypeIcon(typeKey)" class =" type-icon" />
2526 <span class =" type-title" >{{ getKbTypeLabel(typeKey) }}</span >
27+ <a-tooltip
28+ v-if =" typeKey === 'chroma'"
29+ title =" Chroma 已标记为弃用状态,建议使用 Milvus 替代。同时会在下个正式版本中移除。"
30+ placement =" top"
31+ >
32+ <span class =" deprecated-badge" >弃用</span >
33+ </a-tooltip >
2634 </div >
2735 <div class =" card-description" >{{ typeInfo.description }}</div >
2836 </div >
7179 <a-textarea
7280 v-model:value =" newDatabase.description"
7381 placeholder =" 新建知识库描述"
74- :auto-size =" { minRows: 5 , maxRows: 10 }"
82+ :auto-size =" { minRows: 3 , maxRows: 10 }"
7583 />
7684
7785 <h3 style =" margin-top : 20px ;" >隐私设置</h3 >
158166 <p >正在加载知识库...</p >
159167 </div >
160168
169+ <!-- 空状态显示 -->
170+ <div v-else-if =" !databases || databases.length === 0" class =" empty-state" >
171+ <h3 class =" empty-title" >暂无知识库</h3 >
172+ <p class =" empty-description" >创建您的第一个知识库,开始管理文档和知识</p >
173+ <a-button type =" primary" size =" large" @click =" state.openNewDatabaseModel = true" >
174+ <template #icon >
175+ <PlusOutlined />
176+ </template >
177+ 创建知识库
178+ </a-button >
179+ </div >
180+
161181 <!-- 数据库列表 -->
162182 <div v-else class =" databases" >
163183 <div
@@ -213,7 +233,7 @@ import { useRouter, useRoute } from 'vue-router';
213233import { useConfigStore } from ' @/stores/config' ;
214234import { message } from ' ant-design-vue'
215235import { Database , Zap , FileDigit , Waypoints , Building2 } from ' lucide-vue-next' ;
216- import { LockOutlined , InfoCircleOutlined , QuestionCircleOutlined } from ' @ant-design/icons-vue' ;
236+ import { LockOutlined , InfoCircleOutlined , QuestionCircleOutlined , PlusOutlined } from ' @ant-design/icons-vue' ;
217237import { databaseApi , typeApi } from ' @/apis/knowledge_api' ;
218238import HeaderComponent from ' @/components/HeaderComponent.vue' ;
219239import ModelSelectorComponent from ' @/components/ModelSelectorComponent.vue' ;
@@ -256,7 +276,7 @@ const createEmptyDatabaseForm = () => ({
256276 name: '',
257277 description: '',
258278 embed_model_name: configStore.config?.embed_model,
259- kb_type: 'chroma ',
279+ kb_type: 'milvus ',
260280 is_private: false,
261281 storage: '',
262282 language: 'English',
@@ -295,6 +315,27 @@ const llmModelSpec = computed(() => {
295315// 支持的知识库类型
296316const supportedKbTypes = ref({})
297317
318+ // 有序的知识库类型(Chroma 排在最后)
319+ const orderedKbTypes = computed(() => {
320+ const types = { ...supportedKbTypes.value }
321+ const ordered = {}
322+ const chromaData = types.chroma
323+
324+ // 先添加除了 Chroma 之外的所有类型
325+ Object.keys(types).forEach(key => {
326+ if (key !== 'chroma') {
327+ ordered[key] = types[key]
328+ }
329+ })
330+
331+ // 最后添加 Chroma(如果存在)
332+ if (chromaData) {
333+ ordered.chroma = chromaData
334+ }
335+
336+ return ordered
337+ })
338+
298339// 加载支持的知识库类型
299340const loadSupportedKbTypes = async () => {
300341 try {
@@ -368,24 +409,6 @@ const getKbTypeIcon = (type) => {
368409 return icons[type] || Database
369410}
370411
371- // const getKbTypeDescription = (type) => {
372- // const descriptions = {
373- // lightrag: '🔥 图结构索引 • 智能查询 • 关系挖掘 • 复杂推理',
374- // chroma: '⚡ 轻量向量 • 快速开发 • 本地部署 • 简单易用',
375- // milvus: '🚀 生产级 • 高性能 • 分布式 • 企业级部署'
376- // }
377- // return descriptions[type] || ''
378- // }
379-
380- const getKbTypeAlertType = (type) => {
381- const types = {
382- lightrag: 'info',
383- chroma: 'success',
384- milvus: 'warning'
385- }
386- return types[type] || 'info'
387- }
388-
389412const getKbTypeColor = (type) => {
390413 const colors = {
391414 lightrag: 'purple',
@@ -395,7 +418,6 @@ const getKbTypeColor = (type) => {
395418 return colors[type] || 'blue'
396419}
397420
398-
399421// 格式化创建时间
400422const formatCreatedTime = (createdAt) => {
401423 if (!createdAt) return ''
@@ -680,24 +702,12 @@ onMounted(() => {
680702 border-color: var(--main-color);
681703 }
682704
683- // 为不同知识库类型设置不同的悬停颜色与主题色
684- &:nth-child(1):hover,
685- &:nth-child(1).active {
686- border-color: var(--color-accent-100);
687- .type-icon { color: var(--color-accent-500); }
688- }
689-
690- &:nth-child(2):hover,
691- &:nth-child(2).active {
692- border-color: var(--color-warning-100);
693- .type-icon { color: var(--color-warning-500); }
705+ &.active {
706+ border-color: var(--main-color);
707+ background: var(--main-10);
708+ .type-icon { color: var(--main-color); }
694709 }
695710
696- &:nth-child(3):hover,
697- &:nth-child(3).active {
698- border-color: var(--color-error-100);
699- .type-icon { color: var(--color-error-500); }
700- }
701711 .card-header {
702712 display: flex;
703713 align-items: center;
@@ -725,6 +735,26 @@ onMounted(() => {
725735 margin-bottom: 0;
726736 // min-height: 40px;
727737 }
738+
739+ .deprecated-badge {
740+ background: var(--color-error-100);
741+ color: var(--color-error-600);
742+ font-size: 10px;
743+ font-weight: 600;
744+ padding: 2px 6px;
745+ border-radius: 4px;
746+ margin-left: auto;
747+ text-transform: uppercase;
748+ letter-spacing: 0.5px;
749+ cursor: help;
750+ transition: all 0.2s ease;
751+
752+ &:hover {
753+ background: var(--color-error-200);
754+ color: var(--color-error-700);
755+ }
756+ }
757+
728758 }
729759 }
730760
@@ -900,8 +930,6 @@ onMounted(() => {
900930 font-weight: 400;
901931 flex: 1;
902932 }
903-
904-
905933}
906934
907935.database-empty {
@@ -913,6 +941,38 @@ onMounted(() => {
913941 color: var(--gray-900);
914942}
915943
944+ .empty-state {
945+ display: flex;
946+ flex-direction: column;
947+ align-items: center;
948+ justify-content: center;
949+ padding: 100px 20px;
950+ text-align: center;
951+
952+ .empty-title {
953+ font-size: 20px;
954+ font-weight: 600;
955+ color: var(--gray-900);
956+ margin: 0 0 12px 0;
957+ letter-spacing: -0.02em;
958+ }
959+
960+ .empty-description {
961+ font-size: 14px;
962+ color: var(--gray-600);
963+ margin: 0 0 32px 0;
964+ line-height: 1.5;
965+ max-width: 320px;
966+ }
967+
968+ .ant-btn {
969+ height: 44px;
970+ padding: 0 24px;
971+ font-size: 15px;
972+ font-weight: 500;
973+ }
974+ }
975+
916976.database-container {
917977 padding: 0;
918978}
0 commit comments