From f0275aaadc8d6b123d1aad4195e50ff23175babb Mon Sep 17 00:00:00 2001 From: Wenjie Zhang Date: Thu, 6 Nov 2025 21:59:48 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E5=92=8C=E9=80=BB=E8=BE=91=EF=BC=8C=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E7=94=A8=E6=88=B7=E4=BD=93=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/components/FileTable.vue | 39 +-- web/src/components/FileUploadModal.vue | 140 +++++---- web/src/components/KnowledgeGraphSection.vue | 60 +++- web/src/components/MessageInputComponent.vue | 2 +- web/src/components/QuerySection.vue | 301 +++++++------------ web/src/views/DataBaseInfoView.vue | 36 ++- web/src/views/DataBaseView.vue | 15 +- 7 files changed, 279 insertions(+), 314 deletions(-) diff --git a/web/src/components/FileTable.vue b/web/src/components/FileTable.vue index 476cda97..f54f4b0a 100644 --- a/web/src/components/FileTable.vue +++ b/web/src/components/FileTable.vue @@ -46,7 +46,7 @@ -
+
{{ selectedRowKeys.length }} 项
-
- 上传文件 -
-
- 输入网址 -
+
@@ -35,7 +35,7 @@
-
+
@@ -67,36 +67,6 @@
-
- - -
- - - {{ chunkParams.use_qa_split ? '启用QA分割(忽略chunk大小设置)' : '使用普通分割模式' }} - -
-
- - - - 用于分割不同QA对的分隔符,默认为3个换行符 - - -
-
-
⚠️ 检测到PDF或图片文件,请启用OCR功能以提取文本内容 @@ -181,7 +151,7 @@ diff --git a/web/src/components/MessageInputComponent.vue b/web/src/components/MessageInputComponent.vue index d56ea2cf..2d429e4b 100644 --- a/web/src/components/MessageInputComponent.vue +++ b/web/src/components/MessageInputComponent.vue @@ -444,7 +444,7 @@ onBeforeUnmount(() => { } &:disabled { - background-color: var(--gray-400); + opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; diff --git a/web/src/components/QuerySection.vue b/web/src/components/QuerySection.vue index 4716a7cc..f317ab25 100644 --- a/web/src/components/QuerySection.vue +++ b/web/src/components/QuerySection.vue @@ -3,63 +3,37 @@
-
-
- - - - 搜索中... - - - 找到 {{ resultCount }} 条结果 - -
-
-
- -
- - - 搜索 - -
- 示例: -
- - {{ queryExamples[currentExampleIndex] }} - -
+
+ +
+ +
-
+
{{ JSON.stringify(queryResult, null, 2) }}
@@ -128,16 +102,13 @@ @@ -267,98 +181,92 @@ onUnmounted(() => { flex-direction: column; overflow: hidden; min-width: 0; -} - -.query-header { - display: flex; - justify-content: space-between; - align-items: center; - padding: 12px 16px; - border-bottom: 1px solid var(--gray-200); - background-color: #fff; - - .header-status { - display: flex; - align-items: center; - gap: 16px; - font-size: 13px; - color: var(--gray-600); - - .search-status { - display: flex; - align-items: center; - gap: 6px; - } - - .result-count { - font-weight: 500; - } - } + max-height: 100%; } .query-input-container { padding: 16px; display: flex; flex-direction: column; - gap: 16px; - background-color: #fff; - border-bottom: 1px solid var(--gray-200); + gap: 12px; + background-color: var(--gray-0); } -.compact-query-textarea { - flex: 1; +.search-input-wrapper { + display: flex; + flex-direction: column; + gap: 12px; + padding: 12px 16px 8px; + border-radius: 12px; + border: 1px solid var(--gray-200); + background-color: var(--gray-0); + box-shadow: 0 1px 3px rgba(23, 23, 23, 0.05); + transition: border-color 0.5s ease, box-shadow 0.5s ease; - &:focus { + &:hover { + border-color: var(--main-400); + box-shadow: 0 4px 12px rgba(1, 97, 121, 0.08); + } + + :deep(.ant-input) { + border-radius: 8px; + background-color: var(--gray-0); + color: var(--gray-1000); outline: none; + border: none; + box-shadow: none; + padding: 0; + transition: border-color 0.3s ease, box-shadow 0.3s ease; + + &:focus { + outline: none; + border: none; + } + + &::placeholder { + color: var(--gray-500); + } } } -.query-actions-row { +.search-actions { display: flex; - gap: 16px; align-items: center; + justify-content: space-between; + gap: 12px; } .search-button { - flex-shrink: 0; -} + background-color: var(--main-color); + border-color: var(--main-color); + box-shadow: 0 2px 4px rgba(1, 97, 121, 0.15); + transition: all 0.2s ease; -.query-examples-compact { - display: flex; - flex-direction: row; - align-items: center; - gap: 8px; - flex-wrap: wrap; -} + &:hover:not(:disabled) { + background-color: var(--main-bright); + border-color: var(--main-bright); + box-shadow: 0 4px 8px rgba(1, 136, 166, 0.25); + transform: translateY(-1px); + } -.examples-label { - font-size: 12px; - color: #8c8c8c; - white-space: nowrap; -} - -.examples-container { - min-height: 24px; - display: flex; -} - -.example-btn { - text-align: left; - white-space: normal; - height: auto; - padding: 4px 8px; - font-size: 12px; + &:disabled { + opacity: 0.5; + color: var(--gray-0); + cursor: not-allowed; + box-shadow: none; + transform: none; + } } .query-results { flex: 1; overflow-y: auto; - padding: 20px; - background-color: #fafafa; + padding: 16px; + background-color: var(--gray-25); min-height: 0; .result-raw { - background-color: #f8f9fa; + background-color: var(--gray-50); border: 1px solid var(--gray-200); border-radius: 6px; padding: 16px; @@ -369,6 +277,7 @@ onUnmounted(() => { font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace; font-size: 12px; line-height: 1.5; + color: var(--gray-1000); white-space: pre-wrap; word-break: break-word; } @@ -378,32 +287,36 @@ onUnmounted(() => { white-space: pre-wrap; word-break: break-word; line-height: 1.6; + color: var(--gray-1000); } .result-list { .no-results { text-align: center; padding: 32px; - color: #999; + color: var(--gray-500); } .result-summary { margin-bottom: 12px; padding: 8px 12px; - background-color: #e6f7ff; + background-color: var(--main-50); border-left: 3px solid var(--main-color); border-radius: 2px; + color: var(--gray-800); } .result-item { - background-color: white; - border: 1px solid #e8e8e8; + background-color: var(--gray-0); + border: 1px solid var(--gray-200); border-radius: 6px; padding: 12px; margin-bottom: 12px; + transition: all 0.2s ease; &:hover { - border-color: var(--gray-400); + border-color: var(--main-300); + box-shadow: 0 2px 8px rgba(1, 97, 121, 0.08); } &:last-child { @@ -416,7 +329,7 @@ onUnmounted(() => { gap: 12px; margin-bottom: 8px; padding-bottom: 8px; - border-bottom: 1px solid #f0f0f0; + border-bottom: 1px solid var(--gray-150); .result-index { font-weight: 600; @@ -429,20 +342,20 @@ onUnmounted(() => { font-size: 12px; padding: 2px 8px; border-radius: 12px; - background-color: #f0f0f0; - color: #666; + background-color: var(--gray-100); + color: var(--gray-700); } .result-rerank-score { - background-color: #fff7e6; - color: #fa8c16; + background-color: var(--stats-warning-bg); + color: var(--stats-warning-color); } } .result-content { padding: 8px 0; line-height: 1.6; - color: #333; + color: var(--gray-900); white-space: pre-wrap; word-break: break-word; } @@ -453,14 +366,14 @@ onUnmounted(() => { gap: 12px; margin-top: 8px; padding-top: 8px; - border-top: 1px solid #f0f0f0; + border-top: 1px solid var(--gray-150); .metadata-item { font-size: 12px; - color: #666; + color: var(--gray-700); strong { - color: #999; + color: var(--gray-500); font-weight: 500; margin-right: 4px; } @@ -471,13 +384,15 @@ onUnmounted(() => { .result-unknown { pre { - background-color: white; + background-color: var(--gray-0); + border: 1px solid var(--gray-200); padding: 12px; border-radius: 4px; overflow-x: auto; font-size: 12px; + color: var(--gray-1000); } } } - \ No newline at end of file + diff --git a/web/src/views/DataBaseInfoView.vue b/web/src/views/DataBaseInfoView.vue index ab1855f7..e304f937 100644 --- a/web/src/views/DataBaseInfoView.vue +++ b/web/src/views/DataBaseInfoView.vue @@ -56,6 +56,7 @@ @@ -108,19 +109,27 @@ const isGraphSupported = computed(() => { // Tab 切换逻辑 - 智能默认 const activeTab = ref('query'); -const previousDatabaseId = ref(null); -// 监听数据库ID变化,只在切换数据库时设置默认Tab -watch(databaseId, (newDbId, oldDbId) => { - if (newDbId && newDbId !== oldDbId) { - // 切换到支持图谱的数据库时,默认显示图谱,否则显示检索 - // 使用setTimeout确保在下一个tick中设置,避免和其他响应式更新冲突 - setTimeout(() => { - activeTab.value = isGraphSupported.value ? 'graph' : 'query'; - }, 0); - previousDatabaseId.value = newDbId; - } -}, { immediate: true }); +// LightRAG 默认展示知识图谱 +watch( + () => [databaseId.value, isGraphSupported.value], + ([newDbId, supported], oldValue = []) => { + const [oldDbId, previouslySupported] = oldValue; + if (!newDbId) { + return; + } + + if (supported && (newDbId !== oldDbId || previouslySupported === false || previouslySupported === undefined)) { + activeTab.value = 'graph'; + return; + } + + if (!supported && activeTab.value === 'graph') { + activeTab.value = 'query'; + } + }, + { immediate: true } +); // 切换右侧面板显示/隐藏 const toggleRightPanel = () => { @@ -261,10 +270,12 @@ const handleMouseUp = () => { } .left-panel { + display: flex; flex-shrink: 0; flex-grow: 1; background-color: var(--gray-0); padding-right: 0; + // max-height: calc(100% - 16px); } .right-panel { @@ -315,7 +326,6 @@ const handleMouseUp = () => { } } - /* Simplify resize handle */ .resize-handle { opacity: 0.8; diff --git a/web/src/views/DataBaseView.vue b/web/src/views/DataBaseView.vue index 9579b1dd..4f2b6368 100644 --- a/web/src/views/DataBaseView.vue +++ b/web/src/views/DataBaseView.vue @@ -163,15 +163,6 @@
-
-
-
-
-

新建知识库

-
-
-

导入您自己的文本数据或通过Webhook实时写入数据以增强 LLM 的上下文。

-
{ display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; - - .new-database { - background-color: #F0F3F4; - } } .database, .graphbase {