From 155782bd7ba86d8a0257cbccd2bf76c2ad03458d Mon Sep 17 00:00:00 2001 From: Max Date: Fri, 12 Dec 2025 10:34:57 +0800 Subject: [PATCH] Refactor DESIGN.md to enhance data flow visualization and clarity - Replaced the previous text-based data flow representation with a flowchart using Mermaid syntax for improved readability and understanding. - Streamlined the depiction of data sources and their relationships, clarifying the flow from content module to LLM input. - Updated the documentation to ensure consistency with the new visual format, aiding in the comprehension of the search module's architecture. --- agent/search/DESIGN.md | 48 ++++++++++++++---------------------------- 1 file changed, 16 insertions(+), 32 deletions(-) diff --git a/agent/search/DESIGN.md b/agent/search/DESIGN.md index a218563a..0019a1b9 100644 --- a/agent/search/DESIGN.md +++ b/agent/search/DESIGN.md @@ -1193,38 +1193,22 @@ type Reference struct { **Data Flow:** -``` -┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ -│ Content Module │ │ Hook Search │ │ Auto Search │ -│ (db:xxx kb:xxx) │ │ ctx.search.*() │ │ (assistant cfg) │ -└────────┬────────┘ └────────┬────────┘ └────────┬────────┘ - │ │ │ - │ source="user" │ source="hook" │ source="auto" - │ weight=1.0 │ weight=0.8 │ weight=0.6 - │ │ │ - └──────────────────────┼──────────────────────┘ - │ - ▼ - ┌───────────────────────┐ - │ []Reference │ - │ (Unified Structure) │ - └───────────┬───────────┘ - │ - ▼ - ┌───────────────────────┐ - │ Merge & Deduplicate │ - │ Rerank by score*wt │ - └───────────┬───────────┘ - │ - ▼ - ┌─────────────────────────────┐ - │ Build XML │ - └───────────┬─────────────────┘ - │ - ▼ - ┌───────────────────────┐ - │ LLM Input │ - └───────────────────────┘ +```mermaid +flowchart TD + subgraph Sources ["Data Sources"] + CM["Content Module
(db:xxx kb:xxx)"] + HS["Hook Search
ctx.search.*()"] + AS["Auto Search
(assistant config)"] + end + + CM -->|"source=user
weight=1.0"| REF + HS -->|"source=hook
weight=0.8"| REF + AS -->|"source=auto
weight=0.6"| REF + + REF["[]Reference
(Unified Structure)"] + REF --> MERGE["Merge & Deduplicate
Rerank by score × weight"] + MERGE --> BUILD["Build <references> XML"] + BUILD --> LLM["LLM Input"] ``` **LLM References Format:**