@aigne/doc-smith 0.8.6 → 0.8.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.aigne/doc-smith/output/structure-plan.json +1 -5
- package/CHANGELOG.md +7 -0
- package/README.md +3 -3
- package/agents/{chat.yaml → chat/index.yaml} +7 -7
- package/agents/generate/check-document-structure.yaml +30 -0
- package/agents/{check-structure-plan.mjs → generate/check-need-generate-structure.mjs} +20 -20
- package/agents/{structure-planning.yaml → generate/generate-structure.yaml} +6 -6
- package/agents/{docs-generator.yaml → generate/index.yaml} +11 -12
- package/agents/generate/refine-document-structure.yaml +12 -0
- package/agents/{input-generator.mjs → init/index.mjs} +12 -5
- package/agents/{manage-prefs.mjs → prefs/index.mjs} +1 -1
- package/agents/{team-publish-docs.yaml → publish/index.yaml} +1 -2
- package/agents/{publish-docs.mjs → publish/publish-docs.mjs} +6 -5
- package/agents/schema/{structure-plan-result.yaml → document-execution-structure.yaml} +3 -3
- package/agents/schema/document-structure.yaml +26 -0
- package/agents/{language-selector.mjs → translate/choose-language.mjs} +5 -5
- package/agents/{retranslate.yaml → translate/index.yaml} +11 -12
- package/agents/{translate.yaml → translate/translate-document.yaml} +3 -2
- package/agents/{batch-translate.yaml → translate/translate-multilingual.yaml} +5 -5
- package/agents/update/batch-generate-document.yaml +19 -0
- package/agents/{check-detail.mjs → update/check-document.mjs} +16 -16
- package/agents/{detail-generator-and-translate.yaml → update/generate-and-translate-document.yaml} +23 -23
- package/agents/update/generate-document.yaml +50 -0
- package/agents/{detail-regenerator.yaml → update/index.yaml} +10 -11
- package/agents/{action-success.mjs → utils/action-success.mjs} +1 -1
- package/agents/{check-detail-result.mjs → utils/check-detail-result.mjs} +3 -3
- package/agents/{check-feedback-refiner.mjs → utils/check-feedback-refiner.mjs} +6 -6
- package/agents/{find-items-by-paths.mjs → utils/choose-docs.mjs} +24 -9
- package/agents/{docs-fs.yaml → utils/docs-fs-actor.yaml} +3 -1
- package/agents/{feedback-refiner.yaml → utils/feedback-refiner.yaml} +2 -4
- package/agents/{find-item-by-path.mjs → utils/find-item-by-path.mjs} +16 -6
- package/agents/{find-user-preferences-by-path.mjs → utils/find-user-preferences-by-path.mjs} +1 -1
- package/agents/utils/format-document-structure.mjs +25 -0
- package/agents/{load-sources.mjs → utils/load-sources.mjs} +41 -28
- package/agents/{save-docs.mjs → utils/save-docs.mjs} +16 -16
- package/agents/{save-single-doc.mjs → utils/save-single-doc.mjs} +2 -2
- package/agents/{transform-detail-datasources.mjs → utils/transform-detail-datasources.mjs} +1 -1
- package/aigne.yaml +35 -35
- package/docs-mcp/analyze-docs-relevance.yaml +10 -10
- package/docs-mcp/docs-search.yaml +5 -3
- package/package.json +10 -8
- package/prompts/{document → detail/custom}/custom-code-block.md +6 -6
- package/prompts/detail/custom/custom-components.md +172 -0
- package/prompts/{document → detail}/d2-chart/rules.md +95 -1
- package/prompts/{document → detail}/detail-example.md +80 -61
- package/prompts/{document/detail-generator.md → detail/document-rules.md} +4 -8
- package/prompts/{content-detail-generator.md → detail/generate-document.md} +48 -25
- package/prompts/{check-structure-planning-result.md → structure/check-document-structure.md} +23 -17
- package/prompts/{document/structure-planning.md → structure/document-rules.md} +0 -2
- package/prompts/{structure-planning.md → structure/generate-structure.md} +51 -30
- package/prompts/{document → structure}/structure-example.md +2 -2
- package/prompts/{document → structure}/structure-getting-started.md +2 -2
- package/prompts/translate/glossary.md +6 -0
- package/prompts/{translator.md → translate/translate-document.md} +29 -10
- package/prompts/{feedback-refiner.md → utils/feedback-refiner.md} +8 -8
- package/tests/agents/chat/chat.test.mjs +46 -0
- package/tests/agents/generate/check-document-structure.test.mjs +51 -0
- package/tests/agents/generate/check-need-generate-structure.test.mjs +292 -0
- package/tests/agents/generate/generate-structure.test.mjs +51 -0
- package/tests/{input-generator.test.mjs → agents/init/init.test.mjs} +13 -13
- package/tests/agents/prefs/prefs.test.mjs +431 -0
- package/tests/agents/publish/publish-docs.test.mjs +642 -0
- package/tests/agents/translate/choose-language.test.mjs +311 -0
- package/tests/agents/translate/translate-document.test.mjs +51 -0
- package/tests/agents/update/check-document.test.mjs +523 -0
- package/tests/agents/update/generate-document.test.mjs +51 -0
- package/tests/agents/utils/action-success.test.mjs +54 -0
- package/tests/{check-detail-result.test.mjs → agents/utils/check-detail-result.test.mjs} +98 -98
- package/tests/agents/utils/check-feedback-refiner.test.mjs +478 -0
- package/tests/agents/utils/choose-docs.test.mjs +417 -0
- package/tests/agents/utils/exit.test.mjs +70 -0
- package/tests/agents/utils/feedback-refiner.test.mjs +51 -0
- package/tests/agents/utils/find-item-by-path.test.mjs +526 -0
- package/tests/agents/utils/find-user-preferences-by-path.test.mjs +382 -0
- package/tests/agents/utils/format-document-structure.test.mjs +264 -0
- package/tests/agents/utils/fs.test.mjs +267 -0
- package/tests/{load-sources.test.mjs → agents/utils/load-sources.test.mjs} +153 -25
- package/tests/{save-docs.test.mjs → agents/utils/save-docs.test.mjs} +11 -5
- package/tests/agents/utils/save-output.test.mjs +315 -0
- package/tests/agents/utils/save-single-doc.test.mjs +364 -0
- package/tests/agents/utils/transform-detail-datasources.test.mjs +363 -0
- package/tests/utils/auth-utils.test.mjs +358 -0
- package/tests/utils/blocklet.test.mjs +334 -0
- package/tests/{conflict-resolution.test.mjs → utils/conflict-detector.test.mjs} +3 -3
- package/tests/utils/constants.test.mjs +295 -0
- package/tests/utils/d2-utils.test.mjs +423 -0
- package/tests/{deploy.test.mjs → utils/deploy.test.mjs} +25 -36
- package/tests/utils/docs-finder-utils.test.mjs +625 -0
- package/tests/utils/file-utils.test.mjs +213 -0
- package/tests/{kroki-utils.test.mjs → utils/kroki-utils.test.mjs} +2 -2
- package/tests/utils/load-config.test.mjs +141 -0
- package/tests/{mermaid-validation.test.mjs → utils/mermaid-validator.test.mjs} +2 -2
- package/tests/utils/mock-chat-model.mjs +12 -0
- package/tests/{preferences-utils.test.mjs → utils/preferences-utils.test.mjs} +1 -1
- package/tests/{save-value-to-config.test.mjs → utils/save-value-to-config.test.mjs} +61 -4
- package/tests/utils/utils.test.mjs +939 -0
- package/utils/conflict-detector.mjs +1 -1
- package/utils/constants.mjs +5 -3
- package/utils/d2-utils.mjs +194 -0
- package/utils/docs-finder-utils.mjs +26 -26
- package/utils/icon-map.mjs +26 -0
- package/{agents → utils}/load-config.mjs +2 -18
- package/utils/markdown-checker.mjs +5 -5
- package/agents/batch-docs-detail-generator.yaml +0 -19
- package/agents/check-structure-planning-result.yaml +0 -30
- package/agents/content-detail-generator.yaml +0 -50
- package/agents/format-structure-plan.mjs +0 -25
- package/agents/reflective-structure-planner.yaml +0 -12
- package/agents/schema/structure-plan.yaml +0 -26
- package/prompts/document/custom-components.md +0 -104
- package/tests/README.md +0 -93
- package/tests/utils.test.mjs +0 -2067
- /package/agents/{exit.mjs → utils/exit.mjs} +0 -0
- /package/agents/{fs.mjs → utils/fs.mjs} +0 -0
- /package/agents/{save-output.mjs → utils/save-output.mjs} +0 -0
- /package/prompts/{document → detail}/d2-chart/official-examples.md +0 -0
- /package/prompts/{document → detail}/jsx/rules.md +0 -0
|
@@ -63,18 +63,25 @@
|
|
|
63
63
|
|
|
64
64
|
**Parameters**
|
|
65
65
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
66
|
+
<x-field data-name="name" data-type="string" data-required="true" data-desc="The name of the product."></x-field>
|
|
67
|
+
|
|
68
|
+
<x-field data-name="description" data-type="string" data-required="false" data-desc="An optional description for the product."></x-field>
|
|
69
|
+
|
|
70
|
+
<x-field data-name="type" data-type="string" data-required="false" data-desc="The type of product (e.g., 'service', 'good')."></x-field>
|
|
71
|
+
|
|
72
|
+
<x-field data-name="prices" data-type="Partial<TPrice>[]" data-required="false" data-desc="An optional array of partial price objects to associate with the product upon creation">
|
|
73
|
+
<x-field data-name="type" data-type="string" data-required="true" data-desc="The type of price (e.g., 'recurring', 'one_time')"></x-field>
|
|
74
|
+
<x-field data-name="unit_amount" data-type="string" data-required="true" data-desc="The price amount as a string"></x-field>
|
|
75
|
+
<x-field data-name="currency_id" data-type="string" data-required="true" data-desc="The currency identifier"></x-field>
|
|
76
|
+
<x-field data-name="recurring" data-type="object" data-required="false" data-desc="Recurring price configuration">
|
|
77
|
+
<x-field data-name="interval" data-type="string" data-required="true" data-desc="The billing interval (e.g., 'month', 'year')"></x-field>
|
|
78
|
+
<x-field data-name="interval_count" data-type="number" data-required="true" data-desc="The number of intervals between each billing"></x-field>
|
|
79
|
+
</x-field>
|
|
80
|
+
</x-field>
|
|
72
81
|
|
|
73
82
|
**Returns**
|
|
74
83
|
|
|
75
|
-
|
|
76
|
-
|---|---|---|
|
|
77
|
-
| `product` | `TProductExpanded` | The newly created product object, including expanded details. |
|
|
84
|
+
<x-field data-name="product" data-type="TProductExpanded" data-desc="The newly created product object, including expanded details"></x-field>
|
|
78
85
|
|
|
79
86
|
**Example**
|
|
80
87
|
|
|
@@ -124,15 +131,11 @@
|
|
|
124
131
|
|
|
125
132
|
**Parameters**
|
|
126
133
|
|
|
127
|
-
|
|
128
|
-
|---|---|---|
|
|
129
|
-
| `id` | `string` | The unique identifier of the product to retrieve. |
|
|
134
|
+
<x-field data-name="id" data-type="string" data-required="true" data-desc="The unique identifier of the product to retrieve."></x-field>
|
|
130
135
|
|
|
131
136
|
**Returns**
|
|
132
137
|
|
|
133
|
-
|
|
134
|
-
|---|---|---|
|
|
135
|
-
| `product` | `TProductExpanded` | The retrieved product object, including expanded details. |
|
|
138
|
+
<x-field data-name="product" data-type="TProductExpanded" data-desc="The retrieved product object, including expanded details."></x-field>
|
|
136
139
|
|
|
137
140
|
**Example**
|
|
138
141
|
|
|
@@ -167,16 +170,13 @@
|
|
|
167
170
|
|
|
168
171
|
**Parameters**
|
|
169
172
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
| `data` | `Partial<TProduct>` | An object containing the product fields to update. Available fields include `name`, `description`, `type`, etc. |
|
|
173
|
+
<x-field data-name="id" data-type="string" data-required="true" data-desc="The unique identifier of the product to update."></x-field>
|
|
174
|
+
|
|
175
|
+
<x-field data-name="data" data-type="Partial<TProduct>" data-required="true" data-desc="An object containing the product fields to update. Available fields include name, description, type, etc."></x-field>
|
|
174
176
|
|
|
175
177
|
**Returns**
|
|
176
178
|
|
|
177
|
-
|
|
178
|
-
|---|---|---|
|
|
179
|
-
| `product` | `TProductExpanded` | The updated product object. |
|
|
179
|
+
<x-field data-name="product" data-type="TProductExpanded" data-desc="The updated product object."></x-field>
|
|
180
180
|
|
|
181
181
|
**Example**
|
|
182
182
|
|
|
@@ -213,25 +213,31 @@
|
|
|
213
213
|
|
|
214
214
|
**Parameters**
|
|
215
215
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
216
|
+
<x-field data-name="active" data-type="boolean" data-required="false" data-desc="Optional. Filter by product active status."></x-field>
|
|
217
|
+
|
|
218
|
+
<x-field data-name="name" data-type="string" data-required="false" data-desc="Optional. Filter by product name."></x-field>
|
|
219
|
+
|
|
220
|
+
<x-field data-name="description" data-type="string" data-required="false" data-desc="Optional. Filter by product description."></x-field>
|
|
221
|
+
|
|
222
|
+
<x-field data-name="metadata.{key}" data-type="string" data-required="false" data-desc="Optional. Filter by custom metadata fields. Use metadata.yourKey to specify a metadata property."></x-field>
|
|
223
|
+
|
|
224
|
+
<x-field data-name="page" data-type="number" data-default="1" data-required="false" data-desc="Optional. The page number for pagination (default: 1)."></x-field>
|
|
225
|
+
|
|
226
|
+
<x-field data-name="pageSize" data-type="number" data-default="50" data-required="false" data-desc="Optional. The number of items per page (default: 50)."></x-field>
|
|
227
|
+
|
|
228
|
+
<x-field data-name="order" data-type="string" data-required="false" data-desc="Optional. Sort order (e.g., 'created_at:ASC', 'updated_at:DESC')."></x-field>
|
|
229
|
+
|
|
230
|
+
<x-field data-name="activeFirst" data-type="boolean" data-required="false" data-desc="Optional. If true, active products are listed first."></x-field>
|
|
226
231
|
|
|
227
232
|
**Returns**
|
|
228
233
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
234
|
+
<x-field data-name="data" data-type="TProductExpanded[]" data-desc="An array of product objects."></x-field>
|
|
235
|
+
|
|
236
|
+
<x-field data-name="page" data-type="number" data-desc="The current page number."></x-field>
|
|
237
|
+
|
|
238
|
+
<x-field data-name="pageSize" data-type="number" data-desc="The number of items per page."></x-field>
|
|
239
|
+
|
|
240
|
+
<x-field data-name="total" data-type="number" data-desc="The total number of products matching the criteria."></x-field>
|
|
235
241
|
|
|
236
242
|
**Example**
|
|
237
243
|
|
|
@@ -280,20 +286,21 @@
|
|
|
280
286
|
|
|
281
287
|
**Parameters**
|
|
282
288
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
289
|
+
<x-field data-name="query" data-type="string" data-required="true" data-desc="The search string to match against product fields."></x-field>
|
|
290
|
+
|
|
291
|
+
<x-field data-name="page" data-type="number" data-default="1" data-required="false" data-desc="Optional. The page number for pagination (default: 1)."></x-field>
|
|
292
|
+
|
|
293
|
+
<x-field data-name="pageSize" data-type="number" data-default="50" data-required="false" data-desc="Optional. The number of items per page (default: 50)."></x-field>
|
|
288
294
|
|
|
289
295
|
**Returns**
|
|
290
296
|
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
+
<x-field data-name="data" data-type="TProductExpanded[]" data-desc="An array of product objects that match the search query."></x-field>
|
|
298
|
+
|
|
299
|
+
<x-field data-name="page" data-type="number" data-desc="The current page number."></x-field>
|
|
300
|
+
|
|
301
|
+
<x-field data-name="pageSize" data-type="number" data-desc="The number of items per page."></x-field>
|
|
302
|
+
|
|
303
|
+
<x-field data-name="total" data-type="number" data-desc="The total number of products matching the criteria."></x-field>
|
|
297
304
|
|
|
298
305
|
**Example**
|
|
299
306
|
|
|
@@ -341,15 +348,11 @@
|
|
|
341
348
|
|
|
342
349
|
**Parameters**
|
|
343
350
|
|
|
344
|
-
|
|
345
|
-
|---|---|---|
|
|
346
|
-
| `id` | `string` | The unique identifier of the product to archive. |
|
|
351
|
+
<x-field data-name="id" data-type="string" data-required="true" data-desc="The unique identifier of the product to archive."></x-field>
|
|
347
352
|
|
|
348
353
|
**Returns**
|
|
349
354
|
|
|
350
|
-
|
|
351
|
-
|---|---|---|
|
|
352
|
-
| `product` | `TProduct` | The archived product object. |
|
|
355
|
+
<x-field data-name="product" data-type="TProduct" data-desc="The archived product object."></x-field>
|
|
353
356
|
|
|
354
357
|
**Example**
|
|
355
358
|
|
|
@@ -384,15 +387,11 @@
|
|
|
384
387
|
|
|
385
388
|
**Parameters**
|
|
386
389
|
|
|
387
|
-
|
|
388
|
-
|---|---|---|
|
|
389
|
-
| `id` | `string` | The unique identifier of the product to delete. |
|
|
390
|
+
<x-field data-name="id" data-type="string" data-required="true" data-desc="The unique identifier of the product to delete."></x-field>
|
|
390
391
|
|
|
391
392
|
**Returns**
|
|
392
393
|
|
|
393
|
-
|
|
394
|
-
|---|---|---|
|
|
395
|
-
| `product` | `TProduct` | The deleted product object. |
|
|
394
|
+
<x-field data-name="product" data-type="TProduct" data-desc="The deleted product object."></x-field>
|
|
396
395
|
|
|
397
396
|
**Example**
|
|
398
397
|
|
|
@@ -421,6 +420,26 @@
|
|
|
421
420
|
|
|
422
421
|
This example permanently deletes a specified product.
|
|
423
422
|
|
|
423
|
+
## Context Types
|
|
424
|
+
|
|
425
|
+
When working with context objects, use `<x-field>` components to describe the structure:
|
|
426
|
+
|
|
427
|
+
**UserContext**
|
|
428
|
+
|
|
429
|
+
<x-field data-name="user" data-type="object" data-required="true" data-desc="Current user information">
|
|
430
|
+
<x-field data-name="id" data-type="string" data-required="true" data-desc="User unique identifier"></x-field>
|
|
431
|
+
<x-field data-name="name" data-type="string" data-required="true" data-desc="User display name"></x-field>
|
|
432
|
+
<x-field data-name="email" data-type="string" data-required="true" data-desc="User email address"></x-field>
|
|
433
|
+
<x-field data-name="role" data-type="string" data-default="user" data-desc="User role (user, admin, moderator)"></x-field>
|
|
434
|
+
</x-field>
|
|
435
|
+
|
|
436
|
+
<x-field data-name="session" data-type="object" data-required="true" data-desc="Current session information">
|
|
437
|
+
<x-field data-name="token" data-type="string" data-required="true" data-desc="Session authentication token"></x-field>
|
|
438
|
+
<x-field data-name="expiresAt" data-type="number" data-required="true" data-desc="Session expiration timestamp"></x-field>
|
|
439
|
+
</x-field>
|
|
440
|
+
|
|
441
|
+
<x-field data-name="permissions" data-type="array" data-required="false" data-desc="User permissions list"></x-field>
|
|
442
|
+
|
|
424
443
|
---
|
|
425
444
|
|
|
426
445
|
This section covered the essential operations for managing products within PaymentKit. You can now define and organize your offerings. Continue to the [Prices](/core-resources/prices) section to learn how to set up pricing for your products.
|
|
@@ -13,8 +13,11 @@
|
|
|
13
13
|
- 每个 section 需要包含:标题、介绍、代码示例、响应数据示例、示例说明,示例说明跟在示例代码后描述,不需要‘示例说明’这样的小标题
|
|
14
14
|
- 确保文档中的内容是完整、连贯的,用户可以跟着文档一步步顺利执行
|
|
15
15
|
- 说明要尽可能的详细,如果存在配置项或参数,需要解释每个配置项或参数的含义,如果参数有多个可选值,每种可选值需要解释其含义,并尽可能配上代码示例
|
|
16
|
-
-
|
|
16
|
+
- 参数、返回值、上下文数据(Context)、Props 以及与类型相关的内容优先使用 `<x-field>` 自定义组件来展示,支持嵌套结构来清晰描述复杂数据类型
|
|
17
|
+
- 对于复杂对象类型,使用嵌套的 `<x-field>` 结构来递归描述参数结构,嵌套层级不超过 5 级
|
|
18
|
+
- 所有类型都使用开闭标签格式 `<x-field ...></x-field>`,简单类型 children 为空,复杂类型包含嵌套字段
|
|
17
19
|
- 接口/方法调用的说明必须包含 **响应数据示例**
|
|
20
|
+
- 对于其他类型的列表数据,数据内容简单,优先使用 markdown 中的 table 来展示,让内容看上去更整齐,容易阅读
|
|
18
21
|
- 对输出的 markdown 进行检查,确认输出内容完整,table、d2 信息完整并且格式正确
|
|
19
22
|
- **确保内容完整性**:在生成任何文档内容,特别是代码块(如 d2、JSON、代码等)时,必须确保其是**完整且语法正确**的。在输出完成后,必须进行一次**自我检查**,确认所有的代码块、列表、表格等都已完全闭合且没有中途截断。
|
|
20
23
|
- **代码块原子性**:将每个代码块(例如 ```d2 ... ```)视为一个**不可分割的原子单元**。必须一次性完整生成,从开始标记(```d2)到结束标记(```)之间的所有内容都不能省略或截断。
|
|
@@ -26,13 +29,6 @@
|
|
|
26
29
|
|
|
27
30
|
</document_rules>
|
|
28
31
|
|
|
29
|
-
<document_rules>
|
|
30
|
-
|
|
31
|
-
D2 Diagram Generation Expert Guide:
|
|
32
|
-
{% include "d2-chart/rules.md" %}
|
|
33
|
-
|
|
34
|
-
</document_rules>
|
|
35
|
-
|
|
36
32
|
<TONE_STYLE>
|
|
37
33
|
- Documentation should be plain, rigorous and accurate, avoiding grandiose or empty vocabulary
|
|
38
34
|
- You are writing for humans, not algorithms
|
|
@@ -1,12 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
<role>
|
|
2
|
+
你是一位资深的文档专家和信息架构师,拥有渊博的知识和卓越的沟通能力。你的核心任务是将各种来源的信息,无论是代码、配置、设计文档、用户需求还是其他结构化或非结构化数据,转化为清晰、准确、全面且用户友好的文档。
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
你的优势在于:
|
|
5
|
+
- 深度理解能力: 你能够快速、深入地分析和理解不同类型的数据源,识别其中的关键信息、逻辑关系、潜在问题以及用户可能关心的重点。
|
|
6
|
+
- 信息提炼与组织: 你擅长从海量信息中提炼出核心要点,并根据文档的目的和目标受众,以逻辑清晰、结构严谨的方式进行组织和呈现。
|
|
7
|
+
- 通用化写作风格: 你不受限于特定技术领域,能够根据文档的通用性需求,采用恰当的语言风格,无论是技术说明、操作指南、产品介绍还是业务流程文档,都能游刃有余。
|
|
8
|
+
- 质量导向: 你始终追求文档的顶级质量,确保内容的准确性、完整性、一致性、可读性和实用性。你关注细节,力求每一处表述都精准到位。
|
|
9
|
+
- 用户视角: 你会站在目标读者的角度思考,预测他们可能遇到的疑问和困惑,并在文档中提前解答,从而提升文档的用户体验和价值。
|
|
6
10
|
|
|
7
|
-
|
|
11
|
+
你的任务是根据用户提供的信息:当前 {{nodeName}}(包含标题、描述、路径)信息、DataSources、documentStructure(整体结构规划)等信息,生成当前{{nodeName}}的详细内容。
|
|
12
|
+
</role>
|
|
13
|
+
|
|
14
|
+
{% if detailFeedback %}
|
|
15
|
+
<content_review_feedback>
|
|
8
16
|
{{ detailFeedback }}
|
|
9
|
-
</
|
|
17
|
+
</content_review_feedback>
|
|
18
|
+
{% endif %}
|
|
10
19
|
|
|
11
20
|
<user_locale>
|
|
12
21
|
{{ locale }}
|
|
@@ -23,37 +32,45 @@
|
|
|
23
32
|
|
|
24
33
|
</datasources>
|
|
25
34
|
|
|
35
|
+
{% if glossary %}
|
|
26
36
|
<terms>
|
|
27
37
|
专有词汇表,使用时请确保拼写正确。
|
|
28
38
|
|
|
29
39
|
{{glossary}}
|
|
30
40
|
</terms>
|
|
41
|
+
{% endif %}
|
|
31
42
|
|
|
32
|
-
<
|
|
33
|
-
{{
|
|
34
|
-
</
|
|
43
|
+
<document_structure>
|
|
44
|
+
{{ documentStructureYaml }}
|
|
45
|
+
</document_structure>
|
|
35
46
|
|
|
36
|
-
<
|
|
47
|
+
<current_document>
|
|
37
48
|
当前{{nodeName}}信息:
|
|
38
49
|
title: {{title}}
|
|
39
50
|
description: {{description}}
|
|
40
51
|
path: {{path}}
|
|
41
52
|
parentId: {{parentId}}
|
|
53
|
+
</current_document>
|
|
42
54
|
|
|
55
|
+
{% if content %}
|
|
43
56
|
上一轮生成的内容:
|
|
44
57
|
<last_content>
|
|
45
58
|
{{content}}
|
|
46
59
|
</last_content>
|
|
60
|
+
{% endif %}
|
|
47
61
|
|
|
62
|
+
{% if feedback %}
|
|
48
63
|
用户对上一轮的反馈意见:
|
|
49
64
|
<feedback>
|
|
50
65
|
{{feedback}}
|
|
51
66
|
</feedback>
|
|
67
|
+
{% endif %}
|
|
52
68
|
|
|
53
|
-
|
|
69
|
+
{% if detailFeedback %}
|
|
70
|
+
<content_review_feedback>
|
|
54
71
|
{{ detailFeedback }}
|
|
55
|
-
</
|
|
56
|
-
|
|
72
|
+
</content_review_feedback>
|
|
73
|
+
{% endif %}
|
|
57
74
|
|
|
58
75
|
<user_rules>
|
|
59
76
|
{{ rules }}
|
|
@@ -61,15 +78,17 @@ parentId: {{parentId}}
|
|
|
61
78
|
** 使用 {{ locale }} 语言输出内容 **
|
|
62
79
|
</user_rules>
|
|
63
80
|
|
|
81
|
+
{% if userPreferences %}
|
|
64
82
|
<user_preferences>
|
|
65
83
|
{{userPreferences}}
|
|
66
84
|
|
|
67
85
|
用户偏好使用规则:
|
|
68
|
-
-
|
|
86
|
+
- 用户偏好来自用户之前操作中提供的反馈,生成内容中需要考虑用户的偏好,避免出现用户反馈的问题又重复出现
|
|
69
87
|
- 用户偏好的权重低于本次用户提交的反馈
|
|
70
88
|
</user_preferences>
|
|
89
|
+
{% endif %}
|
|
71
90
|
|
|
72
|
-
<
|
|
91
|
+
<content_generation_rules>
|
|
73
92
|
|
|
74
93
|
目标受众:{{targetAudience}}
|
|
75
94
|
|
|
@@ -78,7 +97,7 @@ parentId: {{parentId}}
|
|
|
78
97
|
- 仅使用 DataSources 中的信息,不能虚构、补充未出现的内容。
|
|
79
98
|
- 结合当前{{nodeName}}的标题、描述,合理规划{{nodeName}}内容结构,内容要丰富、有条理、有吸引力。
|
|
80
99
|
- 内容风格需要匹配目标受众
|
|
81
|
-
- 明确区分与
|
|
100
|
+
- 明确区分与 documentStructure 其他{{nodeName}}的内容,避免重复,突出本{{nodeName}}的独特价值。
|
|
82
101
|
{% if enforceInfoCompleteness %}
|
|
83
102
|
- 如果 DataSources 相关信息不足,直接返回错误信息,提示用户补充内容,要确保页面内容足够丰富,你可以放心的向用户提出补充信息的要求。
|
|
84
103
|
- 只展示有价值、能吸引用户的信息,如信息不足,提示用户补充信息
|
|
@@ -91,7 +110,6 @@ parentId: {{parentId}}
|
|
|
91
110
|
- 不要在输出中直接 Data Sources 中的文件路径,这对用户是没有意义的
|
|
92
111
|
- 不要出现 '当前{{nodeName}}' 这种说法
|
|
93
112
|
|
|
94
|
-
<media_rules>
|
|
95
113
|
媒体资源使用规则:
|
|
96
114
|
|
|
97
115
|
- DataSource 中如果包含媒体资源文件,在生成的结果需要合理的使用
|
|
@@ -100,21 +118,26 @@ parentId: {{parentId}}
|
|
|
100
118
|
- 根据资源描述,在上下文相关的位置,合理的展示图片,让结果展示效果更丰富
|
|
101
119
|
- 为了确保媒体资源路径正确,** 只能使用 media_list 中提供媒体资源或提供远程 URL 的媒体资源 **
|
|
102
120
|
|
|
103
|
-
</media_rules>
|
|
104
121
|
|
|
105
|
-
|
|
122
|
+
文档类型内容生成规则:
|
|
123
|
+
{% include "./document-rules.md" %}
|
|
124
|
+
|
|
125
|
+
自定义组件生成规则:
|
|
126
|
+
{% include "custom/custom-components.md" %}
|
|
106
127
|
|
|
107
|
-
|
|
128
|
+
自定义代码块生成规则:
|
|
129
|
+
{% include "custom/custom-code-block.md" %}
|
|
108
130
|
|
|
109
|
-
|
|
110
|
-
|
|
131
|
+
D2 Diagram Generation Expert Guide:
|
|
132
|
+
{% include "d2-chart/rules.md" %}
|
|
133
|
+
</content_generation_rules>
|
|
111
134
|
|
|
112
|
-
{% include "
|
|
135
|
+
{% include "./detail-example.md" %}
|
|
113
136
|
|
|
114
|
-
<
|
|
137
|
+
<output_rules>
|
|
115
138
|
|
|
116
139
|
1. 输内容为{{nodeName}}的详细文本。
|
|
117
140
|
2. 直接输出{{nodeName}}内容,不要包含其他信息.
|
|
118
141
|
3. 仅参考示例中的风格,**以语言 {{locale}} 输出内容 **
|
|
119
142
|
|
|
120
|
-
</
|
|
143
|
+
</output_rules>
|
package/prompts/{check-structure-planning-result.md → structure/check-document-structure.md}
RENAMED
|
@@ -3,20 +3,26 @@
|
|
|
3
3
|
</role>
|
|
4
4
|
|
|
5
5
|
<context>
|
|
6
|
-
- **上一轮的结构规划 (
|
|
6
|
+
- **上一轮的结构规划 (originalDocumentStructure)**:
|
|
7
|
+
<original_document_structure>
|
|
7
8
|
```json
|
|
8
|
-
{{
|
|
9
|
+
{{ originalDocumentStructure }}
|
|
9
10
|
```
|
|
11
|
+
</original_document_structure>
|
|
10
12
|
|
|
11
|
-
- **新生成的结构规划 (
|
|
13
|
+
- **新生成的结构规划 (documentStructure)**:
|
|
14
|
+
<document_structure>
|
|
12
15
|
```json
|
|
13
|
-
{{
|
|
16
|
+
{{ documentStructure }}
|
|
14
17
|
```
|
|
18
|
+
</document_structure>
|
|
15
19
|
|
|
20
|
+
{% if feedback %}
|
|
16
21
|
- **用户反馈**:
|
|
17
22
|
```
|
|
18
23
|
{{ feedback }}
|
|
19
24
|
```
|
|
25
|
+
{% endif %}
|
|
20
26
|
</context>
|
|
21
27
|
|
|
22
28
|
<goal>
|
|
@@ -28,9 +34,9 @@
|
|
|
28
34
|
4. **数据有效性**: 所有 {{ nodeName }} 都有关联数据源,sourceIds 中都有值。
|
|
29
35
|
</goal>
|
|
30
36
|
|
|
31
|
-
<
|
|
37
|
+
<quality_control_rules>
|
|
32
38
|
### 场景 1:首次运行(没有旧的规划)
|
|
33
|
-
如果 `
|
|
39
|
+
如果 `originalDocumentStructure` 为 null、为空或未提供,这意味着这是第一次生成结构。没有可供比较的对象。
|
|
34
40
|
你的检查自动通过。
|
|
35
41
|
|
|
36
42
|
### 场景 2:迭代运行(存在旧的规划)
|
|
@@ -38,13 +44,13 @@
|
|
|
38
44
|
|
|
39
45
|
**分步分析**:
|
|
40
46
|
1. **分析反馈**:仔细阅读并理解 `<context>` 中 用户反馈 提出的每一项变更要求。明确哪些节点是需要被修改、添加或删除的目标。
|
|
41
|
-
2. **验证反馈的实现**:对比 `<context>` 中的 `
|
|
42
|
-
3. **验证无关节点的稳定性**:这是最关键的检查。遍历 `
|
|
43
|
-
* **至关重要**:其 `path`、`sourcesIds` 属性**必须**与 `
|
|
47
|
+
2. **验证反馈的实现**:对比 `<context>` 中的 `documentStructure` 和 `originalDocumentStructure`,确认所要求的变更是否已执行。例如,如果反馈是“移除‘示例’部分”,你必须检查该部分在 `documentStructure` 中是否已不存在。
|
|
48
|
+
3. **验证无关节点的稳定性**:这是最关键的检查。遍历 `documentStructure` 中的所有节点。对于每一个在 `originalDocumentStructure` 中也存在、但并未在反馈中被提及的节点:
|
|
49
|
+
* **至关重要**:其 `path`、`sourcesIds` 属性**必须**与 `originalDocumentStructure` 中的完全相同。
|
|
44
50
|
* 理想情况下,其他属性(如 `title`、`description`)也应保持稳定,除非这些变更是由某个被要求的变更直接导致的,或者是 DataSource 变更导致。
|
|
45
|
-
</
|
|
51
|
+
</quality_control_rules>
|
|
46
52
|
|
|
47
|
-
<
|
|
53
|
+
<output_rules>
|
|
48
54
|
你的输出必须是一个包含 `isValid` 和 `reason` 的有效 JSON 对象,使用 en 返回。
|
|
49
55
|
|
|
50
56
|
* **如果两条规则都满足**:
|
|
@@ -52,7 +58,7 @@
|
|
|
52
58
|
```json
|
|
53
59
|
{
|
|
54
60
|
"isValid": true,
|
|
55
|
-
"reason": "The new structure
|
|
61
|
+
"reason": "The new document structure correctly implements user feedback while maintaining stability of all unrelated nodes."
|
|
56
62
|
}
|
|
57
63
|
```
|
|
58
64
|
|
|
@@ -61,7 +67,7 @@
|
|
|
61
67
|
```json
|
|
62
68
|
{
|
|
63
69
|
"isValid": false,
|
|
64
|
-
"reason": "The new structure
|
|
70
|
+
"reason": "The new document structure fails to correctly implement user feedback. [Please provide specific details, e.g.: 'Feedback requested renaming 'Introduction' to 'Overview', but this change was not executed.']"
|
|
65
71
|
}
|
|
66
72
|
```
|
|
67
73
|
|
|
@@ -70,7 +76,7 @@
|
|
|
70
76
|
```json
|
|
71
77
|
{
|
|
72
78
|
"isValid": false,
|
|
73
|
-
"reason": "The new structure
|
|
79
|
+
"reason": "The new document structure modified unrelated nodes, which is not allowed. [Please provide specific details, e.g.: 'The path of node 'API Reference' was changed from '/api' to '/reference/api' without any feedback requesting this change. This is a critical error.']"
|
|
74
80
|
}
|
|
75
81
|
```
|
|
76
82
|
|
|
@@ -78,7 +84,7 @@
|
|
|
78
84
|
```json
|
|
79
85
|
{
|
|
80
86
|
"isValid": false,
|
|
81
|
-
"reason": "The structure
|
|
87
|
+
"reason": "The document structure contains nodes without associated data sources. Each node must have at least one source file linked through sourcesIds."
|
|
82
88
|
}
|
|
83
89
|
```
|
|
84
90
|
|
|
@@ -87,7 +93,7 @@
|
|
|
87
93
|
```json
|
|
88
94
|
{
|
|
89
95
|
"isValid": true,
|
|
90
|
-
"reason": "First structure
|
|
96
|
+
"reason": "First document structure generation, no previous version to compare with."
|
|
91
97
|
}
|
|
92
98
|
```
|
|
93
|
-
</
|
|
99
|
+
</output_rules>
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
|
|
2
|
-
<document_rules>
|
|
3
2
|
文档类结构规划规则:
|
|
4
3
|
- 对于结构规划需要生成完整的文档结构,覆盖源码中的所有功能,并提供代码示例的示例。
|
|
5
4
|
- 基于提供的源代码进行结构规划,确保规划的节点都有足够的信息展示
|
|
@@ -13,4 +12,3 @@
|
|
|
13
12
|
- 标题中不需要包含产品名称,显示更加精简
|
|
14
13
|
- 'Overview' 章节应该引用所有源代码,方便写出准确全面的介绍
|
|
15
14
|
- 每个部分文档都应该尽可能多的引用相关的源代码,来确保生成文档更详细准确,对于你不确定的项,优先添加引用
|
|
16
|
-
</document_rules>
|