feat(ui): update SVG assets and enhance localization for knowledge framework

- Redesigned SVG assets for screenshots to improve visual consistency and clarity, including updates to gradients, titles, and layout.
- Added a new screenshot asset to showcase the Wiki Knowledge Base feature.
- Enhanced localization strings across multiple languages to reflect updated terminology and descriptions for the knowledge framework, including agentic reasoning and hybrid search strategies.
- Improved the user interface in the login view to include new tags for agent and wiki features, enhancing user awareness of available functionalities.
This commit is contained in:
wizardchen
2026-06-03 21:43:11 +08:00
committed by lyingbug
parent 226a37330c
commit 710d759b8e
18 changed files with 803 additions and 632 deletions
+63 -72
View File
@@ -1,82 +1,73 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 800 600">
<!-- Background -->
<defs>
<linearGradient id="grad1" x1="0%" y1="0%" x2="100%" y2="100%">
<stop offset="0%" style="stop-color:#F0FDF4;stop-opacity:1" />
<stop offset="100%" style="stop-color:#DCFCE7;stop-opacity:1" />
<linearGradient id="bg1" x1="0%" y1="0%" x2="100%" y2="100%">
<stop offset="0%" stop-color="#F0FDF4"/>
<stop offset="100%" stop-color="#D1FAE5"/>
</linearGradient>
<linearGradient id="brand1" x1="0%" y1="0%" x2="100%" y2="0%">
<stop offset="0%" stop-color="#059669"/>
<stop offset="100%" stop-color="#10B981"/>
</linearGradient>
<filter id="soft1" x="-20%" y="-20%" width="140%" height="140%">
<feDropShadow dx="0" dy="8" stdDeviation="16" flood-color="#065F46" flood-opacity="0.12"/>
</filter>
</defs>
<rect width="800" height="600" fill="url(#grad1)"/>
<!-- Decorative circles -->
<circle cx="100" cy="80" r="100" fill="#10B981" opacity="0.04"/>
<circle cx="700" cy="520" r="120" fill="#10B981" opacity="0.04"/>
<!-- Title -->
<text x="400" y="70" font-family="PingFang SC, sans-serif" font-size="36" font-weight="700" fill="#065F46" text-anchor="middle">智能文档检索</text>
<text x="400" y="105" font-family="PingFang SC, sans-serif" font-size="16" fill="#059669" text-anchor="middle">多模态文档解析 • 语义理解 • 精准检索</text>
<!-- Search Interface -->
<g transform="translate(100, 150)">
<!-- Search box with icon -->
<rect width="600" height="60" rx="12" fill="white" stroke="#10B981" stroke-width="2.5" filter="drop-shadow(0 4px 20px rgba(16, 185, 129, 0.15))"/>
<circle cx="35" cy="30" r="12" stroke="#10B981" stroke-width="2.5" fill="none"/>
<line x1="44" y1="39" x2="52" y2="47" stroke="#10B981" stroke-width="2.5" stroke-linecap="round"/>
<text x="70" y="36" font-family="PingFang SC, sans-serif" font-size="16" fill="#9CA3AF">输入查询内容进行智能检索...</text>
<!-- Search button -->
<rect x="480" y="12" width="100" height="36" rx="8" fill="#10B981"/>
<text x="530" y="36" font-family="PingFang SC, sans-serif" font-size="15" font-weight="600" fill="white" text-anchor="middle">检索</text>
<rect width="800" height="600" fill="url(#bg1)"/>
<circle cx="120" cy="90" r="120" fill="#10B981" opacity="0.05"/>
<circle cx="700" cy="520" r="140" fill="#34D399" opacity="0.06"/>
<text x="64" y="84" font-family="Arial, sans-serif" font-size="32" font-weight="700" fill="#065F46">Intelligent Document Retrieval</text>
<text x="64" y="116" font-family="Arial, sans-serif" font-size="15" fill="#059669">Multimodal parsing &#183; Semantic understanding &#183; Precise locating</text>
<g filter="url(#soft1)">
<rect x="64" y="148" width="672" height="396" rx="20" fill="#FFFFFF"/>
</g>
<!-- Document Results -->
<!-- Result 1 -->
<g transform="translate(100, 250)">
<rect width="600" height="90" rx="12" fill="white" stroke="#10B981" stroke-width="2" filter="drop-shadow(0 2px 12px rgba(16, 185, 129, 0.1))"/>
<!-- Document icon -->
<g transform="translate(25, 20)">
<rect width="50" height="50" rx="8" fill="#D1FAE5"/>
<path d="M15 15 L35 15 M15 25 L35 25 M15 35 L25 35" stroke="#059669" stroke-width="2.5" stroke-linecap="round"/>
</g>
<!-- Content -->
<text x="95" y="35" font-family="PingFang SC, sans-serif" font-size="18" font-weight="600" fill="#065F46">RAG系统技术文档.pdf</text>
<text x="95" y="57" font-family="PingFang SC, sans-serif" font-size="13" fill="#6B7280">详细介绍了检索增强生成的核心原理和实现方案...</text>
<text x="95" y="75" font-family="PingFang SC, sans-serif" font-size="12" fill="#9CA3AF">3.2 MB • 127页 • 2024-01-20</text>
<rect x="64" y="148" width="672" height="48" rx="20" fill="#ECFDF5"/>
<rect x="64" y="176" width="672" height="20" fill="#ECFDF5"/>
<circle cx="90" cy="172" r="5" fill="#34D399"/>
<circle cx="108" cy="172" r="5" fill="#6EE7B7"/>
<circle cx="126" cy="172" r="5" fill="#A7F3D0"/>
<text x="400" y="177" font-family="Arial, sans-serif" font-size="12" fill="#10B981" text-anchor="middle">WeKnora &#183; Knowledge Search</text>
<g transform="translate(96, 224)">
<rect width="608" height="52" rx="12" fill="#F0FDF4" stroke="#A7F3D0" stroke-width="1.5"/>
<circle cx="30" cy="26" r="9" fill="none" stroke="#10B981" stroke-width="2.5"/>
<line x1="37" y1="33" x2="44" y2="40" stroke="#10B981" stroke-width="2.5" stroke-linecap="round"/>
<text x="60" y="32" font-family="Arial, sans-serif" font-size="15" fill="#9CA3AF">How is liability for breach defined in the contract?</text>
<rect x="500" y="10" width="92" height="32" rx="8" fill="url(#brand1)"/>
<text x="546" y="31" font-family="Arial, sans-serif" font-size="14" font-weight="600" fill="#FFFFFF" text-anchor="middle">Search</text>
</g>
<!-- Result 2 -->
<g transform="translate(100, 360)">
<rect width="600" height="90" rx="12" fill="white" stroke="#E5E7EB" stroke-width="1.5" filter="drop-shadow(0 2px 8px rgba(0, 0, 0, 0.05))"/>
<!-- Document icon -->
<g transform="translate(25, 20)">
<rect width="50" height="50" rx="8" fill="#DBEAFE"/>
<path d="M15 15 L35 15 M15 25 L35 25 M15 35 L28 35" stroke="#1E40AF" stroke-width="2.5" stroke-linecap="round"/>
</g>
<!-- Content -->
<text x="95" y="35" font-family="PingFang SC, sans-serif" font-size="18" font-weight="600" fill="#1F2937">向量检索优化方案.docx</text>
<text x="95" y="57" font-family="PingFang SC, sans-serif" font-size="13" fill="#6B7280">基于Embedding的语义检索技术实践与优化...</text>
<text x="95" y="75" font-family="PingFang SC, sans-serif" font-size="12" fill="#9CA3AF">1.8 MB • 45页 • 2024-01-19</text>
<g transform="translate(96, 300)">
<rect width="608" height="68" rx="12" fill="#FFFFFF" stroke="#E5E7EB" stroke-width="1.5"/>
<rect x="16" y="14" width="40" height="40" rx="10" fill="#D1FAE5"/>
<path d="M28 26 H44 M28 34 H44 M28 42 H38" stroke="#059669" stroke-width="2.5" stroke-linecap="round"/>
<text x="72" y="30" font-family="Arial, sans-serif" font-size="14" font-weight="600" fill="#111827">Purchase Agreement &#183; Clause 7 Liability</text>
<text x="72" y="50" font-family="Arial, sans-serif" font-size="12" fill="#6B7280">A breaching party shall pay 20% of the total contract value as penalty...</text>
<rect x="520" y="22" width="72" height="24" rx="12" fill="#ECFDF5"/>
<text x="556" y="38" font-family="Arial, sans-serif" font-size="12" font-weight="600" fill="#059669" text-anchor="middle">98% match</text>
</g>
<!-- Result 3 -->
<g transform="translate(100, 470)">
<rect width="600" height="90" rx="12" fill="white" stroke="#E5E7EB" stroke-width="1.5" filter="drop-shadow(0 2px 8px rgba(0, 0, 0, 0.05))"/>
<!-- Image icon -->
<g transform="translate(25, 20)">
<rect width="50" height="50" rx="8" fill="#FEF3C7"/>
<circle cx="20" cy="28" r="5" fill="#F59E0B"/>
<path d="M12 42 L20 34 L28 42 L38 32" stroke="#F59E0B" stroke-width="2.5" fill="none" stroke-linecap="round"/>
<g transform="translate(96, 380)">
<rect width="608" height="68" rx="12" fill="#FFFFFF" stroke="#E5E7EB" stroke-width="1.5"/>
<rect x="16" y="14" width="40" height="40" rx="10" fill="#DBEAFE"/>
<path d="M28 24 h12 v18 h-16 v-14 z" fill="none" stroke="#2563EB" stroke-width="2" stroke-linejoin="round"/>
<text x="72" y="30" font-family="Arial, sans-serif" font-size="14" font-weight="600" fill="#111827">Addendum.pdf &#183; Page 2</text>
<text x="72" y="50" font-family="Arial, sans-serif" font-size="12" fill="#6B7280">The breaching party shall also compensate for the actual losses incurred...</text>
<rect x="520" y="22" width="72" height="24" rx="12" fill="#ECFDF5"/>
<text x="556" y="38" font-family="Arial, sans-serif" font-size="12" font-weight="600" fill="#059669" text-anchor="middle">91% match</text>
</g>
<g transform="translate(96, 472)">
<text x="0" y="34" font-family="Arial, sans-serif" font-size="13" font-weight="600" fill="#059669">Formats</text>
<g font-family="Arial, sans-serif" font-size="12" fill="#065F46" text-anchor="middle">
<rect x="76" y="16" width="60" height="30" rx="15" fill="#ECFDF5"/><text x="106" y="36">PDF</text>
<rect x="146" y="16" width="64" height="30" rx="15" fill="#ECFDF5"/><text x="178" y="36">Word</text>
<rect x="220" y="16" width="64" height="30" rx="15" fill="#ECFDF5"/><text x="252" y="36">Excel</text>
<rect x="294" y="16" width="66" height="30" rx="15" fill="#ECFDF5"/><text x="327" y="36">Image</text>
<rect x="370" y="16" width="66" height="30" rx="15" fill="#ECFDF5"/><text x="403" y="36">Audio</text>
<rect x="446" y="16" width="92" height="30" rx="15" fill="#ECFDF5"/><text x="492" y="36">Markdown</text>
</g>
<!-- Content -->
<text x="95" y="35" font-family="PingFang SC, sans-serif" font-size="18" font-weight="600" fill="#1F2937">知识图谱架构图.png</text>
<text x="95" y="57" font-family="PingFang SC, sans-serif" font-size="13" fill="#6B7280">展示知识图谱的节点关系和查询路径...</text>
<text x="95" y="75" font-family="PingFang SC, sans-serif" font-size="12" fill="#9CA3AF">1.2 MB • 1920×1080 • 2024-01-18</text>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

+68 -137
View File
@@ -1,154 +1,85 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 800 600">
<!-- Background - Same green gradient as screenshot-1 -->
<defs>
<linearGradient id="grad2" x1="0%" y1="0%" x2="100%" y2="100%">
<stop offset="0%" style="stop-color:#F0FDF4;stop-opacity:1" />
<stop offset="100%" style="stop-color:#DCFCE7;stop-opacity:1" />
<linearGradient id="bg2" x1="0%" y1="0%" x2="100%" y2="100%">
<stop offset="0%" stop-color="#F0FDF4"/>
<stop offset="100%" stop-color="#D1FAE5"/>
</linearGradient>
<linearGradient id="brand2" x1="0%" y1="0%" x2="100%" y2="0%">
<stop offset="0%" stop-color="#059669"/>
<stop offset="100%" stop-color="#10B981"/>
</linearGradient>
<filter id="soft2" x="-20%" y="-20%" width="140%" height="140%">
<feDropShadow dx="0" dy="8" stdDeviation="16" flood-color="#065F46" flood-opacity="0.12"/>
</filter>
</defs>
<rect width="800" height="600" fill="url(#grad2)"/>
<!-- Decorative circles -->
<circle cx="120" cy="90" r="110" fill="#10B981" opacity="0.04"/>
<circle cx="680" cy="510" r="130" fill="#10B981" opacity="0.04"/>
<!-- Title -->
<text x="400" y="70" font-family="PingFang SC, sans-serif" font-size="36" font-weight="700" fill="#065F46" text-anchor="middle">混合检索策略</text>
<text x="400" y="105" font-family="PingFang SC, sans-serif" font-size="16" fill="#059669" text-anchor="middle">BM25 关键词 + 向量语义 + 知识图谱</text>
<!-- Three retrieval methods -->
<rect width="800" height="600" fill="url(#bg2)"/>
<circle cx="120" cy="90" r="120" fill="#10B981" opacity="0.05"/>
<circle cx="700" cy="520" r="140" fill="#34D399" opacity="0.06"/>
<text x="64" y="84" font-family="Arial, sans-serif" font-size="32" font-weight="700" fill="#065F46">Hybrid Search Strategy</text>
<text x="64" y="116" font-family="Arial, sans-serif" font-size="15" fill="#059669">Keyword + vector semantics + knowledge graph, fused for the best result</text>
<g filter="url(#soft2)">
<rect x="64" y="148" width="672" height="396" rx="20" fill="#FFFFFF"/>
</g>
<!-- BM25 -->
<g transform="translate(80, 170)">
<rect width="180" height="280" rx="12" fill="white" stroke="#F59E0B" stroke-width="2.5" filter="drop-shadow(0 4px 16px rgba(245, 158, 11, 0.15))"/>
<rect width="180" height="50" rx="12" fill="#FEF3C7"/>
<text x="90" y="33" font-family="PingFang SC, sans-serif" font-size="18" font-weight="700" fill="#92400E" text-anchor="middle">BM25</text>
<!-- Icon -->
<g transform="translate(65, 70)">
<circle cx="25" cy="25" r="20" fill="#FBBF24" opacity="0.2"/>
<text x="25" y="33" font-family="Arial" font-size="24" font-weight="700" fill="#F59E0B" text-anchor="middle">K</text>
</g>
<!-- Features -->
<text x="90" y="135" font-family="PingFang SC, sans-serif" font-size="14" fill="#92400E" text-anchor="middle">关键词匹配</text>
<g transform="translate(20, 155)">
<rect x="0" y="0" width="140" height="30" rx="6" fill="#FEF3C7"/>
<text x="70" y="20" font-family="PingFang SC, sans-serif" font-size="12" fill="#78350F" text-anchor="middle">TF-IDF 权重</text>
</g>
<g transform="translate(20, 195)">
<rect x="0" y="0" width="140" height="30" rx="6" fill="#FEF3C7"/>
<text x="70" y="20" font-family="PingFang SC, sans-serif" font-size="12" fill="#78350F" text-anchor="middle">词频统计</text>
</g>
<g transform="translate(20, 235)">
<rect x="0" y="0" width="140" height="30" rx="6" fill="#FEF3C7"/>
<text x="70" y="20" font-family="PingFang SC, sans-serif" font-size="12" fill="#78350F" text-anchor="middle">精确匹配</text>
<g transform="translate(96, 184)">
<rect width="184" height="220" rx="14" fill="#FFFBEB" stroke="#FCD34D" stroke-width="1.5"/>
<rect width="184" height="48" rx="14" fill="#FEF3C7"/>
<rect y="34" width="184" height="14" fill="#FEF3C7"/>
<text x="92" y="31" font-family="Arial, sans-serif" font-size="16" font-weight="700" fill="#92400E" text-anchor="middle">BM25 Keyword</text>
<g font-family="Arial, sans-serif" font-size="12.5" fill="#78350F">
<rect x="20" y="70" width="144" height="30" rx="8" fill="#FFFFFF" stroke="#FDE68A"/><text x="92" y="90" text-anchor="middle">TF-IDF weights</text>
<rect x="20" y="110" width="144" height="30" rx="8" fill="#FFFFFF" stroke="#FDE68A"/><text x="92" y="130" text-anchor="middle">Term frequency</text>
<rect x="20" y="150" width="144" height="30" rx="8" fill="#FFFFFF" stroke="#FDE68A"/><text x="92" y="170" text-anchor="middle">Exact match</text>
</g>
<text x="92" y="206" font-family="Arial, sans-serif" font-size="13" font-weight="600" fill="#B45309" text-anchor="middle">Strong on terms</text>
</g>
<!-- Vector -->
<g transform="translate(310, 170)">
<rect width="180" height="280" rx="12" fill="white" stroke="#3B82F6" stroke-width="2.5" filter="drop-shadow(0 4px 16px rgba(59, 130, 246, 0.15))"/>
<rect width="180" height="50" rx="12" fill="#DBEAFE"/>
<text x="90" y="33" font-family="PingFang SC, sans-serif" font-size="18" font-weight="700" fill="#1E40AF" text-anchor="middle">向量检索</text>
<!-- Icon - Vector space -->
<g transform="translate(65, 70)">
<circle cx="25" cy="25" r="20" fill="#60A5FA" opacity="0.2"/>
<circle cx="15" cy="20" r="3" fill="#1E40AF"/>
<circle cx="25" cy="15" r="3" fill="#1E40AF"/>
<circle cx="35" cy="20" r="3" fill="#1E40AF"/>
<circle cx="20" cy="28" r="4" fill="#3B82F6"/>
<circle cx="30" cy="28" r="4" fill="#3B82F6"/>
<circle cx="15" cy="35" r="3" fill="#1E40AF"/>
<circle cx="25" cy="38" r="3" fill="#1E40AF"/>
<circle cx="35" cy="35" r="3" fill="#1E40AF"/>
<!-- Connection lines -->
<line x1="15" y1="20" x2="25" y2="15" stroke="#3B82F6" stroke-width="1" opacity="0.5"/>
<line x1="25" y1="15" x2="35" y2="20" stroke="#3B82F6" stroke-width="1" opacity="0.5"/>
<line x1="15" y1="20" x2="20" y2="28" stroke="#3B82F6" stroke-width="1" opacity="0.5"/>
<line x1="35" y1="20" x2="30" y2="28" stroke="#3B82F6" stroke-width="1" opacity="0.5"/>
<line x1="20" y1="28" x2="15" y2="35" stroke="#3B82F6" stroke-width="1" opacity="0.5"/>
<line x1="30" y1="28" x2="35" y2="35" stroke="#3B82F6" stroke-width="1" opacity="0.5"/>
</g>
<!-- Features -->
<text x="90" y="135" font-family="PingFang SC, sans-serif" font-size="14" fill="#1E40AF" text-anchor="middle">语义理解</text>
<g transform="translate(20, 155)">
<rect x="0" y="0" width="140" height="30" rx="6" fill="#DBEAFE"/>
<text x="70" y="20" font-family="PingFang SC, sans-serif" font-size="12" fill="#1E3A8A" text-anchor="middle">Embedding</text>
</g>
<g transform="translate(20, 195)">
<rect x="0" y="0" width="140" height="30" rx="6" fill="#DBEAFE"/>
<text x="70" y="20" font-family="PingFang SC, sans-serif" font-size="12" fill="#1E3A8A" text-anchor="middle">余弦相似度</text>
</g>
<g transform="translate(20, 235)">
<rect x="0" y="0" width="140" height="30" rx="6" fill="#DBEAFE"/>
<text x="70" y="20" font-family="PingFang SC, sans-serif" font-size="12" fill="#1E3A8A" text-anchor="middle">ANN 检索</text>
<g transform="translate(308, 184)">
<rect width="184" height="220" rx="14" fill="#EFF6FF" stroke="#93C5FD" stroke-width="1.5"/>
<rect width="184" height="48" rx="14" fill="#DBEAFE"/>
<rect y="34" width="184" height="14" fill="#DBEAFE"/>
<text x="92" y="31" font-family="Arial, sans-serif" font-size="16" font-weight="700" fill="#1E40AF" text-anchor="middle">Vector Semantic</text>
<g font-family="Arial, sans-serif" font-size="12.5" fill="#1E3A8A">
<rect x="20" y="70" width="144" height="30" rx="8" fill="#FFFFFF" stroke="#BFDBFE"/><text x="92" y="90" text-anchor="middle">Embedding</text>
<rect x="20" y="110" width="144" height="30" rx="8" fill="#FFFFFF" stroke="#BFDBFE"/><text x="92" y="130" text-anchor="middle">Cosine similarity</text>
<rect x="20" y="150" width="144" height="30" rx="8" fill="#FFFFFF" stroke="#BFDBFE"/><text x="92" y="170" text-anchor="middle">ANN search</text>
</g>
<text x="92" y="206" font-family="Arial, sans-serif" font-size="13" font-weight="600" fill="#2563EB" text-anchor="middle">Understands meaning</text>
</g>
<!-- Knowledge Graph -->
<g transform="translate(540, 170)">
<rect width="180" height="280" rx="12" fill="white" stroke="#10B981" stroke-width="2.5" filter="drop-shadow(0 4px 16px rgba(16, 185, 129, 0.15))"/>
<rect width="180" height="50" rx="12" fill="#DCFCE7"/>
<text x="90" y="33" font-family="PingFang SC, sans-serif" font-size="18" font-weight="700" fill="#065F46" text-anchor="middle">知识图谱</text>
<!-- Icon - Graph nodes -->
<g transform="translate(65, 70)">
<circle cx="25" cy="25" r="20" fill="#34D399" opacity="0.2"/>
<!-- Nodes -->
<circle cx="15" cy="15" r="5" fill="#FFFFFF" stroke="#10B981" stroke-width="2"/>
<circle cx="35" cy="15" r="5" fill="#FFFFFF" stroke="#10B981" stroke-width="2"/>
<circle cx="25" cy="28" r="6" fill="#10B981" stroke="#065F46" stroke-width="2"/>
<circle cx="15" cy="38" r="5" fill="#FFFFFF" stroke="#10B981" stroke-width="2"/>
<circle cx="35" cy="38" r="5" fill="#FFFFFF" stroke="#10B981" stroke-width="2"/>
<!-- Edges -->
<line x1="15" y1="15" x2="25" y2="28" stroke="#10B981" stroke-width="2"/>
<line x1="35" y1="15" x2="25" y2="28" stroke="#10B981" stroke-width="2"/>
<line x1="25" y1="28" x2="15" y2="38" stroke="#10B981" stroke-width="2"/>
<line x1="25" y1="28" x2="35" y2="38" stroke="#10B981" stroke-width="2"/>
</g>
<!-- Features -->
<text x="90" y="135" font-family="PingFang SC, sans-serif" font-size="14" fill="#065F46" text-anchor="middle">关系推理</text>
<g transform="translate(20, 155)">
<rect x="0" y="0" width="140" height="30" rx="6" fill="#DCFCE7"/>
<text x="70" y="20" font-family="PingFang SC, sans-serif" font-size="12" fill="#064E3B" text-anchor="middle">实体识别</text>
</g>
<g transform="translate(20, 195)">
<rect x="0" y="0" width="140" height="30" rx="6" fill="#DCFCE7"/>
<text x="70" y="20" font-family="PingFang SC, sans-serif" font-size="12" fill="#064E3B" text-anchor="middle">路径查询</text>
</g>
<g transform="translate(20, 235)">
<rect x="0" y="0" width="140" height="30" rx="6" fill="#DCFCE7"/>
<text x="70" y="20" font-family="PingFang SC, sans-serif" font-size="12" fill="#064E3B" text-anchor="middle">子图匹配</text>
<!-- Graph -->
<g transform="translate(520, 184)">
<rect width="184" height="220" rx="14" fill="#ECFDF5" stroke="#6EE7B7" stroke-width="1.5"/>
<rect width="184" height="48" rx="14" fill="#D1FAE5"/>
<rect y="34" width="184" height="14" fill="#D1FAE5"/>
<text x="92" y="31" font-family="Arial, sans-serif" font-size="16" font-weight="700" fill="#065F46" text-anchor="middle">Knowledge Graph</text>
<g font-family="Arial, sans-serif" font-size="12.5" fill="#064E3B">
<rect x="20" y="70" width="144" height="30" rx="8" fill="#FFFFFF" stroke="#A7F3D0"/><text x="92" y="90" text-anchor="middle">Entity recognition</text>
<rect x="20" y="110" width="144" height="30" rx="8" fill="#FFFFFF" stroke="#A7F3D0"/><text x="92" y="130" text-anchor="middle">Relation paths</text>
<rect x="20" y="150" width="144" height="30" rx="8" fill="#FFFFFF" stroke="#A7F3D0"/><text x="92" y="170" text-anchor="middle">Subgraph match</text>
</g>
<text x="92" y="206" font-family="Arial, sans-serif" font-size="13" font-weight="600" fill="#059669" text-anchor="middle">Reasons over links</text>
</g>
<!-- Arrows to fusion -->
<path d="M170 460 L400 510" stroke="#9CA3AF" stroke-width="2.5" stroke-dasharray="5,3" marker-end="url(#arrowGray)"/>
<path d="M400 460 L400 510" stroke="#9CA3AF" stroke-width="2.5" stroke-dasharray="5,3" marker-end="url(#arrowGray)"/>
<path d="M630 460 L400 510" stroke="#9CA3AF" stroke-width="2.5" stroke-dasharray="5,3" marker-end="url(#arrowGray)"/>
<!-- Fusion result -->
<g transform="translate(250, 520)">
<rect width="300" height="50" rx="10" fill="#10B981" filter="drop-shadow(0 4px 16px rgba(16, 185, 129, 0.25))"/>
<text x="150" y="32" font-family="PingFang SC, sans-serif" font-size="16" font-weight="700" fill="white" text-anchor="middle">融合排序 → 最优结果</text>
<g stroke="#10B981" stroke-width="2.5" fill="none" stroke-linecap="round">
<path d="M188 412 V446 H400 V470" marker-end="url(#arr2)"/>
<path d="M400 412 V470" marker-end="url(#arr2)"/>
<path d="M612 412 V446 H400" />
</g>
<!-- Arrow marker -->
<g transform="translate(220, 478)">
<rect width="360" height="50" rx="14" fill="url(#brand2)" filter="url(#soft2)"/>
<text x="180" y="31" font-family="Arial, sans-serif" font-size="16" font-weight="700" fill="#FFFFFF" text-anchor="middle">RRF fusion ranking -&gt; best result</text>
</g>
<defs>
<marker id="arrowGray" markerWidth="10" markerHeight="10" refX="9" refY="3" orient="auto">
<polygon points="0 0, 10 3, 0 6" fill="#9CA3AF"/>
<marker id="arr2" markerWidth="9" markerHeight="9" refX="8" refY="3" orient="auto">
<polygon points="0 0, 9 3, 0 6" fill="#10B981"/>
</marker>
</defs>
</svg>

Before

Width:  |  Height:  |  Size: 8.2 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

+108
View File
@@ -0,0 +1,108 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 800 600">
<defs>
<linearGradient id="bg3" x1="0%" y1="0%" x2="100%" y2="100%">
<stop offset="0%" stop-color="#F0FDF4"/>
<stop offset="100%" stop-color="#D1FAE5"/>
</linearGradient>
<filter id="soft3" x="-20%" y="-20%" width="140%" height="140%">
<feDropShadow dx="0" dy="8" stdDeviation="16" flood-color="#065F46" flood-opacity="0.12"/>
</filter>
</defs>
<rect width="800" height="600" fill="url(#bg3)"/>
<circle cx="120" cy="90" r="120" fill="#10B981" opacity="0.05"/>
<circle cx="700" cy="520" r="140" fill="#34D399" opacity="0.06"/>
<text x="64" y="84" font-family="PingFang SC, sans-serif" font-size="32" font-weight="700" fill="#065F46">Wiki Knowledge Base</text>
<text x="64" y="116" font-family="PingFang SC, sans-serif" font-size="15" fill="#059669">Distill scattered documents into structured, interlinked pages and a knowledge graph</text>
<g filter="url(#soft3)">
<rect x="64" y="148" width="672" height="396" rx="20" fill="#FFFFFF"/>
</g>
<g transform="translate(104, 232)">
<rect x="16" y="16" width="120" height="156" rx="10" fill="#ECFDF5" stroke="#A7F3D0" stroke-width="1.5"/>
<rect x="8" y="8" width="120" height="156" rx="10" fill="#F0FDF4" stroke="#6EE7B7" stroke-width="1.5"/>
<rect x="0" y="0" width="120" height="156" rx="10" fill="#FFFFFF" stroke="#10B981" stroke-width="1.5"/>
<g stroke="#9CA3AF" stroke-width="2" stroke-linecap="round">
<line x1="20" y1="28" x2="100" y2="28"/>
<line x1="20" y1="44" x2="100" y2="44"/>
<line x1="20" y1="60" x2="84" y2="60"/>
<line x1="20" y1="84" x2="100" y2="84"/>
<line x1="20" y1="100" x2="100" y2="100"/>
<line x1="20" y1="116" x2="72" y2="116"/>
</g>
<text x="64" y="184" font-family="PingFang SC, sans-serif" font-size="13" font-weight="600" fill="#059669" text-anchor="middle">Source Docs</text>
</g>
<g transform="translate(258, 300)">
<path d="M0 12 H56" stroke="#10B981" stroke-width="3" marker-end="url(#arr3)"/>
<text x="30" y="-2" font-family="PingFang SC, sans-serif" font-size="12.5" font-weight="600" fill="#059669" text-anchor="middle">LLM Distill</text>
</g>
<g transform="translate(336, 196)">
<rect width="180" height="64" rx="12" fill="#FFFFFF" stroke="#10B981" stroke-width="1.5"/>
<rect x="14" y="14" width="28" height="10" rx="5" fill="#10B981"/>
<text x="54" y="24" font-family="PingFang SC, sans-serif" font-size="13" font-weight="600" fill="#111827">Overview</text>
<line x1="14" y1="40" x2="166" y2="40" stroke="#E5E7EB" stroke-width="1.5"/>
<line x1="14" y1="52" x2="120" y2="52" stroke="#E5E7EB" stroke-width="1.5"/>
</g>
<g transform="translate(336, 276)">
<rect width="180" height="64" rx="12" fill="#FFFFFF" stroke="#34D399" stroke-width="1.5"/>
<rect x="14" y="14" width="28" height="10" rx="5" fill="#34D399"/>
<text x="54" y="24" font-family="PingFang SC, sans-serif" font-size="13" font-weight="600" fill="#111827">Architecture</text>
<line x1="14" y1="40" x2="166" y2="40" stroke="#E5E7EB" stroke-width="1.5"/>
<line x1="14" y1="52" x2="100" y2="52" stroke="#E5E7EB" stroke-width="1.5"/>
</g>
<g transform="translate(336, 356)">
<rect width="180" height="64" rx="12" fill="#FFFFFF" stroke="#6EE7B7" stroke-width="1.5"/>
<rect x="14" y="14" width="28" height="10" rx="5" fill="#6EE7B7"/>
<text x="54" y="24" font-family="PingFang SC, sans-serif" font-size="13" font-weight="600" fill="#111827">FAQ</text>
<line x1="14" y1="40" x2="166" y2="40" stroke="#E5E7EB" stroke-width="1.5"/>
<line x1="14" y1="52" x2="130" y2="52" stroke="#E5E7EB" stroke-width="1.5"/>
</g>
<g stroke="#10B981" stroke-width="1.5" stroke-dasharray="4,3">
<path d="M426 260 V276" fill="none"/>
<path d="M426 340 V356" fill="none"/>
</g>
<g transform="translate(560, 196)">
<rect width="148" height="224" rx="14" fill="#ECFDF5" stroke="#6EE7B7" stroke-width="1.5"/>
<text x="74" y="30" font-family="PingFang SC, sans-serif" font-size="14" font-weight="700" fill="#065F46" text-anchor="middle">Graph</text>
<g stroke="#10B981" stroke-width="2">
<line x1="40" y1="80" x2="100" y2="70"/>
<line x1="40" y1="80" x2="62" y2="140"/>
<line x1="100" y1="70" x2="110" y2="150"/>
<line x1="62" y1="140" x2="110" y2="150"/>
<line x1="62" y1="140" x2="40" y2="190"/>
<line x1="110" y1="150" x2="100" y2="196"/>
</g>
<g fill="#10B981">
<circle cx="40" cy="80" r="10"/>
<circle cx="100" cy="70" r="10"/>
<circle cx="62" cy="140" r="11"/>
<circle cx="110" cy="150" r="10"/>
<circle cx="40" cy="190" r="8"/>
<circle cx="100" cy="196" r="8"/>
</g>
<g fill="#A7F3D0">
<circle cx="40" cy="80" r="4"/>
<circle cx="100" cy="70" r="4"/>
<circle cx="62" cy="140" r="4"/>
<circle cx="110" cy="150" r="4"/>
</g>
</g>
<g transform="translate(104, 470)" font-family="PingFang SC, sans-serif" font-size="12.5" fill="#065F46" text-anchor="middle">
<rect x="0" y="0" width="120" height="30" rx="15" fill="#ECFDF5"/><text x="60" y="20">Structured</text>
<rect x="134" y="0" width="120" height="30" rx="15" fill="#ECFDF5"/><text x="194" y="20">Auto-linked</text>
<rect x="268" y="0" width="120" height="30" rx="15" fill="#ECFDF5"/><text x="328" y="20">Graph</text>
<rect x="402" y="0" width="120" height="30" rx="15" fill="#ECFDF5"/><text x="462" y="20">Auto-sync</text>
</g>
<defs>
<marker id="arr3" markerWidth="9" markerHeight="9" refX="8" refY="3" orient="auto">
<polygon points="0 0, 9 3, 0 6" fill="#10B981"/>
</marker>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 5.6 KiB

+61 -87
View File
@@ -1,102 +1,76 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 800 600">
<!-- Background - Same green gradient -->
<defs>
<linearGradient id="grad3" x1="0%" y1="0%" x2="100%" y2="100%">
<stop offset="0%" style="stop-color:#F0FDF4;stop-opacity:1" />
<stop offset="100%" style="stop-color:#DCFCE7;stop-opacity:1" />
<linearGradient id="bg4" x1="0%" y1="0%" x2="100%" y2="100%">
<stop offset="0%" stop-color="#F0FDF4"/>
<stop offset="100%" stop-color="#D1FAE5"/>
</linearGradient>
<linearGradient id="brand4" x1="0%" y1="0%" x2="100%" y2="0%">
<stop offset="0%" stop-color="#059669"/>
<stop offset="100%" stop-color="#10B981"/>
</linearGradient>
<filter id="soft4" x="-20%" y="-20%" width="140%" height="140%">
<feDropShadow dx="0" dy="8" stdDeviation="16" flood-color="#065F46" flood-opacity="0.12"/>
</filter>
</defs>
<rect width="800" height="600" fill="url(#grad3)"/>
<!-- Decorative circles -->
<circle cx="110" cy="85" r="105" fill="#10B981" opacity="0.04"/>
<circle cx="690" cy="515" r="125" fill="#10B981" opacity="0.04"/>
<!-- Title -->
<text x="400" y="70" font-family="PingFang SC, sans-serif" font-size="36" font-weight="700" fill="#065F46" text-anchor="middle">Agentic RAG</text>
<text x="400" y="105" font-family="PingFang SC, sans-serif" font-size="16" fill="#059669" text-anchor="middle">基于 ReAct 范式的智能检索代理</text>
<!-- Query Input -->
<g transform="translate(300, 140)">
<rect width="200" height="50" rx="10" fill="white" stroke="#10B981" stroke-width="2" filter="drop-shadow(0 4px 16px rgba(16, 185, 129, 0.15))"/>
<text x="100" y="32" font-family="PingFang SC, sans-serif" font-size="16" font-weight="600" fill="#065F46" text-anchor="middle">用户问题</text>
<rect width="800" height="600" fill="url(#bg4)"/>
<circle cx="120" cy="90" r="120" fill="#10B981" opacity="0.05"/>
<circle cx="700" cy="520" r="140" fill="#34D399" opacity="0.06"/>
<text x="64" y="84" font-family="Arial, sans-serif" font-size="32" font-weight="700" fill="#065F46">Agentic RAG</text>
<text x="64" y="116" font-family="Arial, sans-serif" font-size="15" fill="#059669">A ReAct-style agent that reasons, calls tools and iterates over multiple steps</text>
<g filter="url(#soft4)">
<rect x="64" y="148" width="672" height="396" rx="20" fill="#FFFFFF"/>
</g>
<!-- Arrow down -->
<path d="M400 200 L400 225" stroke="#059669" stroke-width="3" marker-end="url(#arrowGreen)"/>
<!-- ReAct Loop Container -->
<g transform="translate(120, 235)">
<rect width="560" height="240" rx="16" fill="white" stroke="#8B5CF6" stroke-width="3" stroke-dasharray="10,5" filter="drop-shadow(0 4px 20px rgba(139, 92, 246, 0.15))"/>
<text x="280" y="30" font-family="PingFang SC, sans-serif" font-size="18" font-weight="700" fill="#5B21B6" text-anchor="middle">ReAct 循环</text>
<!-- Reasoning -->
<g transform="translate(40, 55)">
<rect width="220" height="75" rx="10" fill="#EDE9FE" stroke="#8B5CF6" stroke-width="2"/>
<text x="110" y="25" font-family="PingFang SC, sans-serif" font-size="17" font-weight="700" fill="#5B21B6" text-anchor="middle">① Reasoning</text>
<text x="110" y="45" font-family="PingFang SC, sans-serif" font-size="13" fill="#6B21A8" text-anchor="middle">分析问题</text>
<text x="110" y="63" font-family="PingFang SC, sans-serif" font-size="13" fill="#6B21A8" text-anchor="middle">规划行动策略</text>
<g transform="translate(300, 176)">
<rect width="200" height="44" rx="12" fill="#ECFDF5" stroke="#6EE7B7" stroke-width="1.5"/>
<text x="100" y="28" font-family="Arial, sans-serif" font-size="15" font-weight="600" fill="#065F46" text-anchor="middle">User Question</text>
</g>
<path d="M400 220 V244" stroke="#059669" stroke-width="2.5" marker-end="url(#arrG4)"/>
<g transform="translate(120, 250)">
<rect width="560" height="208" rx="16" fill="#FAF5FF" stroke="#C4B5FD" stroke-width="2" stroke-dasharray="9,5"/>
<rect x="20" y="-1" width="120" height="26" rx="13" fill="#8B5CF6"/>
<text x="80" y="17" font-family="Arial, sans-serif" font-size="13" font-weight="700" fill="#FFFFFF" text-anchor="middle">ReAct Loop</text>
<g transform="translate(36, 48)">
<rect width="216" height="120" rx="12" fill="#EDE9FE" stroke="#A78BFA" stroke-width="1.5"/>
<text x="108" y="32" font-family="Arial, sans-serif" font-size="16" font-weight="700" fill="#5B21B6" text-anchor="middle">1. Reasoning</text>
<text x="108" y="62" font-family="Arial, sans-serif" font-size="13" fill="#6B21A8" text-anchor="middle">Analyze the question</text>
<text x="108" y="86" font-family="Arial, sans-serif" font-size="13" fill="#6B21A8" text-anchor="middle">Plan the next action</text>
</g>
<!-- Arrow to Tools -->
<path d="M270 92 L290 92" stroke="#8B5CF6" stroke-width="2.5" marker-end="url(#arrowPurple)"/>
<!-- Acting with Tools -->
<g transform="translate(300, 55)">
<rect width="220" height="160" rx="10" fill="#FEF3C7" stroke="#F59E0B" stroke-width="2"/>
<text x="110" y="25" font-family="PingFang SC, sans-serif" font-size="17" font-weight="700" fill="#92400E" text-anchor="middle">② Acting (Tools)</text>
<!-- Tool 1 -->
<g transform="translate(20, 38)">
<rect width="180" height="28" rx="6" fill="white" stroke="#F59E0B" stroke-width="1.5"/>
<circle cx="14" cy="14" r="6" fill="#FBBF24"/>
<text x="95" y="18" font-family="PingFang SC, sans-serif" font-size="12" fill="#78350F" text-anchor="middle">🔍 向量检索</text>
</g>
<!-- Tool 2 -->
<g transform="translate(20, 73)">
<rect width="180" height="28" rx="6" fill="white" stroke="#F59E0B" stroke-width="1.5"/>
<circle cx="14" cy="14" r="6" fill="#FBBF24"/>
<text x="95" y="18" font-family="PingFang SC, sans-serif" font-size="12" fill="#78350F" text-anchor="middle">🔗 知识图谱</text>
</g>
<!-- Tool 3 -->
<g transform="translate(20, 108)">
<rect width="180" height="28" rx="6" fill="white" stroke="#F59E0B" stroke-width="1.5"/>
<circle cx="14" cy="14" r="6" fill="#FBBF24"/>
<text x="95" y="18" font-family="PingFang SC, sans-serif" font-size="12" fill="#78350F" text-anchor="middle">📊 BM25检索</text>
<path d="M256 108 H300" stroke="#8B5CF6" stroke-width="2.5" marker-end="url(#arrP4)"/>
<g transform="translate(308, 36)">
<rect width="216" height="144" rx="12" fill="#FEF3C7" stroke="#FBBF24" stroke-width="1.5"/>
<text x="108" y="30" font-family="Arial, sans-serif" font-size="16" font-weight="700" fill="#92400E" text-anchor="middle">2. Acting (Tools)</text>
<g font-family="Arial, sans-serif" font-size="12.5" fill="#78350F" text-anchor="middle">
<rect x="20" y="44" width="176" height="28" rx="8" fill="#FFFFFF" stroke="#FDE68A"/><text x="108" y="63">Vector Search</text>
<rect x="20" y="78" width="176" height="28" rx="8" fill="#FFFFFF" stroke="#FDE68A"/><text x="108" y="97">Knowledge Graph</text>
<rect x="20" y="112" width="176" height="28" rx="8" fill="#FFFFFF" stroke="#FDE68A"/><text x="108" y="131">Web Search</text>
</g>
</g>
<!-- Arrow back to Reasoning (loop) -->
<path d="M300 160 Q 280 195 150 160" stroke="#8B5CF6" stroke-width="2.5" stroke-dasharray="5,3" fill="none" marker-end="url(#arrowPurple)"/>
<text x="220" y="200" font-family="PingFang SC, sans-serif" font-size="12" fill="#7C3AED" text-anchor="middle">迭代优化</text>
<path d="M416 180 Q 300 206 150 170" stroke="#8B5CF6" stroke-width="2.5" stroke-dasharray="5,4" fill="none" marker-end="url(#arrP4)"/>
<text x="280" y="204" font-family="Arial, sans-serif" font-size="12.5" font-weight="600" fill="#7C3AED" text-anchor="middle">Observe results &#183; iterate</text>
</g>
<!-- Arrow down to result -->
<path d="M400 485 L400 505" stroke="#059669" stroke-width="3" marker-end="url(#arrowGreen)"/>
<!-- Final Answer -->
<g transform="translate(250, 515)">
<rect width="300" height="50" rx="10" fill="#10B981" filter="drop-shadow(0 4px 16px rgba(16, 185, 129, 0.25))"/>
<text x="150" y="32" font-family="PingFang SC, sans-serif" font-size="16" font-weight="700" fill="white" text-anchor="middle">③ 生成增强答案</text>
<path d="M400 458 V482" stroke="#059669" stroke-width="2.5" marker-end="url(#arrG4)"/>
<g transform="translate(250, 488)">
<rect width="300" height="46" rx="14" fill="url(#brand4)" filter="url(#soft4)"/>
<text x="150" y="30" font-family="Arial, sans-serif" font-size="16" font-weight="700" fill="#FFFFFF" text-anchor="middle">3. Grounded, cited answer</text>
</g>
<!-- Side annotation -->
<g transform="translate(50, 320)">
<text x="0" y="0" font-family="PingFang SC, sans-serif" font-size="13" font-weight="600" fill="#059669">特点:</text>
<text x="0" y="22" font-family="PingFang SC, sans-serif" font-size="12" fill="#6B7280">• 自主推理</text>
<text x="0" y="42" font-family="PingFang SC, sans-serif" font-size="12" fill="#6B7280">• 工具调用</text>
<text x="0" y="62" font-family="PingFang SC, sans-serif" font-size="12" fill="#6B7280">• 动态迭代</text>
</g>
<!-- Arrow markers -->
<defs>
<marker id="arrowGreen" markerWidth="10" markerHeight="10" refX="9" refY="3" orient="auto">
<polygon points="0 0, 10 3, 0 6" fill="#059669"/>
<marker id="arrG4" markerWidth="9" markerHeight="9" refX="8" refY="3" orient="auto">
<polygon points="0 0, 9 3, 0 6" fill="#059669"/>
</marker>
<marker id="arrowPurple" markerWidth="10" markerHeight="10" refX="9" refY="3" orient="auto">
<polygon points="0 0, 10 3, 0 6" fill="#8B5CF6"/>
<marker id="arrP4" markerWidth="9" markerHeight="9" refX="8" refY="3" orient="auto">
<polygon points="0 0, 9 3, 0 6" fill="#8B5CF6"/>
</marker>
</defs>
</svg>

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

@@ -15,6 +15,28 @@ export function escapeHtml(str: string): string {
.replace(/'/g, '&#039;')
}
export function highlightRegex(text: string, pattern: string): string {
const src = text || ''
const p = (pattern || '').trim()
const escaped = escapeHtml(src)
if (!p) return escaped
try {
const re = new RegExp(p, 'gi')
let result = ''
let lastIndex = 0
for (const match of src.matchAll(re)) {
const idx = match.index ?? 0
result += escapeHtml(src.slice(lastIndex, idx))
result += `<mark class="search-highlight">${escapeHtml(match[0])}</mark>`
lastIndex = idx + match[0].length
}
result += escapeHtml(src.slice(lastIndex))
return result
} catch {
return escaped
}
}
export function highlightText(text: string, query: string): string {
const q = (query || '').trim()
const escaped = escapeHtml(text || '')
+17 -7
View File
@@ -2697,6 +2697,8 @@ export default {
referenceIconAlt: 'Reference materials icon',
chunkIdLabel: 'Chunk ID:',
documentIdLabel: 'Document ID:',
chunkOrdinal: 'Chunk {index}',
previewContent: 'Preview content',
noPlanSteps: 'No detailed steps provided',
chunkIndexLabel: 'Chunk #{index}',
chunkPositionLabel: '(Position: {position})',
@@ -3503,22 +3505,26 @@ export default {
},
},
platform: {
subtitle: 'Enterprise-level Intelligent Document Retrieval Framework',
description: 'Making complex document understanding and precise retrieval simple',
subtitle: 'LLM-Powered Enterprise Knowledge Framework',
description: 'RAG retrieval, agentic reasoning and Wiki knowledge bases — so your documents are truly understood and put to work',
rag: 'RAG Enhanced Generation',
agent: 'ReAct Agent',
wiki: 'Wiki Knowledge Base',
hybridSearch: 'Hybrid Search',
localDeploy: 'Local Deployment',
multimodalParsing: 'Multimodal Document Parsing',
hybridSearchEngine: 'Hybrid Search Engine',
ragQandA: 'RAG Intelligent Q&A',
hybridSearchEngine: 'Hybrid Search + Knowledge Graph',
ragQandA: 'ReAct Agent Q&A',
independentTenant: 'Independent Tenant Space',
fullApiAccess: 'Full API Access',
knowledgeBaseManagement: 'Knowledge Base Management',
carousel: {
agenticRagTitle: 'Agentic RAG',
agenticRagDesc: 'Query rewriting + smart recall + re-ranking',
agenticRagDesc: 'ReAct reasoning + tool calls + multi-step thinking',
hybridSearchTitle: 'Hybrid search strategy',
hybridSearchDesc: 'BM25 + Vector + Knowledge Graph',
wikiTitle: 'Wiki Knowledge Base',
wikiDesc: 'Distills documents into structured, interlinked knowledge',
smartDocRetrievalTitle: 'Intelligent document retrieval',
smartDocRetrievalDesc: 'PDF/Word/Image multi-format parsing'
}
@@ -4558,8 +4564,12 @@ export default {
foundResultsFromFiles: 'Found {count} result(s) from {files} file(s)',
foundResults: 'Found {count} result(s)',
webResults: 'Found {count} web search result(s)',
foundMatches: 'Found {count} match(es)',
showingCount: '(showing {count})',
grepSummary: 'Found {chunks} matching chunk(s) across {docs} document(s)',
},
grepResults: {
chunkHits: '{count} chunks',
keywordHits: '{count} hits',
titleMatch: 'title',
},
toolStatus: {
calling: 'Calling {name}...',
+17 -7
View File
@@ -802,6 +802,8 @@ export default {
referenceIconAlt: "참조 내용 아이콘",
chunkIdLabel: "청크 ID:",
documentIdLabel: "문서 ID:",
chunkOrdinal: "청크 {index}",
previewContent: "내용 미리보기",
noPlanSteps: "구체적인 단계가 제공되지 않았습니다",
chunkIndexLabel: "청크 #{index}",
chunkPositionLabel: "(위치: {position})",
@@ -2732,22 +2734,26 @@ export default {
},
},
platform: {
subtitle: "엔터프라이즈급 지능형 문서 검색 프레임워크",
description: "복잡한 문서 이해와 정확한 검색을 간단하게",
subtitle: "대규모 언어 모델 기반 엔터프라이즈 지식 프레임워크",
description: "RAG 검색, 에이전트 추론, Wiki 지식베이스로 문서를 진정으로 이해하고 활용합니다",
rag: "RAG 강화 생성",
agent: "ReAct 에이전트",
wiki: "Wiki 지식베이스",
hybridSearch: "하이브리드 검색",
localDeploy: "로컬 배포",
multimodalParsing: "멀티모달 문서 파싱",
hybridSearchEngine: "하이브리드 검색 엔진",
ragQandA: "RAG 지능형 Q&A",
hybridSearchEngine: "하이브리드 검색 + 지식 그래프",
ragQandA: "ReAct 에이전트 Q&A",
independentTenant: "독립 테넌트 스페이스",
fullApiAccess: "전체 API 접근",
knowledgeBaseManagement: "지식베이스 관리",
carousel: {
agenticRagTitle: "Agentic RAG",
agenticRagDesc: "질문 재작성 + 지능형 검색 + 재정렬",
agenticRagDesc: "ReAct 추론 + 도구 호출 + 다단계 사고",
hybridSearchTitle: "하이브리드 검색 전략",
hybridSearchDesc: "BM25 + 벡터 + 지식 그래프",
wikiTitle: "Wiki 지식베이스",
wikiDesc: "문서를 구조화된 상호 연결 지식으로 정제",
smartDocRetrievalTitle: "지능형 문서 검색",
smartDocRetrievalDesc: "PDF/Word/이미지 다중 형식 파싱",
},
@@ -4613,8 +4619,12 @@ export default {
foundResultsFromFiles: '{files}개 파일에서 {count}개 결과 발견',
foundResults: '{count}개 결과 발견',
webResults: '{count}개 웹 검색 결과 발견',
foundMatches: '{count}개 일치 항목 발견',
showingCount: '({count}개 표시)',
grepSummary: '일치하는 청크 {chunks}개, 문서 {docs}개',
},
grepResults: {
chunkHits: '청크 {count}개',
keywordHits: '{count}회',
titleMatch: '제목',
},
toolStatus: {
calling: '{name} 호출 중...',
+17 -7
View File
@@ -3033,6 +3033,8 @@ export default {
referenceIconAlt: 'Иконка ссылок на материалы',
chunkIdLabel: 'ID фрагмента:',
documentIdLabel: 'ID документа:',
chunkOrdinal: 'Фрагмент {index}',
previewContent: 'Предпросмотр содержимого',
noPlanSteps: 'Подробные шаги не предоставлены',
chunkIndexLabel: 'Фрагмент №{index}',
chunkPositionLabel: '(позиция: {position})',
@@ -3199,22 +3201,26 @@ export default {
},
},
platform: {
subtitle: 'Корпоративная платформа интеллектуального поиска документов',
description: 'Упрощение понимания сложных документов и точного поиска',
subtitle: 'Корпоративная платформа знаний на базе больших языковых моделей',
description: 'RAG-поиск, агентные рассуждения и Wiki-базы знаний — чтобы документы действительно понимались и приносили пользу',
rag: 'RAG расширенная генерация',
agent: 'ReAct агент',
wiki: 'Wiki-база знаний',
hybridSearch: 'Гибридный поиск',
localDeploy: 'Локальное развертывание',
multimodalParsing: 'Мультимодальный анализ документов',
hybridSearchEngine: 'Гибридная поисковая система',
ragQandA: 'RAG интеллектуальный вопрос-ответ',
hybridSearchEngine: 'Гибридный поиск + граф знаний',
ragQandA: 'Вопрос-ответ с ReAct агентом',
independentTenant: 'Независимое пространство арендатора',
fullApiAccess: 'Полный доступ к API',
knowledgeBaseManagement: 'Управление базой знаний',
carousel: {
agenticRagTitle: 'Agentic RAG',
agenticRagDesc: 'Переформулировка запроса + умный отбор + повторная ранжировка',
agenticRagDesc: 'ReAct-рассуждения + вызов инструментов + многошаговое мышление',
hybridSearchTitle: 'Гибридная стратегия поиска',
hybridSearchDesc: 'BM25 + Вектор + Граф знаний',
wikiTitle: 'Wiki-база знаний',
wikiDesc: 'Дистилляция документов в структурированные связанные знания',
smartDocRetrievalTitle: 'Интеллектуальный поиск документов',
smartDocRetrievalDesc: 'Многоформатный разбор PDF/Word/изображений'
}
@@ -4113,8 +4119,12 @@ export default {
foundResultsFromFiles: 'Найдено {count} результат(ов) из {files} файл(ов)',
foundResults: 'Найдено {count} результат(ов)',
webResults: 'Найдено {count} результат(ов) веб-поиска',
foundMatches: 'Найдено {count} совпадений',
showingCount: '(показано {count})'
grepSummary: 'Найдено фрагментов: {chunks}, в документах: {docs}',
},
grepResults: {
chunkHits: '{count} фрагм.',
keywordHits: '{count} вх.',
titleMatch: 'заголовок',
},
toolStatus: {
calling: 'Вызов {name}...',
+17 -7
View File
@@ -806,6 +806,8 @@ export default {
referenceIconAlt: "参考内容图标",
chunkIdLabel: "片段ID:",
documentIdLabel: "文档ID:",
chunkOrdinal: "片段 {index}",
previewContent: "预览内容",
noPlanSteps: "未提供具体步骤",
chunkIndexLabel: "片段 #{index}",
chunkPositionLabel: "(位置: {position})",
@@ -2720,22 +2722,26 @@ export default {
},
},
platform: {
subtitle: "企业级智能文档检索框架",
description: "让复杂文档理解与精准检索变得简单",
subtitle: "大模型驱动的企业级知识框架",
description: "RAG 检索、智能体推理、Wiki 知识库,让文档真正被理解和运用",
rag: "RAG 增强生成",
agent: "ReAct 智能体",
wiki: "Wiki 知识库",
hybridSearch: "混合检索",
localDeploy: "本地部署",
multimodalParsing: "多模态文档解析",
hybridSearchEngine: "混合检索引擎",
ragQandA: "RAG 智能问答",
hybridSearchEngine: "混合检索 + 知识图谱",
ragQandA: "ReAct 智能体问答",
independentTenant: "独立租户空间",
fullApiAccess: "完整 API 访问",
knowledgeBaseManagement: "知识库管理",
carousel: {
agenticRagTitle: "Agentic RAG",
agenticRagDesc: "问题改写 + 智能召回 + 重排序",
agenticRagDesc: "ReAct 推理 + 工具调用 + 多步思考",
hybridSearchTitle: "混合检索策略",
hybridSearchDesc: "BM25 + 向量 + 知识图谱",
wikiTitle: "Wiki 知识库",
wikiDesc: "文档蒸馏为结构化互联知识",
smartDocRetrievalTitle: "智能文档检索",
smartDocRetrievalDesc: "PDF/Word/图片多格式解析",
},
@@ -4552,8 +4558,12 @@ export default {
foundResultsFromFiles: "找到 {count} 个结果,来自 {files} 个文件",
foundResults: "找到 {count} 个结果",
webResults: "找到 {count} 个网络搜索结果",
foundMatches: "找到 {count} 处匹配",
showingCount: "(显示 {count} 个)",
grepSummary: "找到 {chunks} 个匹配片段,来自 {docs} 个文档",
},
grepResults: {
chunkHits: "{count} 片段",
keywordHits: "{count} 次",
titleMatch: "标题匹配",
},
toolStatus: {
calling: "正在调用 {name}...",
+4
View File
@@ -203,7 +203,9 @@ export interface GrepKnowledgeResult {
knowledge_id: string;
knowledge_base_id: string;
knowledge_title: string;
title_match?: boolean;
chunk_hit_count: number;
match_snippet?: string;
pattern_counts: Record<string, number>;
total_pattern_hits: number;
distinct_patterns: number;
@@ -212,11 +214,13 @@ export interface GrepKnowledgeResult {
// Grep results data
export interface GrepResultsData {
display_type: 'grep_results';
query?: string;
patterns: string[];
knowledge_results: GrepKnowledgeResult[];
result_count: number;
total_matches: number;
knowledge_base_ids?: string[];
limit?: number;
max_results: number;
}
+8 -1
View File
@@ -150,8 +150,9 @@
<div class="feature-tags">
<span class="tag">{{ $t('platform.rag') }}</span>
<span class="tag">{{ $t('platform.agent') }}</span>
<span class="tag">{{ $t('platform.wiki') }}</span>
<span class="tag">{{ $t('platform.hybridSearch') }}</span>
<span class="tag">{{ $t('platform.localDeploy') }}</span>
</div>
<!-- Swiper Carousel -->
@@ -350,6 +351,7 @@ import { useI18n } from 'vue-i18n'
// Import screenshot images
import screenshot1 from '@/assets/img/screenshot-1.svg'
import screenshot2 from '@/assets/img/screenshot-2.svg'
import screenshot3 from '@/assets/img/screenshot-3.svg'
import screenshot4 from '@/assets/img/screenshot-4.svg'
const router = useRouter()
@@ -373,6 +375,11 @@ const slides = [
title: t('platform.carousel.hybridSearchTitle'),
description: t('platform.carousel.hybridSearchDesc')
},
{
image: screenshot3,
title: t('platform.carousel.wikiTitle'),
description: t('platform.carousel.wikiDesc')
},
{
image: screenshot1,
title: t('platform.carousel.smartDocRetrievalTitle'),
@@ -2120,19 +2120,17 @@ const getResultsCount = (toolData: any): number => {
const getGrepResultsSummary = (toolData: any): string => {
if (!toolData) return '';
const totalMatches = toolData.total_matches || 0;
const resultCount = toolData.result_count || 0;
if (totalMatches === 0) {
const totalChunks = toolData.total_matches || 0;
const docCount = toolData.result_count || 0;
if (totalChunks === 0) {
return t('agentStream.search.noResults');
}
let summary = t('agentStream.search.foundMatches', { count: `<strong>${totalMatches}</strong>` });
if (totalMatches > resultCount) {
summary += t('agentStream.search.showingCount', { count: `<strong>${resultCount}</strong>` });
}
return summary;
return t('agentStream.search.grepSummary', {
chunks: `<strong>${totalChunks}</strong>`,
docs: `<strong>${docCount}</strong>`,
});
};
// Extract and format query parameters from args
@@ -1,20 +1,28 @@
<template>
<div class="popup-content">
<div class="popup-content-wrapper">
<div v-if="content" class="full-content" :class="{ 'html-content': isHtml }">
<div v-if="isHtml" v-html="processedContent"></div>
<template v-else>{{ content }}</template>
</div>
<!-- Pre-rendered HTML (already sanitized upstream) -->
<div v-if="isHtml" class="full-content html-content" v-html="processedContent"></div>
<!-- Merged chunks from the same document -->
<template v-else-if="blocks.length > 1">
<div v-for="(block, idx) in blocks" :key="block.chunk_id || idx" class="chunk-block">
<div class="chunk-block__label">{{ $t('chat.chunkOrdinal', { index: idx + 1 }) }}</div>
<div class="full-content" v-html="block.html"></div>
</div>
</template>
<!-- Single chunk -->
<div v-else-if="blocks.length === 1" class="full-content" v-html="blocks[0].html"></div>
</div>
<div v-if="hasInfo" class="info-section">
<div v-if="chunkId" class="info-field">
<span class="field-label">{{ $t('chat.chunkIdLabel') }}</span>
<span class="field-value"><code>{{ chunkId }}</code></span>
</div>
<div v-if="knowledgeId" class="info-field">
<span class="field-label">{{ $t('chat.documentIdLabel') }}</span>
<span class="field-value"><code>{{ knowledgeId }}</code></span>
</div>
<div v-if="hasInfo" class="popup-footer">
<span v-if="chunkId" class="popup-footer__item" :title="chunkId">
<span class="popup-footer__key">{{ $t('chat.chunkIdLabel') }}</span>{{ chunkId }}
</span>
<span v-if="knowledgeId" class="popup-footer__item" :title="knowledgeId">
<span class="popup-footer__key">{{ $t('chat.documentIdLabel') }}</span>{{ knowledgeId }}
</span>
</div>
</div>
</template>
@@ -22,27 +30,51 @@
<script setup lang="ts">
import { computed } from 'vue';
import { sanitizeHTML } from '@/utils/security';
import { highlightText, highlightRegex } from '@/components/GlobalCommandPalette/useHighlight';
import { cleanContent } from './contentClean';
interface ChunkContent {
content: string;
chunk_id?: string;
knowledge_id?: string;
}
interface Props {
content?: string;
chunks?: ChunkContent[];
chunkId?: string;
knowledgeId?: string;
isHtml?: boolean; // 是否以 HTML 格式显示内容
highlight?: string;
// When true, `highlight` is treated as a regex (e.g. grep's "a|b|c"),
// otherwise as whitespace-separated literal terms.
regex?: boolean;
isHtml?: boolean;
}
const props = defineProps<Props>();
const hasInfo = computed(() => {
return !!(props.chunkId || props.knowledgeId);
});
const hasInfo = computed(() => !!(props.chunkId || props.knowledgeId));
// 处理 HTML 内容
const processedContent = computed(() => {
if (!props.content) return '';
if (props.isHtml) {
return sanitizeHTML(props.content);
}
return props.content;
return props.isHtml ? sanitizeHTML(props.content) : props.content;
});
const renderBlock = (raw: string): string => {
const cleaned = cleanContent(raw);
const pattern = props.highlight ?? '';
return props.regex ? highlightRegex(cleaned, pattern) : highlightText(cleaned, pattern);
};
const blocks = computed(() => {
const source: ChunkContent[] = props.chunks?.length
? props.chunks
: props.content
? [{ content: props.content, chunk_id: props.chunkId, knowledge_id: props.knowledgeId }]
: [];
return source
.map((c) => ({ chunk_id: c.chunk_id, html: renderBlock(c.content) }))
.filter((b) => b.html.trim() !== '');
});
</script>
@@ -50,75 +82,86 @@ const processedContent = computed(() => {
.popup-content {
display: flex;
flex-direction: column;
max-height: 400px;
max-height: 420px;
max-width: 500px;
border: 1px solid var(--td-brand-color);
border-radius: 4px;
border: 1px solid var(--td-component-stroke);
border-radius: 8px;
background: var(--td-bg-color-container);
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
word-wrap: break-word;
word-break: break-word;
overflow: hidden;
.popup-content-wrapper {
flex: 1;
overflow-y: auto;
overflow-x: hidden;
padding: 12px;
padding: 14px;
min-height: 0;
}
.full-content {
font-size: 13px;
color: var(--td-text-color-primary);
line-height: 1.8;
line-height: 1.7;
white-space: pre-wrap;
word-break: break-word;
&.html-content {
white-space: normal;
:deep(p) {
margin: 8px 0;
line-height: 1.8;
}
:deep(br) {
line-height: 1.8;
line-height: 1.7;
}
}
}
.info-section {
flex-shrink: 0;
padding: 8px 12px;
border-top: 1px solid var(--td-component-stroke);
background: var(--td-bg-color-secondarycontainer);
}
.info-field {
display: flex;
gap: 8px;
margin-bottom: 4px;
font-size: 11px;
.field-label {
.chunk-block {
& + & {
margin-top: 12px;
padding-top: 12px;
border-top: 1px dashed var(--td-component-stroke);
}
.chunk-block__label {
font-size: 11px;
font-weight: 600;
color: var(--td-text-color-placeholder);
min-width: 60px;
flex-shrink: 0;
}
.field-value {
color: var(--td-text-color-secondary);
flex: 1;
code {
font-family: var(--app-font-family-mono);
font-size: 10px;
background: var(--td-bg-color-secondarycontainer);
padding: 1px 4px;
border-radius: 2px;
}
margin-bottom: 4px;
}
}
:deep(.search-highlight) {
background: rgba(255, 213, 0, 0.35);
color: inherit;
padding: 0 1px;
border-radius: 2px;
font-weight: 500;
}
.popup-footer {
flex-shrink: 0;
display: flex;
flex-direction: column;
gap: 2px;
padding: 8px 14px;
border-top: 1px solid var(--td-component-stroke);
}
.popup-footer__item {
font-family: var(--app-font-family-mono);
font-size: 10px;
color: var(--td-text-color-placeholder);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.popup-footer__key {
margin-right: 4px;
font-family: inherit;
color: var(--td-text-color-disabled);
}
}
</style>
@@ -1,14 +1,19 @@
<template>
<div class="grep-results">
<div v-if="results.length" class="results-list">
<div
<ResultRow
v-for="(result, index) in results"
:key="result.knowledge_id"
class="result-row"
>
<div class="result-row__index">#{{ index + 1 }}</div>
<div class="result-row__title">{{ result.knowledge_title || $t('knowledge.untitledDocument') }}</div>
</div>
:index="index + 1"
:title="result.knowledge_title || $t('knowledge.untitledDocument')"
:meta="formatMeta(result)"
:popup-key="result.knowledge_id || index"
:show-popup="!!cleanedSnippet(result)"
:content="result.match_snippet"
:knowledge-id="result.knowledge_id"
:highlight="searchPattern"
:regex="true"
/>
</div>
<div v-else class="empty-state">
@@ -20,23 +25,37 @@
<script setup lang="ts">
import { computed } from 'vue';
import { useI18n } from 'vue-i18n';
import type { GrepResultsData } from '@/types/tool-results';
const { t } = useI18n();
import { cleanSnippet } from './contentClean';
import ResultRow from './ResultRow.vue';
import type { GrepKnowledgeResult, GrepResultsData } from '@/types/tool-results';
const props = defineProps<{
data: GrepResultsData;
}>();
const patterns = computed(() => props.data.patterns ?? []);
const { t } = useI18n();
const results = computed(() => props.data.knowledge_results ?? []);
const searchPattern = computed(() => props.data.query ?? props.data.patterns?.[0] ?? '');
const resultCount = computed(() => props.data.result_count ?? results.value.length);
const totalMatches = computed(() => props.data.total_matches ?? results.value.length);
const maxResults = computed(() => props.data.max_results ?? results.value.length);
const hasMoreResults = computed(() => totalMatches.value > resultCount.value);
const formatMeta = (result: GrepKnowledgeResult): string => {
const parts: string[] = [];
const chunks = result.chunk_hit_count ?? 0;
if (chunks > 0) {
parts.push(t('agentStream.grepResults.chunkHits', { count: chunks }));
}
const hits = result.total_pattern_hits ?? 0;
if (hits > 0 && hits !== chunks) {
parts.push(t('agentStream.grepResults.keywordHits', { count: hits }));
}
if (result.title_match) {
parts.push(t('agentStream.grepResults.titleMatch'));
}
return parts.join(' · ');
};
// Compact view, no per-pattern stats
const cleanedSnippet = (result: GrepKnowledgeResult): string =>
cleanSnippet(result.match_snippet ?? '');
</script>
<style lang="less" scoped>
@@ -45,82 +64,15 @@ const hasMoreResults = computed(() => totalMatches.value > resultCount.value);
.grep-results {
display: flex;
flex-direction: column;
gap: 8px;
}
.summary-inline {
font-size: 12px;
color: var(--td-text-color-secondary);
display: flex;
align-items: center;
gap: 6px;
&__divider {
color: var(--td-text-color-disabled);
}
&__truncated {
color: var(--td-warning-color);
}
padding: 0 0 0 12px;
gap: 3px;
}
.results-list {
display: flex;
flex-direction: column;
gap: 4px;
padding: 10px 12px 10px 12px;
}
.result-row {
display: grid;
grid-template-columns: 40px minmax(120px, 1fr) auto;
align-items: center;
gap: 8px;
padding: 4px 10px;
border-radius: 4px;
background: var(--td-bg-color-secondarycontainer);
border: 1px solid var(--td-component-stroke);
font-size: 12px;
line-height: 1.4;
}
.result-row__index {
font-weight: 600;
color: var(--td-text-color-placeholder);
}
.result-row__title {
color: var(--td-text-color-primary);
font-weight: 500;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.result-row__meta {
display: flex;
gap: 6px;
flex-wrap: wrap;
justify-content: flex-end;
}
.meta-pill {
font-size: 11px;
color: var(--td-text-color-secondary);
background: var(--td-bg-color-container);
border: 1px solid var(--td-component-stroke);
border-radius: 999px;
padding: 2px 8px;
}
.empty-state {
padding: 20px;
text-align: center;
color: var(--td-text-color-placeholder);
font-size: 12px;
font-style: italic;
background: var(--td-bg-color-secondarycontainer);
border-radius: 6px;
border: 1px dashed var(--td-component-stroke);
gap: 3px;
max-height: 200px;
overflow-y: auto;
}
</style>
@@ -0,0 +1,137 @@
<template>
<div class="result-row" :class="{ 'result-row--has-preview': showPopup }">
<span class="result-row__index">#{{ index }}</span>
<span class="result-row__title" :title="title">{{ title }}</span>
<span v-if="meta" class="result-row__meta">{{ meta }}</span>
<t-popup
v-if="showPopup"
:overlayClassName="`tool-result-popup tool-result-popup-${popupKey}`"
placement="bottom-left"
:width="400"
:showArrow="false"
trigger="hover"
destroy-on-close
>
<template #content>
<ContentPopup
:content="content"
:chunks="chunks"
:chunk-id="chunkId"
:knowledge-id="knowledgeId"
:highlight="highlight"
:regex="regex"
/>
</template>
<span class="result-row__preview" :aria-label="$t('chat.previewContent')">
<browse-icon />
</span>
</t-popup>
</div>
</template>
<script setup lang="ts">
import { BrowseIcon } from 'tdesign-icons-vue-next';
import ContentPopup from './ContentPopup.vue';
interface ChunkContent {
content: string;
chunk_id?: string;
knowledge_id?: string;
}
withDefaults(
defineProps<{
index: number;
title: string;
meta?: string;
popupKey: string | number;
showPopup?: boolean;
content?: string;
chunks?: ChunkContent[];
chunkId?: string;
knowledgeId?: string;
highlight?: string;
regex?: boolean;
}>(),
{ showPopup: true },
);
</script>
<style lang="less" scoped>
.result-row {
display: flex;
align-items: center;
gap: 6px;
min-width: 0;
padding: 4px 8px;
border-radius: 4px;
font-size: 12px;
line-height: 1.4;
user-select: none;
&--has-preview:hover {
background: var(--td-bg-color-secondarycontainer);
.result-row__preview {
opacity: 1;
}
}
}
.result-row__preview {
flex-shrink: 0;
display: inline-flex;
align-items: center;
justify-content: center;
width: 20px;
height: 20px;
border-radius: 4px;
font-size: 14px;
color: var(--td-text-color-placeholder);
cursor: pointer;
opacity: 0.5;
transition: opacity 0.15s ease, color 0.15s ease, background 0.15s ease;
&:hover {
opacity: 1;
color: var(--td-brand-color);
background: var(--td-bg-color-container);
}
}
.result-row__index {
flex-shrink: 0;
min-width: 22px;
font-size: 11px;
font-weight: 600;
color: var(--td-text-color-placeholder);
}
.result-row__title {
flex: 1;
min-width: 0;
font-weight: 500;
color: var(--td-text-color-primary);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.result-row__meta {
flex-shrink: 0;
font-size: 11px;
font-weight: 400;
color: var(--td-text-color-placeholder);
}
</style>
<!-- Non-scoped: the popup overlay is teleported to <body>, so style it globally. -->
<style lang="less">
.tool-result-popup .t-popup__content {
padding: 0;
background: transparent;
border: none;
box-shadow: none;
}
</style>
@@ -1,35 +1,19 @@
<template>
<div class="search-results">
<!-- Search Results List -->
<div v-if="results && results.length > 0" class="results-list">
<div
v-for="result in results"
:key="result.chunk_id"
class="result-item"
>
<t-popup
:overlayClassName="`result-popup-${result.chunk_id}`"
placement="bottom-left"
width="400"
:showArrow="false"
trigger="click"
destroy-on-close
>
<template #content>
<ContentPopup
:content="result.content"
:chunk-id="result.chunk_id"
:knowledge-id="result.knowledge_id"
/>
</template>
<div class="result-header">
<div class="result-title">
<span class="result-index">#{{ result.result_index }}</span>
<span class="knowledge-title">{{ result.knowledge_title }}</span>
</div>
</div>
</t-popup>
</div>
<!-- Search Results List (chunks merged per document) -->
<div v-if="groupedResults.length > 0" class="results-list">
<ResultRow
v-for="(group, idx) in groupedResults"
:key="group.knowledge_id"
:index="idx + 1"
:title="group.knowledge_title"
:meta="$t('agentStream.grepResults.chunkHits', { count: group.chunks.length })"
:popup-key="group.knowledge_id"
:chunks="group.chunks"
:chunk-id="group.chunks.length === 1 ? group.chunks[0].chunk_id : undefined"
:knowledge-id="group.knowledge_id"
:highlight="highlightQuery"
/>
</div>
<!-- Empty State -->
@@ -40,10 +24,10 @@
</template>
<script setup lang="ts">
import { ref, defineProps, computed } from 'vue';
import { computed } from 'vue';
import type { SearchResultsData, SearchResultItem, RelevanceLevel } from '@/types/tool-results';
import { getMatchTypeIcon } from '@/utils/tool-icons';
import ContentPopup from './ContentPopup.vue';
import ResultRow from './ResultRow.vue';
import { useI18n } from 'vue-i18n';
const props = defineProps<{
@@ -56,6 +40,36 @@ const { t } = useI18n();
const results = computed(() => props.data.results || []);
const kbCounts = computed(() => props.data.kb_counts);
interface GroupedResult {
knowledge_id: string;
knowledge_title: string;
chunks: { content: string; chunk_id: string; knowledge_id: string }[];
}
// Hybrid retrieval can return several chunks from the same document; collapse
// them into one row so the same file is not listed repeatedly.
const groupedResults = computed<GroupedResult[]>(() => {
const map = new Map<string, GroupedResult>();
const order: string[] = [];
for (const r of results.value) {
const key = r.knowledge_id || r.chunk_id;
if (!map.has(key)) {
map.set(key, {
knowledge_id: r.knowledge_id,
knowledge_title: r.knowledge_title,
chunks: [],
});
order.push(key);
}
map.get(key)!.chunks.push({
content: r.content,
chunk_id: r.chunk_id,
knowledge_id: r.knowledge_id,
});
}
return order.map((k) => map.get(k)!);
});
// Parse arguments if it's a string
const parsedArguments = computed(() => {
const args = props.arguments;
@@ -79,6 +93,21 @@ const parsedArguments = computed(() => {
return null;
});
// Highlight terms for the content popup: the natural-language query plus any
// explicit sub-queries passed to the search tool.
const highlightQuery = computed(() => {
const parts: string[] = [];
const args = parsedArguments.value;
if (args && typeof args === 'object') {
if (typeof args.query === 'string') parts.push(args.query);
if (Array.isArray(args.queries)) {
parts.push(...args.queries.filter((q: unknown): q is string => typeof q === 'string'));
}
}
if (parts.length === 0 && props.data.query) parts.push(props.data.query);
return parts.join(' ');
});
// Check if there are search parameters to display (excluding query parameters which are in title)
const hasSearchParams = computed(() => {
const args = parsedArguments.value;
@@ -131,117 +160,8 @@ const getRelevanceLabel = (level: RelevanceLevel): string => {
display: flex;
flex-direction: column;
gap: 3px;
}
.result-item {
background: transparent;
border: none;
border-radius: 0;
overflow: visible;
}
.result-header {
padding: 2px 0;
cursor: pointer;
user-select: none;
display: flex;
align-items: center;
justify-content: space-between;
gap: 6px;
transition: color 0.15s ease;
&:hover {
color: var(--td-brand-color);
}
}
.result-title {
display: flex;
align-items: center;
gap: 6px;
flex: 1;
min-width: 0;
font-size: 12px;
line-height: 1.4;
}
.result-index {
font-size: 11px;
color: var(--td-text-color-placeholder);
font-weight: 600;
flex-shrink: 0;
}
.relevance-badge {
flex-shrink: 0;
font-size: 10px;
padding: 2px 5px;
border-radius: 3px;
}
.knowledge-title {
font-size: 12px;
color: var(--td-text-color-primary);
flex: 1;
font-weight: 500;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
min-width: 0;
}
// Popup overlay styles
:deep([class*="result-popup-"]) {
.t-popup__content {
max-height: 400px;
max-width: 500px;
overflow-y: auto;
overflow-x: hidden;
padding: 0;
border-radius: 6px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
word-wrap: break-word;
word-break: break-word;
}
}
.info-section {
margin-top: 6px;
&:first-child {
margin-top: 0;
}
}
.full-content {
font-size: 12px;
color: var(--td-text-color-primary);
line-height: 1.6;
padding: 10px;
background: var(--td-bg-color-container);
border-radius: 4px;
border: 1px solid var(--td-component-stroke);
white-space: pre-wrap;
word-break: break-word;
margin-bottom: 6px;
}
.info-field {
font-size: 11px;
margin-bottom: 4px;
.field-label {
min-width: 60px;
font-size: 10px;
}
}
code {
font-family: var(--app-font-family-mono);
font-size: 10px;
background: var(--td-bg-color-secondarycontainer);
padding: 1px 4px;
border-radius: 2px;
max-height: 200px;
overflow-y: auto;
}
</style>
@@ -0,0 +1,38 @@
/**
* Strip ingestion noise from chunk text before display: YAML frontmatter,
* markdown footnote reference markers (e.g. `^(\[4\])`, `[^4]`, `[4]`) and
* stray backslash escapes. Keeps human-readable prose intact.
*/
function stripNoise(text: string): string {
let s = text || '';
// Leading YAML frontmatter block: --- ... ---
s = s.replace(/^\uFEFF?\s*---[\s\S]*?\n---\s*/, '');
// Inline frontmatter leftovers dragged into a single-line snippet
s = s.replace(
/-{2,}\s*((?:title|author|url|date|tags?|description)\s*:[\s\S]*?)-{2,}/gi,
' ',
);
// Footnote / citation markers: ^(\[4\]) / ^[4] / [^4] / [4]
s = s.replace(/\^?\(?\s*\\?\[\s*\^?\d+\s*\\?\]\s*\)?/g, '');
// Unescape common markdown backslash escapes
s = s.replace(/\\([\\[\]()*_#`~\-+.!>])/g, '$1');
return s;
}
/** Clean multi-line content for full display, preserving paragraph breaks. */
export function cleanContent(text: string): string {
return stripNoise(text)
.replace(/[ \t]+\n/g, '\n')
.replace(/\n{3,}/g, '\n\n')
.trim();
}
/** Clean a snippet down to a single, whitespace-collapsed line. */
export function cleanSnippet(text: string): string {
return stripNoise(text).replace(/\s+/g, ' ').trim();
}
+6
View File
@@ -435,6 +435,7 @@ type knowledgeAggregation struct {
PatternCounts map[string]int `json:"pattern_counts"`
TotalPatternHits int `json:"total_pattern_hits"`
DistinctPatterns int `json:"distinct_patterns"`
MatchSnippet string `json:"match_snippet,omitempty"`
}
func (t *GrepChunksTool) aggregateByKnowledge(
@@ -483,6 +484,11 @@ func (t *GrepChunksTool) aggregateByKnowledge(
if chunk.TitleMatch {
entry.TitleMatch = true
}
if entry.MatchSnippet == "" {
if snippet := extractSnippetRegex(chunk.Content, compiled); snippet != "" {
entry.MatchSnippet = snippet
}
}
occurrences := countRegexHits(chunk.Content, compiled, queryKeys)
for _, q := range queryKeys {