diff --git a/src/knowledge/base.py b/src/knowledge/base.py
index cfde47f2..2eb643a4 100644
--- a/src/knowledge/base.py
+++ b/src/knowledge/base.py
@@ -136,7 +136,12 @@ class KnowledgeBase(ABC):
"""
from src.utils import hashstr
- db_id = f"kb_{hashstr(database_name, with_salt=True)}"
+ from src.utils import hashstr
+
+ # 从 kwargs 中获取 is_private 配置
+ is_private = kwargs.get('is_private', False)
+ prefix = "kb_private_" if is_private else "kb_"
+ db_id = f"{prefix}{hashstr(database_name, with_salt=True)}"
# 创建数据库记录
# 确保 Pydantic 模型被转换为字典,以便 JSON 序列化
diff --git a/src/knowledge/implementations/chroma.py b/src/knowledge/implementations/chroma.py
index 976b6060..c7c4bd99 100644
--- a/src/knowledge/implementations/chroma.py
+++ b/src/knowledge/implementations/chroma.py
@@ -20,7 +20,7 @@ from src.utils.datetime_utils import utc_isoformat
class ChromaKB(KnowledgeBase):
- """基于 ChromaDB 的向量知识库实现"""
+ """基于 ChromaDB 的向量库"""
def __init__(self, work_dir: str, **kwargs):
"""
diff --git a/src/knowledge/implementations/milvus.py b/src/knowledge/implementations/milvus.py
index f999c43a..6b4da162 100644
--- a/src/knowledge/implementations/milvus.py
+++ b/src/knowledge/implementations/milvus.py
@@ -21,7 +21,7 @@ MILVUS_AVAILABLE = True
class MilvusKB(KnowledgeBase):
- """基于 Milvus 的生产级向量知识库实现"""
+ """基于 Milvus 的生产级向量库"""
def __init__(self, work_dir: str, **kwargs):
"""
diff --git a/web/src/views/DataBaseView.vue b/web/src/views/DataBaseView.vue
index e49060e0..7b4e8b65 100644
--- a/web/src/views/DataBaseView.vue
+++ b/web/src/views/DataBaseView.vue
@@ -76,6 +76,20 @@
placeholder="新建知识库描述"
:auto-size="{ minRows: 5, maxRows: 10 }"
/>
+
+
隐私设置
+
取消
创建
@@ -104,6 +118,12 @@
:key="database.db_id"
class="database dbcard"
@click="navigateToDatabase(database.db_id)">
+
+
@@ -132,7 +152,7 @@
>
{{ getKbTypeLabel(database.kb_type || 'lightrag') }}
-
+
@@ -146,6 +166,7 @@ import { useRouter, useRoute } from 'vue-router';
import { useConfigStore } from '@/stores/config';
import { message } from 'ant-design-vue'
import { BookPlus, Database, Zap, FileDigit, Waypoints, Building2 } from 'lucide-vue-next';
+import { LockOutlined, InfoCircleOutlined } from '@ant-design/icons-vue';
import { databaseApi, typeApi } from '@/apis/knowledge_api';
import HeaderComponent from '@/components/HeaderComponent.vue';
import ModelSelectorComponent from '@/components/ModelSelectorComponent.vue';
@@ -189,6 +210,7 @@ const emptyEmbedInfo = {
description: '',
embed_model_name: configStore.config?.embed_model,
kb_type: 'chroma', // 默认为 Milvus
+ is_private: false, // 默认为公开知识库
// Vector 知识库特有配置
storage: '', // 存储方式配置
// LightRAG 特有配置
@@ -391,7 +413,9 @@ const createDatabase = () => {
description: newDatabase.description?.trim() || '',
embed_model_name: newDatabase.embed_model_name || configStore.config.embed_model,
kb_type: newDatabase.kb_type,
- additional_params: {}
+ additional_params: {
+ is_private: newDatabase.is_private || false
+ }
}
// 添加类型特有的配置
@@ -450,6 +474,12 @@ onMounted(() => {
margin: 12px 0;
}
+ .privacy-config {
+ display: flex;
+ align-items: center;
+ margin-bottom: 12px;
+ }
+
.kb-type-cards {
display: grid;
grid-template-columns: repeat(3, 1fr);
@@ -473,7 +503,6 @@ onMounted(() => {
&:hover {
border-color: var(--main-color);
- transform: translateY(-1px);
}
// 为不同知识库类型设置不同的悬停颜色
@@ -577,7 +606,7 @@ onMounted(() => {
color: var(--gray-600);
line-height: 1.5;
margin-bottom: 12px;
- min-height: 40px;
+ // min-height: 40px;
}
.card-features {
@@ -687,6 +716,19 @@ onMounted(() => {
cursor: pointer;
display: flex;
flex-direction: column;
+ position: relative; // 为绝对定位的锁定图标提供参考
+
+ .private-lock-icon {
+ position: absolute;
+ top: 24px;
+ right: 16px;
+ color: var(--gray-700);
+ background: var(--gray-100);
+ font-size: 12px;
+ border-radius: 6px;
+ padding: 5px;
+ z-index: 1;
+ }
.top {
display: flex;