From 3cc1461be28dec936d3e1ae19683f3c69a932e98 Mon Sep 17 00:00:00 2001 From: "DESKTOP-72TV0V4\\caoxiaozhu" Date: Sun, 8 Mar 2026 16:55:44 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=BC=BA=20Knowledge=20?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 优化知识库创建流程 - 添加更多知识库配置选项 - 改进样式和交互 Co-Authored-By: Claude Opus 4.6 --- web/src/views/Knowledge.vue | 287 ++++++++++---- web/src/views/knowledge/knowledge.css | 542 +++++++++++++++++++++++++- 2 files changed, 746 insertions(+), 83 deletions(-) diff --git a/web/src/views/Knowledge.vue b/web/src/views/Knowledge.vue index e227588..3f2b202 100644 --- a/web/src/views/Knowledge.vue +++ b/web/src/views/Knowledge.vue @@ -1,5 +1,5 @@ @@ -286,11 +317,11 @@ const viewDetail = (kb: any) => {
- - + + +
+ {{ model.name }} + {{ model.provider }} - {{ model.model }} +
+
+
+
+ + + {
-
- Enable PDF Parsing - -
-
Parsing Engine - - - + + +
-
- -
Enabled Post-processing
- -
-
-
- -
-
- Use Pandoc Markdown Enrichment - Enable Pandoc conversion for rich formatting -
-
- -
-
- -
-
- Use Academic Document Parsing - Parse formulas, tables, and academic structures -
-
- -
-
- -
-
- Use High Resolution Parsing - High quality mode for complex documents -
-
-
- -
- -
- File Size Limit - + +
+ Docling URL +
@@ -566,5 +576,138 @@ const viewDetail = (kb: any) => { + + + +
+ +
+ +

{{ selectedKnowledge?.name || 'Knowledge Base' }}

+ +
+ + +
+
+ 全部 +
+
+ 已解析 +
+
+ 解析中 +
+
+ 解析失败 +
+
+ + +
+ +
+ +
+
+ +
+
+
产品手册_v2.0.pdf
+
+ 2.4 MB + 2024-01-15 +
+
+
+ +
+
+
+ + +
+
+
+ + 产品手册_v2.0.pdf +
+
+ 2.4 MB + 2024-01-15 10:30 + 解析成功 + 156 个切片 +
+
+
+ +
+ +
+
+ + 1 / 3 + +
+
+
+ + + +
+
+
+
+
diff --git a/web/src/views/knowledge/knowledge.css b/web/src/views/knowledge/knowledge.css index 4d116e0..1207263 100644 --- a/web/src/views/knowledge/knowledge.css +++ b/web/src/views/knowledge/knowledge.css @@ -364,25 +364,41 @@ box-shadow: 0 0 0 3px rgba(54, 191, 250, 0.15); } -.kb-form :deep(.el-input__inner) { - color: #e8eaed; +.kb-form :deep(.el-input__wrapper input) { + color: #e8eaed !important; + -webkit-text-fill-color: #e8eaed !important; font-size: 14px; } -.kb-form :deep(.el-input__inner::placeholder) { - color: #5f6368; +.kb-form :deep(.el-input__wrapper input::placeholder) { + color: #6b7280 !important; + -webkit-text-fill-color: #6b7280 !important; +} + +.kb-form :deep(.el-input__wrapper) { + background-color: #161b22 !important; +} + +.kb-form :deep(.el-input__wrapper input) { + background-color: transparent !important; } .kb-form :deep(.el-textarea__inner) { background-color: #161b22; border: 1px solid #2d3640; border-radius: 8px; - color: #e8eaed; + color: #e8eaed !important; + -webkit-text-fill-color: #e8eaed !important; font-size: 14px; box-shadow: none; padding: 12px; } +.kb-form :deep(.el-textarea__inner::placeholder) { + color: #6b7280 !important; + -webkit-text-fill-color: #6b7280 !important; +} + .kb-form :deep(.el-textarea__inner:hover) { border-color: #ffffff; } @@ -557,6 +573,510 @@ color: #5f6368; } +/* 文件上传弹窗布局 */ +.file-upload-dialog .el-dialog { + position: absolute !important; + top: 8px !important; + left: 50% !important; + transform: translateX(-50%) !important; + margin-bottom: 8px !important; + max-height: calc(100vh - 16px); +} + +.file-upload-dialog .el-dialog__body { + padding: 0; +} + +.file-upload-layout { + display: flex; + flex-direction: column; + height: 85vh; + background-color: #0f1419; +} + +/* 顶部导航 */ +.file-header { + display: flex; + align-items: center; + justify-content: space-between; + padding: 16px 20px; + background-color: #121218; + border-bottom: 1px solid #2a2a3a; +} + +.back-btn { + background: none; + border: none; + color: #9ca3af; + font-size: 18px; + cursor: pointer; + padding: 8px; + border-radius: 6px; +} + +.back-btn:hover { + background-color: #1e2832; + color: #ffffff; +} + +.file-title { + font-size: 16px; + font-weight: 600; + color: #ffffff; +} + +/* 标签栏 */ +.file-tabs { + display: flex; + gap: 4px; + padding: 12px 20px; + background-color: #121218; + border-bottom: 1px solid #2a2a3a; +} + +.file-tab { + padding: 8px 16px; + border-radius: 6px; + font-size: 14px; + color: #9ca3af; + cursor: pointer; + transition: all 0.2s; +} + +.file-tab:hover { + background-color: rgba(249, 115, 22, 0.1); + color: #f97316; +} + +.file-tab.active { + background-color: rgba(249, 115, 22, 0.15); + color: #f97316; +} + +/* 主内容区 */ +.file-main { + flex: 1; + display: flex; + overflow: hidden; +} + +/* 左侧文件列表 */ +.file-list { + width: 420px; + background-color: #0f1419; + border-right: 1px solid #2a2a3a; + overflow-y: auto; + padding: 12px; +} + +.file-item { + display: flex; + align-items: center; + gap: 12px; + padding: 12px; + border-radius: 8px; + cursor: pointer; + transition: all 0.2s; + margin-bottom: 8px; + border: 2px solid transparent; +} + +.file-item:hover { + background-color: rgba(249, 115, 22, 0.08); +} + +.file-item.selected { + background-color: rgba(249, 115, 22, 0.12); + border-color: #f97316; +} + +.file-item-icon { + width: 40px; + height: 40px; + background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%); + border-radius: 8px; + display: flex; + align-items: center; + justify-content: center; + flex-shrink: 0; +} + +.file-item-icon i { + font-size: 18px; + color: white; +} + +.file-item-info { + flex: 1; + min-width: 0; +} + +.file-item-name { + font-size: 14px; + color: #e8eaed; + font-weight: 500; + margin-bottom: 4px; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.file-item-meta { + font-size: 12px; + color: #6b7280; + display: flex; + gap: 8px; +} + +.file-item-status { + flex-shrink: 0; +} + +.file-item-status i { + font-size: 14px; +} + +.file-item-status.success i { + color: #22c55e; +} + +.file-item-status.failed i { + color: #ef4444; +} + +.file-item-status.parsing i { + color: #f59e0b; +} + +/* 右侧预览面板 */ +.file-preview { + flex: 1; + display: flex; + flex-direction: column; + background-color: #121218; +} + +.preview-header { + display: flex; + align-items: center; + justify-content: space-between; + padding: 16px 20px; + border-bottom: 1px solid #2a2a3a; + flex-wrap: wrap; + gap: 12px; +} + +.preview-header-left { + display: flex; + align-items: center; + gap: 12px; +} + +.preview-header-left i { + font-size: 28px; + color: #3b82f6; +} + +.preview-filename { + font-size: 15px; + color: #e8eaed; + font-weight: 500; +} + +.preview-header-info { + display: flex; + align-items: center; + gap: 12px; + flex-wrap: wrap; +} + +.info-tag { + font-size: 12px; + color: #9ca3af; + background-color: #1e2832; + padding: 4px 10px; + border-radius: 4px; +} + +.info-tag.success { + background-color: rgba(34, 197, 94, 0.15); + color: #22c55e; +} + +.preview-content { + flex: 1; + padding: 0; + overflow-y: auto; + display: flex; + flex-direction: column; +} + +.pdf-preview { + flex: 1; + min-height: 0; + background-color: #1a1a1a; +} + +.pdf-iframe { + width: 100%; + height: 100%; + border: none; +} + +.preview-info { + display: grid; + grid-template-columns: repeat(2, 1fr); + gap: 16px; + margin-bottom: 24px; +} + +.info-row { + display: flex; + flex-direction: column; + gap: 4px; +} + +.info-label { + font-size: 12px; + color: #6b7280; +} + +.info-value { + font-size: 14px; + color: #e8eaed; +} + +.info-value.success { + color: #22c55e; +} + +.preview-text { + border: 1px solid #2a2a3a; + border-radius: 8px; + overflow: hidden; +} + +.preview-section-title { + font-size: 13px; + font-weight: 500; + color: #e8eaed; + padding: 12px 16px; + background-color: #1a1c25; + border-bottom: 1px solid #2a2a3a; +} + +.preview-text-content { + padding: 16px; + background-color: #0f1419; + max-height: 320px; + overflow-y: auto; +} + +.preview-text-content p { + font-size: 13px; + color: #9ca3af; + line-height: 1.7; + margin: 0 0 8px 0; +} + +.preview-pagination { + display: flex; + align-items: center; + justify-content: center; + gap: 16px; + margin-top: 16px; +} + +.page-btn { + width: 32px; + height: 32px; + border-radius: 6px; + border: 1px solid #2a2a3a; + background-color: #1a1c25; + color: #9ca3af; + cursor: pointer; + display: flex; + align-items: center; + justify-content: center; + transition: all 0.2s; +} + +.page-btn:hover:not(:disabled) { + border-color: #f97316; + color: #f97316; +} + +.page-btn:disabled { + opacity: 0.5; + cursor: not-allowed; +} + +.page-info { + font-size: 13px; + color: #9ca3af; +} + +.preview-actions { + display: flex; + justify-content: flex-end; + gap: 12px; + padding: 16px 20px; + border-top: 1px solid #2a2a3a; + background-color: #0f1419; +} + +.action-btn { + display: flex; + align-items: center; + gap: 6px; + padding: 8px 16px; + border-radius: 6px; + font-size: 13px; + cursor: pointer; + transition: all 0.2s; + border: none; +} + +.action-btn.delete { + background-color: rgba(239, 68, 68, 0.15); + color: #ef4444; +} + +.action-btn.delete:hover { + background-color: rgba(239, 68, 68, 0.25); +} + +.action-btn.reparse { + background-color: rgba(249, 115, 22, 0.15); + color: #f97316; +} + +.action-btn.reparse:hover { + background-color: rgba(249, 115, 22, 0.25); +} + +.action-btn.confirm { + background-color: #f97316; + color: white; +} + +.action-btn.confirm:hover { + background-color: #ea580c; +} + +.file-menu-item { + display: flex; + align-items: center; + gap: 12px; + padding: 12px 20px; + color: #9ca3af; + cursor: pointer; + transition: all 0.2s; + font-size: 14px; +} + +.file-menu-item:hover { + background-color: rgba(249, 115, 22, 0.1); + color: #f97316; +} + +.file-menu-item.active { + background-color: rgba(249, 115, 22, 0.15); + color: #f97316; + border-right: 3px solid #f97316; +} + +.file-menu-item i { + font-size: 16px; + width: 20px; + text-align: center; +} + +.file-content { + flex: 1; + padding: 24px; + overflow-y: auto; +} + +.content-title { + font-size: 18px; + font-weight: 600; + color: #e8eaed; + margin-bottom: 20px; +} + +/* 上传区域 */ +.upload-area { + height: 100%; + display: flex; + flex-direction: column; +} + +.upload-box { + flex: 1; + border: 2px dashed #3a3a4a; + border-radius: 12px; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + gap: 16px; + cursor: pointer; + transition: all 0.2s; + position: relative; +} + +.upload-box:hover { + border-color: #f97316; + background-color: rgba(249, 115, 22, 0.05); +} + +.upload-btn { + position: absolute; + bottom: 20px; + left: 20px; +} + +.upload-icon { + font-size: 48px; + color: #5f6368; + margin-bottom: 16px; +} + +.upload-text { + font-size: 16px; + color: #e8eaed; + margin-bottom: 8px; +} + +.upload-hint { + font-size: 13px; + color: #6b7280; +} + +.upload-btn { + margin-top: 8px; +} + +.file-count { + display: flex; + justify-content: space-between; + align-items: center; + padding: 16px 0; + color: #9ca3af; + font-size: 14px; +} + +.doc-list, +.doc-chunks, +.parsing-config, +.storage-config { + display: flex; + align-items: center; + justify-content: center; + height: 100%; +} + .footer-right { display: flex; gap: 10px; @@ -588,7 +1108,7 @@ font-weight: 500; display: flex; align-items: center; - gap: 8px; + gap: 10px; } .prev-btn:hover { @@ -597,7 +1117,7 @@ } .next-btn { - background: linear-gradient(135deg, #ffffff 0%, #0ea5e9 100%); + background: linear-gradient(135deg, #f97316 0%, #ea580c 100%); border: none; color: white; padding: 10px 20px; @@ -606,13 +1126,13 @@ font-weight: 600; display: flex; align-items: center; - gap: 8px; - box-shadow: 0 4px 12px rgba(54, 191, 250, 0.25); + gap: 10px; + box-shadow: 0 4px 12px rgba(249, 115, 22, 0.25); } .next-btn:hover { - background: linear-gradient(135deg, #4dc3ff 0%, #ffffff 100%); - box-shadow: 0 6px 16px rgba(54, 191, 250, 0.35); + background: linear-gradient(135deg, #fb923c 0%, #f97316 100%); + box-shadow: 0 6px 16px rgba(249, 115, 22, 0.35); } .confirm-btn {