From 09c2a03cefa687832257d3b816da50db3cfcc0f2 Mon Sep 17 00:00:00 2001
From: ai_xiaopei <xiaopei@aisim.cn>
Date: Sat, 25 Jul 2026 23:48:11 +0800
Subject: [PATCH] feat: 实现输出格式化
---
internal/vault/sections.go | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 53 insertions(+), 0 deletions(-)
diff --git a/internal/vault/sections.go b/internal/vault/sections.go
new file mode 100644
index 0000000..e2a8a35
--- /dev/null
+++ b/internal/vault/sections.go
@@ -0,0 +1,53 @@
+package vault
+
+// SectionConfig 定义板块配置
+type SectionConfig struct {
+ Name string
+ SubPaths map[string]string // 子板块名 -> 路径
+}
+
+// RootSections 板块配置(对应 Python 版 ROOT_SECTIONS)
+var RootSections = map[string]*SectionConfig{
+ "实体": {Name: "实体", SubPaths: map[string]string{"_root": "实体"}},
+ "知识": {Name: "知识", SubPaths: map[string]string{
+ "平台知识": "知识/平台知识",
+ "典型案例": "知识/典型案例",
+ "行业知识": "知识/行业知识",
+ "疑难问题": "知识/疑难问题",
+ "FAQ": "知识/FAQ",
+ "技术运维": "知识/技术运维",
+ }},
+ "笔记": {Name: "笔记", SubPaths: map[string]string{"_root": "笔记"}},
+ "FAQ": {Name: "FAQ", SubPaths: map[string]string{
+ "充装类": "FAQ/充装类",
+ "配送类": "FAQ/配送类",
+ "平台操作类": "FAQ/平台操作类",
+ "数据同步类": "FAQ/数据同步类",
+ "硬件类": "FAQ/硬件类",
+ "网络类": "FAQ/网络类",
+ "综合类": "FAQ/综合类",
+ }},
+ "案例": {Name: "案例", SubPaths: map[string]string{"_root": "案例"}},
+ "文档": {Name: "文档", SubPaths: map[string]string{"_root": "文档"}},
+ "行业": {Name: "行业", SubPaths: map[string]string{"_root": "行业"}},
+ "内部工具": {Name: "内部工具", SubPaths: map[string]string{"_root": "内部工具"}},
+ "设备": {Name: "设备", SubPaths: map[string]string{"_root": "设备"}},
+}
+
+// GetSection 根据文件路径判断所属板块
+func GetSection(relPath string) string {
+ for section, cfg := range RootSections {
+ for _, subPath := range cfg.SubPaths {
+ if subPath == "." || subPath == section {
+ continue
+ }
+ if len(relPath) >= len(subPath) && relPath[:len(subPath)] == subPath {
+ return section
+ }
+ }
+ if len(relPath) >= len(section) && relPath[:len(section)] == section {
+ return section
+ }
+ }
+ return "其他"
+}
--
Gitblit v1.9.1