Skip to content

Commit 001751d

Browse files
committed
feat(知识库): 优化知识库创建界面并标记 Chroma 为弃用
- 在知识库类型选择卡片中添加 Chroma 弃用标记和提示 - 默认知识库类型改为 Milvus - 添加空状态显示和创建按钮 - 优化知识库类型排序,将 Chroma 放在最后 - 移除不必要的样式代码
1 parent 38e389c commit 001751d

File tree

4 files changed

+106
-42
lines changed

4 files changed

+106
-42
lines changed

docs/latest/changelog/roadmap.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
- 同名文件处理逻辑:遇到同名文件则在上传区域提示,是否删除旧文件
1616
- conversation 待修改为异步的版本
1717
- DBManager 需要将数据库修改为异步的aiosqlite或者异步mysql,缓存使用Redis存储
18-
- agent 状态中的文件区域,新增可以下载
1918

2019
### Bugs
2120
- 部分异常状态下,智能体的模型名称出现重叠[#279](https://github.com/xerrors/Yuxi-Know/issues/279)
2221
- DeepSeek 官方接口适配会出现问题
2322
- 目前的知识库的图片存在公开访问风险
23+
- 深度分析智能体需要考虑上下文超限的问题
2424

2525
### 新增
2626
- 优化知识库详情页面,更加简洁清晰
@@ -34,6 +34,8 @@
3434
- 新增自定义模型支持、新增 dashscope rerank/embeddings 模型的支持
3535
- 新增文档解析的图片支持,已支持 MinerU Officical、Docs、Markdown Zip格式
3636
- 新增暗色模式支持并调整整体 UI([#343](https://github.com/xerrors/Yuxi-Know/pull/343)
37+
- agent 状态中的文件区域,新增可以下载
38+
- 移除 Chroma 的支持,当前版本标记为移除
3739

3840
### 修复
3941
- 修复重排序模型实际未生效的问题
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 057e2000be7b56823239815b0fe7c7fc0dbced96
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 6a0367834ea0fb5e5c94b9711e3e2756966789ea

web/src/views/DataBaseView.vue

Lines changed: 101 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,23 @@
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>
@@ -71,7 +79,7 @@
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>
@@ -158,6 +166,18 @@
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';
213233
import { useConfigStore } from '@/stores/config';
214234
import { message } from 'ant-design-vue'
215235
import { 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';
217237
import { databaseApi, typeApi } from '@/apis/knowledge_api';
218238
import HeaderComponent from '@/components/HeaderComponent.vue';
219239
import 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
// 支持的知识库类型
296316
const 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
// 加载支持的知识库类型
299340
const 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-
389412
const getKbTypeColor = (type) => {
390413
const colors = {
391414
lightrag: 'purple',
@@ -395,7 +418,6 @@ const getKbTypeColor = (type) => {
395418
return colors[type] || 'blue'
396419
}
397420
398-
399421
// 格式化创建时间
400422
const 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

Comments
 (0)