hookehuyr

docs(parse): 清理审核文档并更新 parse-docs 脚本

主要变更:
- 清理 CHANGELOG.md (移除历史记录,保持精简)
- 移除旧的 pending 审核文件
- 删除 scripts/README.md
- 更新 parse-docs.js 脚本
- 更新 README.md 和 to-parse/README.md

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
...@@ -430,6 +430,8 @@ export default { ...@@ -430,6 +430,8 @@ export default {
430 5. 认证失败会自动跳转到 `/pages/login/index` 430 5. 认证失败会自动跳转到 `/pages/login/index`
431 6. **所有函数必须有 JSDoc 注释** - 详见 `~/.claude/rules/code-commenting.md` 431 6. **所有函数必须有 JSDoc 注释** - 详见 `~/.claude/rules/code-commenting.md`
432 7. 业务路由以 `src/app.config.js` 为准,计划类文档仅保留历史记录 432 7. 业务路由以 `src/app.config.js` 为准,计划类文档仅保留历史记录
433 +8. 文档解析成功后原始文档会自动归档到 `docs/to-parse/archived/YYYY-MM-DD/`
434 +9. 待审核文件按原始文档名分目录存放于 `docs/parse-audit/pending/<原始文档名>/`
433 435
434 ## ✅ 优化建议 436 ## ✅ 优化建议
435 437
......
This diff is collapsed. Click to expand it.
1 -# 产品配置审核 - 计划书模版2.docx
2 -
3 -**解析时间**: 2026/2/14 23:58:54
4 -**原始文件**: 计划书模版2.docx
5 -**数据来源**: docs/to-parse/计划书模版2.docx
6 -
7 ----
8 -
9 -## 📋 产品基本信息
10 -
11 -| 字段 | 提取值 | 需要确认 |
12 -|------|--------|---------|
13 -| 产品名称 | 计划书模版2 | ✅ 请核对产品名称 |
14 -| 产品类型 | savings | ✅ 请确认产品类型 |
15 -| 币种 | USD | ✅ 请确认币种 |
16 -| form_sn | `savings-2-55bcffc2` | ✅ 请确认 form_sn 唯一性 |
17 -| 缴费年期 | ["整付"] | ✅ 请确认缴费年期选项 |
18 -| 年龄范围 | 0-75岁 | ✅ 请确认年龄范围 |
19 -| 保险期间 | 终身 | ✅ 请确认保险期间 |
20 -
21 -
22 -### 💰 储蓄类产品特有字段
23 -
24 -| 字段 | 提取值 | 需要确认 |
25 -|------|--------|---------|
26 -| 提取方式 | ["指定提取金额","最高固定提取金额"] | ✅ 请确认提取方式 |
27 -| 提取期 | ["1年","3年","5年","10年"] | ✅ 请确认提取期选项 |
28 -
29 -
30 ----
31 -
32 -## 🤖 智能字段提取报告
33 -
34 -### 匹配统计
35 -
36 -- ✅ 成功匹配: 3 字段
37 -- ⚠️ 使用默认值: 4 字段
38 -- ❌ 未匹配(需人工补充): 1 字段
39 -
40 -### ✅ 已成功匹配的字段
41 -
42 -- product_type
43 -- payment_periods
44 -- withdrawal_modes
45 -
46 -
47 -### ⚠️ 使用默认值的字段
48 -
49 -- **currency**: 未找到字段 "currency",使用默认值: "USD"
50 -- **age_range**: 未找到字段 "age_range",使用默认值: {"min":0,"max":75}
51 -- **insurance_period**: 未找到字段 "insurance_period",使用默认值: "终身"
52 -- **product_name**: 未找到产品名称,使用文件名: "计划书模版2"
53 -
54 -
55 -
56 -### ❌ 未匹配字段(需要人工补充)
57 -
58 -
59 -#### product_name
60 -
61 -- **原因**: 未找到匹配内容
62 -- **建议值**:
63 - - 从文档标题提取
64 - - 从第一行提取
65 - - 手动输入产品全称
66 -
67 -
68 -
69 ----
70 -
71 -## 🧾 配置预览
72 -
73 -```javascript
74 -{
75 - "product_name": "计划书模版2",
76 - "product_type": "savings",
77 - "currency": "USD",
78 - "form_sn": "savings-2-55bcffc2",
79 - "payment_periods": [
80 - "整付"
81 - ],
82 - "age_range": {
83 - "min": 0,
84 - "max": 75
85 - },
86 - "insurance_period": "终身",
87 - "is_savings": true,
88 - "withdrawal_modes": [
89 - "指定提取金额",
90 - "最高固定提取金额"
91 - ],
92 - "withdrawal_periods": [
93 - "1年",
94 - "3年",
95 - "5年",
96 - "10年"
97 - ]
98 -}
99 -```
100 -
101 ----
102 -
103 -## 📝 表单字段 (form_schema)
104 -
105 -```javascript
106 -{
107 - "base_fields": [],
108 - "withdrawal_fields": [],
109 - "reset_map": {}
110 -}
111 -```
112 -
113 ----
114 -
115 -## 🔄 提交字段映射 (submit_mapping)
116 -
117 -```javascript
118 -{}
119 -```
120 -
121 ----
122 -
123 -## 🧩 生成配置片段
124 -
125 -```javascript
126 -/**
127 - * 计划书模版2
128 - * @added 2026-02-14T15:58:54.707Z
129 - * @source docs/to-parse/计划书模版2.docx
130 - */
131 - 'savings-2-55bcffc2': {
132 - name: '计划书模版2',
133 - component: 'SavingsTemplate',
134 - category: 'savings',
135 - config: {
136 - currency: 'USD',
137 - payment_periods: ["整付"],
138 - age_range: { min: 0, max: 75 },
139 - insurance_period: '终身',
140 - withdrawal_plan: {
141 - enabled: true,
142 - currencies: ['HKD', 'USD', 'CNY'],
143 - default_currency: 'USD',
144 - withdrawal_modes: ["指定提取金额","最高固定提取金额"],
145 - withdrawal_periods: ["1年","3年","5年","10年"]
146 - },
147 - form_schema: savingsFormSchema,
148 - submit_mapping: savingsSubmitMapping
149 - }
150 - }
151 -```
152 -
153 ----
154 -
155 -## ✅ 审核检查清单
156 -
157 -### 基础信息
158 -- [ ] 产品名称正确
159 -- [ ] 产品类型正确(savings/critical-illness/life-insurance)
160 -- [ ] 币种正确(USD/CNY/HKD/EUR)
161 -- [ ] form_sn 唯一且符合命名规范
162 -
163 -### 缴费与年龄
164 -- [ ] 缴费年期选项完整且正确
165 -- [ ] 年龄范围合理
166 -- [ ] 保险期间正确
167 -
168 -### 储蓄类特有(如适用)
169 -- [ ] 提取方式正确
170 -- [ ] 提取期选项完整
171 -- [ ] 表单字段定义完整
172 -- [ ] 提交字段映射正确
173 -
174 ----
175 -
176 -## 📋 审核后操作
177 -
178 -### 确认无误
179 -```bash
180 -# 1. 移动到 approved 目录
181 -mv docs/parse-audit/pending/2026-02-14-计划书模版2.md \
182 - docs/parse-audit/approved/
183 -
184 -# 2. 合并到正式配置
185 -# 手动复制或使用工具合并到 src/config/plan-templates.js
186 -
187 -# 3. 删除待审核文件(可选)
188 -rm docs/parse-audit/pending/2026-02-14-计划书模版2.md
189 -```
190 -
191 -### 需要修改
192 -1. 编辑本文件修正内容
193 -2. 重新提交审核
194 -
195 -### 放弃本次解析
196 -```bash
197 -rm docs/parse-audit/pending/2026-02-14-计划书模版2.md
198 -```
199 -
200 ----
201 -
202 -## 审核状态
203 -
204 -- [ ] 待审核
205 -- [ ] 已通过
206 -- [ ] 已拒绝
207 -
208 -## 审核意见
209 -
210 -```text
211 -```
1 -# 产品配置审核 - 计划书模版3.docx
2 -
3 -**解析时间**: 2026/2/14 23:58:54
4 -**原始文件**: 计划书模版3.docx
5 -**数据来源**: docs/to-parse/计划书模版3.docx
6 -
7 ----
8 -
9 -## 📋 产品基本信息
10 -
11 -| 字段 | 提取值 | 需要确认 |
12 -| -------- | ---------------------- | ------------------------ |
13 -| 产品名称 | 计划书模版3 | ✅ 请核对产品名称 |
14 -| 产品类型 | savings | ✅ 请确认产品类型 |
15 -| 币种 | USD | ✅ 请确认币种 |
16 -| form_sn | `savings-3-8f4f27ad` | ✅ 请确认 form_sn 唯一性 |
17 -| 缴费年期 | ["5年"] | ✅ 请确认缴费年期选项 |
18 -| 年龄范围 | 0-75岁 | ✅ 请确认年龄范围 |
19 -| 保险期间 | 终身 | ✅ 请确认保险期间 |
20 -
21 -### 💰 储蓄类产品特有字段
22 -
23 -| 字段 | 提取值 | 需要确认 |
24 -| -------- | ------------------------------- | ------------------- |
25 -| 提取方式 | ["年龄指定金额","最高固定金额"] | ✅ 请确认提取方式 |
26 -| 提取期 | ["1年","3年","5年","10年"] | ✅ 请确认提取期选项 |
27 -
28 ----
29 -
30 -## 🤖 智能字段提取报告
31 -
32 -### 匹配统计
33 -
34 -- ✅ 成功匹配: 1 字段
35 -- ⚠️ 使用默认值: 5 字段
36 -- ❌ 未匹配(需人工补充): 1 字段
37 -
38 -### ✅ 已成功匹配的字段
39 -
40 -- payment_periods
41 -
42 -### ⚠️ 使用默认值的字段
43 -
44 -- **product_type**: 未找到字段 "product_type",使用默认值: "savings"
45 -- **currency**: 未找到字段 "currency",使用默认值: "USD"
46 -- **age_range**: 未找到字段 "age_range",使用默认值: {"min":0,"max":75}
47 -- **insurance_period**: 未找到字段 "insurance_period",使用默认值: "终身"
48 -- **product_name**: 未找到产品名称,使用文件名: "计划书模版3"
49 -
50 -### ❌ 未匹配字段(需要人工补充)
51 -
52 -#### product_name
53 -
54 -- **原因**: 未找到匹配内容
55 -- **建议值**:
56 - - 从文档标题提取
57 - - 从第一行提取
58 - - 手动输入产品全称
59 -
60 ----
61 -
62 -## 🧾 配置预览
63 -
64 -```javascript
65 -{
66 - "product_name": "计划书模版3",
67 - "product_type": "savings",
68 - "currency": "USD",
69 - "form_sn": "savings-3-8f4f27ad",
70 - "payment_periods": [
71 - "5年"
72 - ],
73 - "age_range": {
74 - "min": 0,
75 - "max": 75
76 - },
77 - "insurance_period": "终身",
78 - "is_savings": true,
79 - "withdrawal_modes": [
80 - "年龄指定金额",
81 - "最高固定金额"
82 - ],
83 - "withdrawal_periods": [
84 - "1年",
85 - "3年",
86 - "5年",
87 - "10年"
88 - ]
89 -}
90 -```
91 -
92 ----
93 -
94 -## 📝 表单字段 (form_schema)
95 -
96 -```javascript
97 -{
98 - "base_fields": [],
99 - "withdrawal_fields": [],
100 - "reset_map": {}
101 -}
102 -```
103 -
104 ----
105 -
106 -## 🔄 提交字段映射 (submit_mapping)
107 -
108 -```javascript
109 -{}
110 -```
111 -
112 ----
113 -
114 -## 🧩 生成配置片段
115 -
116 -```javascript
117 -/**
118 - * 计划书模版3
119 - * @added 2026-02-14T15:58:54.729Z
120 - * @source docs/to-parse/计划书模版3.docx
121 - */
122 - 'savings-3-8f4f27ad': {
123 - name: '计划书模版3',
124 - component: 'SavingsTemplate',
125 - category: 'savings',
126 - config: {
127 - currency: 'USD',
128 - payment_periods: ["5年"],
129 - age_range: { min: 0, max: 75 },
130 - insurance_period: '终身',
131 - withdrawal_plan: {
132 - enabled: true,
133 - currencies: ['HKD', 'USD', 'CNY'],
134 - default_currency: 'USD',
135 - withdrawal_modes: ["年龄指定金额","最高固定金额"],
136 - withdrawal_periods: ["1年","3年","5年","10年"]
137 - },
138 - form_schema: savingsFormSchema,
139 - submit_mapping: savingsSubmitMapping
140 - }
141 - }
142 -```
143 -
144 ----
145 -
146 -## ✅ 审核检查清单
147 -
148 -### 基础信息
149 -
150 -- [ ] 产品名称正确
151 -- [ ] 产品类型正确(savings/critical-illness/life-insurance)
152 -- [ ] 币种正确(USD/CNY/HKD/EUR)
153 -- [ ] form_sn 唯一且符合命名规范
154 -
155 -### 缴费与年龄
156 -
157 -- [ ] 缴费年期选项完整且正确
158 -- [ ] 年龄范围合理
159 -- [ ] 保险期间正确
160 -
161 -### 储蓄类特有(如适用)
162 -
163 -- [ ] 提取方式正确
164 -- [ ] 提取期选项完整
165 -- [ ] 表单字段定义完整
166 -- [ ] 提交字段映射正确
167 -
168 ----
169 -
170 -## 📋 审核后操作
171 -
172 -### 确认无误
173 -
174 -```bash
175 -# 1. 移动到 approved 目录
176 -mv docs/parse-audit/pending/2026-02-14-计划书模版3.md \
177 - docs/parse-audit/approved/
178 -
179 -# 2. 合并到正式配置
180 -# 手动复制或使用工具合并到 src/config/plan-templates.js
181 -
182 -# 3. 删除待审核文件(可选)
183 -rm docs/parse-audit/pending/2026-02-14-计划书模版3.md
184 -```
185 -
186 -### 需要修改
187 -
188 -1. 编辑本文件修正内容
189 -2. 重新提交审核
190 -
191 -### 放弃本次解析
192 -
193 -```bash
194 -rm docs/parse-audit/pending/2026-02-14-计划书模版3.md
195 -```
196 -
197 ----
198 -
199 -## 审核状态
200 -
201 -- [ ] 待审核
202 -- [ ] 已通过
203 -- [ ] 已拒绝
204 -
205 -## 审核意见
206 -
207 -```text
208 -
209 -```
1 # 产品配置审核 - 计划书模版2.docx 1 # 产品配置审核 - 计划书模版2.docx
2 2
3 -**解析时间**: 2026/2/15 00:41:27 3 +**解析时间**: 2026/2/15 10:20:30
4 **原始文件**: 计划书模版2.docx 4 **原始文件**: 计划书模版2.docx
5 **数据来源**: docs/to-parse/计划书模版2.docx 5 **数据来源**: docs/to-parse/计划书模版2.docx
6 6
...@@ -116,7 +116,7 @@ ...@@ -116,7 +116,7 @@
116 ```javascript 116 ```javascript
117 /** 117 /**
118 * 宏摯傳承保障計劃 - 性別, 年齡, 出生年月日 118 * 宏摯傳承保障計劃 - 性別, 年齡, 出生年月日
119 - * @added 2026-02-14T16:41:27.878Z 119 + * @added 2026-02-15T02:20:30.982Z
120 * @source docs/to-parse/计划书模版2.docx 120 * @source docs/to-parse/计划书模版2.docx
121 */ 121 */
122 'savings-product-ef3dd50b': { 122 'savings-product-ef3dd50b': {
...@@ -169,14 +169,14 @@ ...@@ -169,14 +169,14 @@
169 ### 确认无误 169 ### 确认无误
170 ```bash 170 ```bash
171 # 1. 移动到 approved 目录 171 # 1. 移动到 approved 目录
172 -mv docs/parse-audit/pending/2026-02-14-计划书模版2-宏摯傳承保障計劃-性別-年齡-出生年月日.md \ 172 +mv docs/parse-audit/pending/计划书模版2/2026-02-15-计划书模版2-宏摯傳承保障計劃-性別-年齡-出生年月日.md \
173 docs/parse-audit/approved/ 173 docs/parse-audit/approved/
174 174
175 # 2. 合并到正式配置 175 # 2. 合并到正式配置
176 # 手动复制或使用工具合并到 src/config/plan-templates.js 176 # 手动复制或使用工具合并到 src/config/plan-templates.js
177 177
178 # 3. 删除待审核文件(可选) 178 # 3. 删除待审核文件(可选)
179 -rm docs/parse-audit/pending/2026-02-14-计划书模版2-宏摯傳承保障計劃-性別-年齡-出生年月日.md 179 +rm docs/parse-audit/pending/计划书模版2/2026-02-15-计划书模版2-宏摯傳承保障計劃-性別-年齡-出生年月日.md
180 ``` 180 ```
181 181
182 ### 需要修改 182 ### 需要修改
...@@ -185,7 +185,7 @@ rm docs/parse-audit/pending/2026-02-14-计划书模版2-宏摯傳承保障計劃 ...@@ -185,7 +185,7 @@ rm docs/parse-audit/pending/2026-02-14-计划书模版2-宏摯傳承保障計劃
185 185
186 ### 放弃本次解析 186 ### 放弃本次解析
187 ```bash 187 ```bash
188 -rm docs/parse-audit/pending/2026-02-14-计划书模版2-宏摯傳承保障計劃-性別-年齡-出生年月日.md 188 +rm docs/parse-audit/pending/计划书模版2/2026-02-15-计划书模版2-宏摯傳承保障計劃-性別-年齡-出生年月日.md
189 ``` 189 ```
190 190
191 --- 191 ---
......
1 # 产品配置审核 - 计划书模版2.docx 1 # 产品配置审核 - 计划书模版2.docx
2 2
3 -**解析时间**: 2026/2/15 00:41:27 3 +**解析时间**: 2026/2/15 10:20:30
4 **原始文件**: 计划书模版2.docx 4 **原始文件**: 计划书模版2.docx
5 **数据来源**: docs/to-parse/计划书模版2.docx 5 **数据来源**: docs/to-parse/计划书模版2.docx
6 6
...@@ -114,7 +114,7 @@ ...@@ -114,7 +114,7 @@
114 ```javascript 114 ```javascript
115 /** 115 /**
116 * 宏摯家傳承保險計劃- 性別, 年齡, 出生年月日 116 * 宏摯家傳承保險計劃- 性別, 年齡, 出生年月日
117 - * @added 2026-02-14T16:41:27.893Z 117 + * @added 2026-02-15T02:20:30.997Z
118 * @source docs/to-parse/计划书模版2.docx 118 * @source docs/to-parse/计划书模版2.docx
119 */ 119 */
120 'savings-product-aaaa60f8': { 120 'savings-product-aaaa60f8': {
...@@ -167,14 +167,14 @@ ...@@ -167,14 +167,14 @@
167 ### 确认无误 167 ### 确认无误
168 ```bash 168 ```bash
169 # 1. 移动到 approved 目录 169 # 1. 移动到 approved 目录
170 -mv docs/parse-audit/pending/2026-02-14-计划书模版2-宏摯家傳承保險計劃-性別-年齡-出生年月日.md \ 170 +mv docs/parse-audit/pending/计划书模版2/2026-02-15-计划书模版2-宏摯家傳承保險計劃-性別-年齡-出生年月日.md \
171 docs/parse-audit/approved/ 171 docs/parse-audit/approved/
172 172
173 # 2. 合并到正式配置 173 # 2. 合并到正式配置
174 # 手动复制或使用工具合并到 src/config/plan-templates.js 174 # 手动复制或使用工具合并到 src/config/plan-templates.js
175 175
176 # 3. 删除待审核文件(可选) 176 # 3. 删除待审核文件(可选)
177 -rm docs/parse-audit/pending/2026-02-14-计划书模版2-宏摯家傳承保險計劃-性別-年齡-出生年月日.md 177 +rm docs/parse-audit/pending/计划书模版2/2026-02-15-计划书模版2-宏摯家傳承保險計劃-性別-年齡-出生年月日.md
178 ``` 178 ```
179 179
180 ### 需要修改 180 ### 需要修改
...@@ -183,7 +183,7 @@ rm docs/parse-audit/pending/2026-02-14-计划书模版2-宏摯家傳承保險計 ...@@ -183,7 +183,7 @@ rm docs/parse-audit/pending/2026-02-14-计划书模版2-宏摯家傳承保險計
183 183
184 ### 放弃本次解析 184 ### 放弃本次解析
185 ```bash 185 ```bash
186 -rm docs/parse-audit/pending/2026-02-14-计划书模版2-宏摯家傳承保險計劃-性別-年齡-出生年月日.md 186 +rm docs/parse-audit/pending/计划书模版2/2026-02-15-计划书模版2-宏摯家傳承保險計劃-性別-年齡-出生年月日.md
187 ``` 187 ```
188 188
189 --- 189 ---
......
1 # 产品配置审核 - 计划书模版2.docx 1 # 产品配置审核 - 计划书模版2.docx
2 2
3 -**解析时间**: 2026/2/15 00:41:27 3 +**解析时间**: 2026/2/15 10:20:30
4 **原始文件**: 计划书模版2.docx 4 **原始文件**: 计划书模版2.docx
5 **数据来源**: docs/to-parse/计划书模版2.docx 5 **数据来源**: docs/to-parse/计划书模版2.docx
6 6
...@@ -114,7 +114,7 @@ ...@@ -114,7 +114,7 @@
114 ```javascript 114 ```javascript
115 /** 115 /**
116 * 宏浚傳承保障計劃 116 * 宏浚傳承保障計劃
117 - * @added 2026-02-14T16:41:27.893Z 117 + * @added 2026-02-15T02:20:30.997Z
118 * @source docs/to-parse/计划书模版2.docx 118 * @source docs/to-parse/计划书模版2.docx
119 */ 119 */
120 'savings-product-d1581522': { 120 'savings-product-d1581522': {
...@@ -167,14 +167,14 @@ ...@@ -167,14 +167,14 @@
167 ### 确认无误 167 ### 确认无误
168 ```bash 168 ```bash
169 # 1. 移动到 approved 目录 169 # 1. 移动到 approved 目录
170 -mv docs/parse-audit/pending/2026-02-14-计划书模版2-宏浚傳承保障計劃.md \ 170 +mv docs/parse-audit/pending/计划书模版2/2026-02-15-计划书模版2-宏浚傳承保障計劃.md \
171 docs/parse-audit/approved/ 171 docs/parse-audit/approved/
172 172
173 # 2. 合并到正式配置 173 # 2. 合并到正式配置
174 # 手动复制或使用工具合并到 src/config/plan-templates.js 174 # 手动复制或使用工具合并到 src/config/plan-templates.js
175 175
176 # 3. 删除待审核文件(可选) 176 # 3. 删除待审核文件(可选)
177 -rm docs/parse-audit/pending/2026-02-14-计划书模版2-宏浚傳承保障計劃.md 177 +rm docs/parse-audit/pending/计划书模版2/2026-02-15-计划书模版2-宏浚傳承保障計劃.md
178 ``` 178 ```
179 179
180 ### 需要修改 180 ### 需要修改
...@@ -183,7 +183,7 @@ rm docs/parse-audit/pending/2026-02-14-计划书模版2-宏浚傳承保障計劃 ...@@ -183,7 +183,7 @@ rm docs/parse-audit/pending/2026-02-14-计划书模版2-宏浚傳承保障計劃
183 183
184 ### 放弃本次解析 184 ### 放弃本次解析
185 ```bash 185 ```bash
186 -rm docs/parse-audit/pending/2026-02-14-计划书模版2-宏浚傳承保障計劃.md 186 +rm docs/parse-audit/pending/计划书模版2/2026-02-15-计划书模版2-宏浚傳承保障計劃.md
187 ``` 187 ```
188 188
189 --- 189 ---
......
1 # 产品配置审核 - 计划书模版2.docx 1 # 产品配置审核 - 计划书模版2.docx
2 2
3 -**解析时间**: 2026/2/15 00:41:27 3 +**解析时间**: 2026/2/15 10:20:30
4 **原始文件**: 计划书模版2.docx 4 **原始文件**: 计划书模版2.docx
5 **数据来源**: docs/to-parse/计划书模版2.docx 5 **数据来源**: docs/to-parse/计划书模版2.docx
6 6
...@@ -115,7 +115,7 @@ ...@@ -115,7 +115,7 @@
115 ```javascript 115 ```javascript
116 /** 116 /**
117 * 赤霞珠終身壽險計劃2基本人壽保障選項 117 * 赤霞珠終身壽險計劃2基本人壽保障選項
118 - * @added 2026-02-14T16:41:27.893Z 118 + * @added 2026-02-15T02:20:30.997Z
119 * @source docs/to-parse/计划书模版2.docx 119 * @source docs/to-parse/计划书模版2.docx
120 */ 120 */
121 'savings-2-031c1237': { 121 'savings-2-031c1237': {
...@@ -168,14 +168,14 @@ ...@@ -168,14 +168,14 @@
168 ### 确认无误 168 ### 确认无误
169 ```bash 169 ```bash
170 # 1. 移动到 approved 目录 170 # 1. 移动到 approved 目录
171 -mv docs/parse-audit/pending/2026-02-14-计划书模版2-赤霞珠終身壽險計劃2基本人壽保障選項.md \ 171 +mv docs/parse-audit/pending/计划书模版2/2026-02-15-计划书模版2-赤霞珠終身壽險計劃2基本人壽保障選項.md \
172 docs/parse-audit/approved/ 172 docs/parse-audit/approved/
173 173
174 # 2. 合并到正式配置 174 # 2. 合并到正式配置
175 # 手动复制或使用工具合并到 src/config/plan-templates.js 175 # 手动复制或使用工具合并到 src/config/plan-templates.js
176 176
177 # 3. 删除待审核文件(可选) 177 # 3. 删除待审核文件(可选)
178 -rm docs/parse-audit/pending/2026-02-14-计划书模版2-赤霞珠終身壽險計劃2基本人壽保障選項.md 178 +rm docs/parse-audit/pending/计划书模版2/2026-02-15-计划书模版2-赤霞珠終身壽險計劃2基本人壽保障選項.md
179 ``` 179 ```
180 180
181 ### 需要修改 181 ### 需要修改
...@@ -184,7 +184,7 @@ rm docs/parse-audit/pending/2026-02-14-计划书模版2-赤霞珠終身壽險計 ...@@ -184,7 +184,7 @@ rm docs/parse-audit/pending/2026-02-14-计划书模版2-赤霞珠終身壽險計
184 184
185 ### 放弃本次解析 185 ### 放弃本次解析
186 ```bash 186 ```bash
187 -rm docs/parse-audit/pending/2026-02-14-计划书模版2-赤霞珠終身壽險計劃2基本人壽保障選項.md 187 +rm docs/parse-audit/pending/计划书模版2/2026-02-15-计划书模版2-赤霞珠終身壽險計劃2基本人壽保障選項.md
188 ``` 188 ```
189 189
190 --- 190 ---
......
This diff is collapsed. Click to expand it.
...@@ -34,10 +34,16 @@ pnpm run parse:docs:file -- --file="产品说明书.pdf" --write-config ...@@ -34,10 +34,16 @@ pnpm run parse:docs:file -- --file="产品说明书.pdf" --write-config
34 34
35 ### 3. 查看结果 35 ### 3. 查看结果
36 36
37 -解析成功后会生成待审核文件,位置如下: 37 +解析成功后会生成待审核文件,位置如下(按原始文档名分目录)
38 38
39 ``` 39 ```
40 -docs/parse-audit/pending/ 40 +docs/parse-audit/pending/<原始文档名>/
41 +```
42 +
43 +解析成功后原始文档会自动归档到:
44 +
45 +```
46 +docs/to-parse/archived/YYYY-MM-DD/
41 ``` 47 ```
42 48
43 审核通过后再手动合并到 `src/config/plan-templates.js`,或使用 `--write-config` 明确写入。 49 审核通过后再手动合并到 `src/config/plan-templates.js`,或使用 `--write-config` 明确写入。
...@@ -103,3 +109,4 @@ docs/parsed-backup/parse-audit.jsonl ...@@ -103,3 +109,4 @@ docs/parsed-backup/parse-audit.jsonl
103 1. **文档命名**:建议使用有意义的文件名,方便识别产品 109 1. **文档命名**:建议使用有意义的文件名,方便识别产品
104 2. **手动审核**:生成后请检查配置是否正确 110 2. **手动审核**:生成后请检查配置是否正确
105 3. **版本控制**:生成的配置会自动备份 111 3. **版本控制**:生成的配置会自动备份
112 +4. **二次解析**:需要重新解析时,将归档文件移回 `docs/to-parse/`
......
1 -# 文档解析工具使用指南
2 -
3 -## 功能概述
4 -
5 -文档解析工具用于将保险产品文档(PDF、DOCX)自动解析为计划书配置,支持智能识别产品类型、币种、缴费年期等信息。
6 -
7 -## 快速开始
8 -
9 -### 1. 查看待处理文档
10 -
11 -```bash
12 -npm run parse:docs:list
13 -```
14 -
15 -### 2. 查看配置状态
16 -
17 -```bash
18 -npm run parse:docs:status
19 -```
20 -
21 -输出示例:
22 -```
23 -🔧 文档解析服务配置状态:
24 -──────────────────────────────────────────────────
25 -📄 markitdown: ❌ 未配置
26 -🤖 AI 服务: ❌ 未配置
27 -──────────────────────────────────────────────────
28 -
29 -💡 配置提示:
30 - 1. 使用 markitdown: 安装 Python 并运行 "pip install markitdown"
31 - 2. 配置 AI 服务: 设置环境变量(.env 文件)
32 -```
33 -
34 -### 3. 解析所有文档
35 -
36 -```bash
37 -npm run parse:docs
38 -```
39 -
40 -### 4. 解析单个文档
41 -
42 -```bash
43 -npm run parse:docs:file="产品说明书.pdf"
44 -```
45 -
46 -## 配置 AI 服务(可选)
47 -
48 -如需启用智能解析功能,请配置以下环境变量:
49 -
50 -### 方法 1: 使用 .env 文件
51 -
52 -```bash
53 -# 复制示例配置
54 -cp scripts/.env.example scripts/.env
55 -
56 -# 编辑 .env 文件,填写 API Key
57 -vim scripts/.env
58 -```
59 -
60 -### 方法 2: 使用环境变量
61 -
62 -```bash
63 -export AI_SERVICE_TYPE=openai
64 -export OPENAI_API_KEY=sk-your-key-here
65 -npm run parse:docs
66 -```
67 -
68 -## 支持的 AI 服务
69 -
70 -| 服务 | 说明 | 环境变量 |
71 -|------|------|---------|
72 -| OpenAI | GPT-4/GPT-3.5 | `OPENAI_API_KEY` |
73 -| Anthropic | Claude 3 Sonnet | `ANTHROPIC_API_KEY` |
74 -| OpenRouter | 聚合服务 | `OPENROUTER_API_KEY` |
75 -
76 -## 解析流程
77 -
78 -1. **文档转换**:将 PDF/DOCX 转换为可读文本
79 -2. **AI 解析**:从文本中提取结构化配置(产品类型、币种、年期等)
80 -3. **生成代码**:生成 `plan-templates.js` 配置代码
81 -4. **更新配置**:自动更新到配置文件
82 -
83 -## 当前状态
84 -
85 --**基础功能**:支持 PDF、DOCX 文本提取
86 --**启发式推断**:根据文件名和内容推断产品类型和币种
87 --**AI 解析**:待集成 AI 服务(需要配置 API Key)
88 -
89 -## 文档位置
90 -
91 -待解析文档放在:`docs/to-parse/` 文件夹
92 -
93 -支持格式:`.pdf`, `.docx`, `.doc`, `.txt`, `.md`
...@@ -36,6 +36,7 @@ import { splitByProducts, findProductTitles, generateSplitReport } from './produ ...@@ -36,6 +36,7 @@ import { splitByProducts, findProductTitles, generateSplitReport } from './produ
36 // ========== 配置区 ========== 36 // ========== 配置区 ==========
37 37
38 const DOCS_DIR = path.resolve(process.cwd(), 'docs/to-parse') 38 const DOCS_DIR = path.resolve(process.cwd(), 'docs/to-parse')
39 +const DOCS_ARCHIVE_DIR = path.resolve(process.cwd(), 'docs/to-parse/archived')
39 const CONFIG_FILE = path.resolve(process.cwd(), 'src/config/plan-templates.js') 40 const CONFIG_FILE = path.resolve(process.cwd(), 'src/config/plan-templates.js')
40 const BACKUP_DIR = path.resolve(process.cwd(), 'docs/parsed-backup') 41 const BACKUP_DIR = path.resolve(process.cwd(), 'docs/parsed-backup')
41 42
...@@ -91,6 +92,29 @@ function getFileMeta(filePath, extraMeta = {}) { ...@@ -91,6 +92,29 @@ function getFileMeta(filePath, extraMeta = {}) {
91 } 92 }
92 } 93 }
93 94
95 +function buildArchiveFilePath(fileName) {
96 + const date = new Date().toISOString().split('T')[0]
97 + const archiveDir = path.join(DOCS_ARCHIVE_DIR, date)
98 + ensureDir(archiveDir)
99 + let targetPath = path.join(archiveDir, fileName)
100 + if (fs.existsSync(targetPath)) {
101 + const ext = path.extname(fileName)
102 + const baseName = path.basename(fileName, ext)
103 + targetPath = path.join(archiveDir, `${baseName}-${Date.now()}${ext}`)
104 + }
105 + return targetPath
106 +}
107 +
108 +function archiveParsedFile(filePath) {
109 + if (!fs.existsSync(filePath)) {
110 + return null
111 + }
112 + ensureDir(DOCS_ARCHIVE_DIR)
113 + const archivePath = buildArchiveFilePath(path.basename(filePath))
114 + fs.renameSync(filePath, archivePath)
115 + return archivePath
116 +}
117 +
94 function buildExtractResult(filePath, text, warnings = [], extraMeta = {}) { 118 function buildExtractResult(filePath, text, warnings = [], extraMeta = {}) {
95 return { 119 return {
96 text, 120 text,
...@@ -750,6 +774,14 @@ async function parseSingleFile(filePath) { ...@@ -750,6 +774,14 @@ async function parseSingleFile(filePath) {
750 }) 774 })
751 } 775 }
752 776
777 + const shouldArchive = results.length > 0 && results.every(r => r.success)
778 + if (shouldArchive) {
779 + const archivedPath = archiveParsedFile(filePath)
780 + if (archivedPath) {
781 + console.log("📦 已归档原始文档: " + archivedPath)
782 + }
783 + }
784 +
753 // 单产品时返回单个结果对象(保持向后兼容) 785 // 单产品时返回单个结果对象(保持向后兼容)
754 // 多产品时返回数组 786 // 多产品时返回数组
755 if (configs.length === 1) { 787 if (configs.length === 1) {
...@@ -786,6 +818,8 @@ async function generateAuditFile(fileName, config, code, productIndex = 0, total ...@@ -786,6 +818,8 @@ async function generateAuditFile(fileName, config, code, productIndex = 0, total
786 818
787 const date = new Date().toISOString().split('T')[0] 819 const date = new Date().toISOString().split('T')[0]
788 const baseFileName = fileName.replace(/\.[^/.]+$/, '') 820 const baseFileName = fileName.replace(/\.[^/.]+$/, '')
821 + const pendingDir = path.join(AUDIT_PENDING_DIR, baseFileName)
822 + ensureDir(pendingDir)
789 823
790 // 多产品文档时,为每个产品生成独立文件 824 // 多产品文档时,为每个产品生成独立文件
791 let auditFileName 825 let auditFileName
...@@ -799,7 +833,7 @@ async function generateAuditFile(fileName, config, code, productIndex = 0, total ...@@ -799,7 +833,7 @@ async function generateAuditFile(fileName, config, code, productIndex = 0, total
799 } else { 833 } else {
800 auditFileName = `${date}-${baseFileName}.md` 834 auditFileName = `${date}-${baseFileName}.md`
801 } 835 }
802 - const auditFilePath = path.join(AUDIT_PENDING_DIR, auditFileName) 836 + const auditFilePath = path.join(pendingDir, auditFileName)
803 const formSn = generateFormSn(config) 837 const formSn = generateFormSn(config)
804 const formSchemaPreview = config.form_schema ? JSON.stringify(config.form_schema, null, 2) : '// 请手动补充' 838 const formSchemaPreview = config.form_schema ? JSON.stringify(config.form_schema, null, 2) : '// 请手动补充'
805 const submitMappingPreview = config.submit_mapping ? JSON.stringify(config.submit_mapping, null, 2) : '// 请手动补充' 839 const submitMappingPreview = config.submit_mapping ? JSON.stringify(config.submit_mapping, null, 2) : '// 请手动补充'
...@@ -945,14 +979,14 @@ ${code.trim()} ...@@ -945,14 +979,14 @@ ${code.trim()}
945 ### 确认无误 979 ### 确认无误
946 \`\`\`bash 980 \`\`\`bash
947 # 1. 移动到 approved 目录 981 # 1. 移动到 approved 目录
948 -mv docs/parse-audit/pending/${auditFileName} \\ 982 +mv docs/parse-audit/pending/${baseFileName}/${auditFileName} \\
949 docs/parse-audit/approved/ 983 docs/parse-audit/approved/
950 984
951 # 2. 合并到正式配置 985 # 2. 合并到正式配置
952 # 手动复制或使用工具合并到 src/config/plan-templates.js 986 # 手动复制或使用工具合并到 src/config/plan-templates.js
953 987
954 # 3. 删除待审核文件(可选) 988 # 3. 删除待审核文件(可选)
955 -rm docs/parse-audit/pending/${auditFileName} 989 +rm docs/parse-audit/pending/${baseFileName}/${auditFileName}
956 \`\`\` 990 \`\`\`
957 991
958 ### 需要修改 992 ### 需要修改
...@@ -961,7 +995,7 @@ rm docs/parse-audit/pending/${auditFileName} ...@@ -961,7 +995,7 @@ rm docs/parse-audit/pending/${auditFileName}
961 995
962 ### 放弃本次解析 996 ### 放弃本次解析
963 \`\`\`bash 997 \`\`\`bash
964 -rm docs/parse-audit/pending/${auditFileName} 998 +rm docs/parse-audit/pending/${baseFileName}/${auditFileName}
965 \`\`\` 999 \`\`\`
966 1000
967 --- 1001 ---
...@@ -1302,6 +1336,7 @@ export function buildParseSummary(results, duration_ms) { ...@@ -1302,6 +1336,7 @@ export function buildParseSummary(results, duration_ms) {
1302 } 1336 }
1303 }) 1337 })
1304 1338
1339 + summary.total = summary.total_products
1305 return summary 1340 return summary
1306 } 1341 }
1307 1342
......