diff --git a/server/routers/knowledge_router.py b/server/routers/knowledge_router.py index 2ccc83aa..94875517 100644 --- a/server/routers/knowledge_router.py +++ b/server/routers/knowledge_router.py @@ -1132,9 +1132,6 @@ async def get_sample_questions(db_id: str, current_user: User = Depends(get_admi db_meta = knowledge_base.global_databases_meta[db_id] questions = db_meta.get("sample_questions", []) - if not questions: - raise HTTPException(status_code=404, detail="该知识库还没有生成测试问题") - return { "message": "success", "questions": questions, diff --git a/server/routers/mindmap_router.py b/server/routers/mindmap_router.py index 78c8e9fe..bf0946af 100644 --- a/server/routers/mindmap_router.py +++ b/server/routers/mindmap_router.py @@ -347,9 +347,6 @@ async def get_database_mindmap(db_id: str, current_user: User = Depends(get_admi db_meta = knowledge_base.global_databases_meta[db_id] mindmap_data = db_meta.get("mindmap") - if not mindmap_data: - raise HTTPException(status_code=404, detail="该知识库还没有生成思维导图") - return { "message": "success", "mindmap": mindmap_data, diff --git a/web/src/components/KnowledgeBaseCard.vue b/web/src/components/KnowledgeBaseCard.vue index 20d23d88..07db1d6f 100644 --- a/web/src/components/KnowledgeBaseCard.vue +++ b/web/src/components/KnowledgeBaseCard.vue @@ -5,6 +5,7 @@
-
-

{{ database.description }}

+
+

{{ database.description || '暂无描述' }}

@@ -66,7 +67,7 @@ - + 上传文件后自动生成测试问题 @@ -165,7 +166,7 @@ const showEditModal = () => { editForm.name = database.value.name || ''; editForm.description = database.value.description || ''; editForm.auto_generate_questions = database.value.additional_params?.auto_generate_questions || false; - + // 如果是 LightRAG 类型,加载当前的 LLM 配置 if (database.value.kb_type === 'lightrag') { const llmInfo = database.value.llm_info || {}; @@ -244,9 +245,14 @@ const deleteDatabase = () => { .header-left { display: flex; align-items: center; - gap: 8px; + gap: 4px; flex: 1; min-width: 0; + + button.back-button { + margin-left: -5px; + font-size: 10px; + } } .card-title { @@ -267,10 +273,12 @@ const deleteDatabase = () => { flex-shrink: 0; button { + color: var(--gray-500); height: 100%; } button:hover { + color: var(--gray-700); background-color: var(--gray-100); } } diff --git a/web/src/components/KnowledgeGraphSection.vue b/web/src/components/KnowledgeGraphSection.vue index 290e964c..a9604fa1 100644 --- a/web/src/components/KnowledgeGraphSection.vue +++ b/web/src/components/KnowledgeGraphSection.vue @@ -95,6 +95,9 @@ const props = defineProps({ }, }); +// 声明事件 +const emit = defineEmits(['toggleVisible']); + const store = useDatabaseStore(); const databaseId = computed(() => store.databaseId); diff --git a/web/src/components/QuerySection.vue b/web/src/components/QuerySection.vue index ad200e24..a3df6a0d 100644 --- a/web/src/components/QuerySection.vue +++ b/web/src/components/QuerySection.vue @@ -183,6 +183,9 @@ const props = defineProps({ }, }); +// 声明事件 +const emit = defineEmits(['toggleVisible']); + const searchLoading = computed(() => store.state.searchLoading); const queryResult = ref(''); const showRawData = ref(true); diff --git a/web/src/components/SearchConfigModal.vue b/web/src/components/SearchConfigModal.vue index 5bf7147d..ae8ca3b9 100644 --- a/web/src/components/SearchConfigModal.vue +++ b/web/src/components/SearchConfigModal.vue @@ -83,7 +83,7 @@ const props = defineProps({ }, databaseId: { type: String, - required: true + default: '' } }); @@ -129,6 +129,13 @@ const loadQueryParams = async () => { loading.value = true; error.value = ''; + // 如果没有 databaseId,不执行请求 + if (!props.databaseId) { + queryParams.value = []; + loading.value = false; + return; + } + const response = await queryApi.getKnowledgeBaseQueryParams(props.databaseId); queryParams.value = response.params?.options || []; @@ -163,6 +170,8 @@ const loadQueryParams = async () => { // 加载保存的配置 const loadSavedConfig = () => { + if (!props.databaseId) return; + const saved = localStorage.getItem(`search-config-${props.databaseId}`); if (saved) { try { @@ -201,6 +210,12 @@ const resetToDefaults = () => { // 保存配置 const handleSave = async () => { + // 如果没有 databaseId,不执行保存 + if (!props.databaseId) { + message.error('无法保存配置:缺少知识库ID'); + return; + } + // 确保 include_distances 始终为 true meta['include_distances'] = true;