@aigne/doc-smith 0.8.15-beta.14 → 0.8.15-beta.16
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/CHANGELOG.md +14 -0
- package/agents/init/index.mjs +21 -11
- package/agents/update/check-generate-diagram.mjs +69 -14
- package/agents/update/generate-document.yaml +1 -13
- package/agents/update/pre-check-generate-diagram.yaml +44 -0
- package/agents/utils/map-reasoning-effort-level.mjs +15 -0
- package/aigne.yaml +3 -0
- package/package.json +1 -1
- package/prompts/detail/custom/{custom-components.md → custom-components-usage-rules.md} +29 -7
- package/prompts/detail/d2-diagram/pre-check.md +23 -0
- package/prompts/detail/d2-diagram/rules.md +42 -24
- package/prompts/detail/d2-diagram/user-prompt.md +0 -20
- package/prompts/detail/generate/system-prompt.md +2 -2
- package/prompts/detail/generate/user-prompt.md +0 -5
- package/prompts/detail/update/system-prompt.md +3 -2
- package/prompts/detail/update/user-prompt.md +2 -2
- package/utils/constants/index.mjs +32 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.8.15-beta.16](https://github.com/AIGNE-io/aigne-doc-smith/compare/v0.8.15-beta.15...v0.8.15-beta.16) (2025-11-07)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* support customize diagramming quantity ([#277](https://github.com/AIGNE-io/aigne-doc-smith/issues/277)) ([9d9fa6a](https://github.com/AIGNE-io/aigne-doc-smith/commit/9d9fa6a1f344c93df187f2dc502c5479e304e0f4))
|
|
9
|
+
|
|
10
|
+
## [0.8.15-beta.15](https://github.com/AIGNE-io/aigne-doc-smith/compare/v0.8.15-beta.14...v0.8.15-beta.15) (2025-11-07)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* add two-tier thinking effort configuration system ([#273](https://github.com/AIGNE-io/aigne-doc-smith/issues/273)) ([b72d066](https://github.com/AIGNE-io/aigne-doc-smith/commit/b72d066698bae253a9ee2dfa231bf73cd59d7529))
|
|
16
|
+
|
|
3
17
|
## [0.8.15-beta.14](https://github.com/AIGNE-io/aigne-doc-smith/compare/v0.8.15-beta.13...v0.8.15-beta.14) (2025-11-06)
|
|
4
18
|
|
|
5
19
|
|
package/agents/init/index.mjs
CHANGED
|
@@ -4,6 +4,8 @@ import chalk from "chalk";
|
|
|
4
4
|
import { stringify as yamlStringify } from "yaml";
|
|
5
5
|
import { getFilteredOptions } from "../../utils/conflict-detector.mjs";
|
|
6
6
|
import {
|
|
7
|
+
DEFAULT_REASONING_EFFORT_LEVEL,
|
|
8
|
+
DEFAULT_THINKING_EFFORT_LEVEL,
|
|
7
9
|
DEPTH_RECOMMENDATION_LOGIC,
|
|
8
10
|
DOCUMENT_STYLES,
|
|
9
11
|
DOCUMENTATION_DEPTH,
|
|
@@ -22,11 +24,10 @@ import {
|
|
|
22
24
|
} from "../../utils/utils.mjs";
|
|
23
25
|
import { isRemoteFile } from "../../utils/file-utils.mjs";
|
|
24
26
|
import { validateDocDir } from "./validate.mjs";
|
|
27
|
+
import mapReasoningEffortLevel from "../utils/map-reasoning-effort-level.mjs";
|
|
25
28
|
|
|
26
29
|
const _PRESS_ENTER_TO_FINISH = "Press Enter to finish";
|
|
27
30
|
|
|
28
|
-
const DEFAULT_REASONING_EFFORT = 502;
|
|
29
|
-
|
|
30
31
|
/**
|
|
31
32
|
* Guides the user through a multi-turn dialog to generate a YAML configuration file.
|
|
32
33
|
* @param {Object} params
|
|
@@ -37,7 +38,15 @@ const DEFAULT_REASONING_EFFORT = 502;
|
|
|
37
38
|
export default async function init(input, options) {
|
|
38
39
|
const config = await _init(input, options);
|
|
39
40
|
|
|
40
|
-
|
|
41
|
+
// Set thinking effort (lite/standard/pro) and map to reasoningEffort
|
|
42
|
+
options.context.userContext.thinkingEffort =
|
|
43
|
+
config.thinking?.effort || DEFAULT_THINKING_EFFORT_LEVEL;
|
|
44
|
+
|
|
45
|
+
// Set global reasoningEffort based on thinkingEffort
|
|
46
|
+
options.context.userContext.reasoningEffort = mapReasoningEffortLevel(
|
|
47
|
+
{ level: DEFAULT_REASONING_EFFORT_LEVEL },
|
|
48
|
+
options,
|
|
49
|
+
)?.reasoningEffort;
|
|
41
50
|
|
|
42
51
|
return config;
|
|
43
52
|
}
|
|
@@ -398,8 +407,6 @@ async function _init(
|
|
|
398
407
|
input.projectDesc = projectInfo.description;
|
|
399
408
|
input.projectLogo = projectInfo.icon;
|
|
400
409
|
|
|
401
|
-
input.reasoningEffort = DEFAULT_REASONING_EFFORT;
|
|
402
|
-
|
|
403
410
|
// Generate YAML content
|
|
404
411
|
const yamlContent = generateYAML(input, outputPath);
|
|
405
412
|
|
|
@@ -450,7 +457,9 @@ export function generateYAML(input) {
|
|
|
450
457
|
projectDesc: input.projectDesc || "",
|
|
451
458
|
projectLogo: input.projectLogo || "",
|
|
452
459
|
|
|
453
|
-
|
|
460
|
+
thinking: {
|
|
461
|
+
effort: input.thinking?.effort || DEFAULT_THINKING_EFFORT_LEVEL,
|
|
462
|
+
},
|
|
454
463
|
|
|
455
464
|
// Documentation configuration
|
|
456
465
|
documentPurpose: input.documentPurpose || [],
|
|
@@ -488,14 +497,15 @@ export function generateYAML(input) {
|
|
|
488
497
|
yaml += `${projectSection}\n\n`;
|
|
489
498
|
|
|
490
499
|
const modelSection = yamlStringify({
|
|
491
|
-
|
|
500
|
+
thinking: config.thinking,
|
|
492
501
|
}).trim();
|
|
493
502
|
|
|
494
503
|
yaml += `\
|
|
495
|
-
#
|
|
496
|
-
|
|
497
|
-
#
|
|
498
|
-
#
|
|
504
|
+
# AI Thinking Configuration
|
|
505
|
+
# thinking.effort: Determines the depth of reasoning and cognitive effort the AI uses when responding, available options:
|
|
506
|
+
# - lite: Fast responses with basic reasoning
|
|
507
|
+
# - standard: Balanced speed and reasoning capability
|
|
508
|
+
# - pro: In-depth reasoning with longer response times
|
|
499
509
|
${modelSection}
|
|
500
510
|
\n`;
|
|
501
511
|
|
|
@@ -1,27 +1,82 @@
|
|
|
1
|
-
const
|
|
1
|
+
const PLACEHOLDER = "DIAGRAM_PLACEHOLDER";
|
|
2
|
+
const DEFAULT_DIAGRAMMING_EFFORT = 5;
|
|
3
|
+
const MIN_DIAGRAMMING_EFFORT = 0;
|
|
4
|
+
const MAX_DIAGRAMMING_EFFORT = 10;
|
|
2
5
|
|
|
3
6
|
export default async function checkGenerateDiagram(
|
|
4
|
-
{
|
|
7
|
+
{
|
|
8
|
+
documentContent,
|
|
9
|
+
locale,
|
|
10
|
+
feedback,
|
|
11
|
+
detailFeedback,
|
|
12
|
+
originalContent,
|
|
13
|
+
path: docPath,
|
|
14
|
+
diagramming,
|
|
15
|
+
},
|
|
5
16
|
options,
|
|
6
17
|
) {
|
|
7
|
-
|
|
8
|
-
|
|
18
|
+
let content = documentContent;
|
|
19
|
+
let diagramSourceCode;
|
|
20
|
+
let skipGenerateDiagram = false;
|
|
21
|
+
|
|
22
|
+
const preCheckAgent = options.context?.agents?.["preCheckGenerateDiagram"];
|
|
23
|
+
|
|
24
|
+
const preCheckResult = await options.context.invoke(preCheckAgent, {
|
|
25
|
+
documentContent,
|
|
26
|
+
feedback,
|
|
27
|
+
detailFeedback,
|
|
28
|
+
previousGenerationContent: originalContent,
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const totalScore = (preCheckResult.details || []).reduce((acc, curr) => acc + curr.score, 0);
|
|
32
|
+
if (![false, "false", "", undefined, null].includes(preCheckResult.content)) {
|
|
33
|
+
content = preCheckResult.content;
|
|
9
34
|
}
|
|
10
35
|
|
|
11
|
-
|
|
12
|
-
|
|
36
|
+
let diagrammingEffort = diagramming?.effort
|
|
37
|
+
? Number(diagramming?.effort)
|
|
38
|
+
: DEFAULT_DIAGRAMMING_EFFORT;
|
|
13
39
|
|
|
14
|
-
if (
|
|
40
|
+
if (Number.isNaN(diagrammingEffort)) {
|
|
41
|
+
diagrammingEffort = DEFAULT_DIAGRAMMING_EFFORT;
|
|
42
|
+
} else {
|
|
43
|
+
diagrammingEffort = Math.min(
|
|
44
|
+
Math.max(MIN_DIAGRAMMING_EFFORT, diagrammingEffort),
|
|
45
|
+
MAX_DIAGRAMMING_EFFORT,
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (totalScore <= diagrammingEffort) {
|
|
50
|
+
skipGenerateDiagram = true;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (skipGenerateDiagram) {
|
|
54
|
+
content = documentContent;
|
|
55
|
+
} else {
|
|
15
56
|
try {
|
|
16
|
-
const
|
|
17
|
-
|
|
57
|
+
const generateAgent = options.context?.agents?.["generateDiagram"];
|
|
58
|
+
({ diagramSourceCode } = await options.context.invoke(generateAgent, {
|
|
59
|
+
documentContent: content,
|
|
18
60
|
locale,
|
|
19
|
-
});
|
|
20
|
-
content = content.replace(placeholder, diagramSourceCode);
|
|
61
|
+
}));
|
|
21
62
|
} catch (error) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
console.log(`⚠️ Skip generate any diagram: ${error.message}`);
|
|
63
|
+
diagramSourceCode = "";
|
|
64
|
+
skipGenerateDiagram = true;
|
|
65
|
+
console.log(`⚠️ Skip generate any diagram for ${docPath}: ${error.message}`);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (diagramSourceCode && !skipGenerateDiagram) {
|
|
69
|
+
if (content.includes(PLACEHOLDER)) {
|
|
70
|
+
content = content.replace(PLACEHOLDER, diagramSourceCode);
|
|
71
|
+
} else {
|
|
72
|
+
const mergeAgent = options.context?.agents?.["mergeDiagramToDocument"];
|
|
73
|
+
({ content } = await options.context.invoke(mergeAgent, {
|
|
74
|
+
diagramSourceCode,
|
|
75
|
+
content,
|
|
76
|
+
}));
|
|
77
|
+
}
|
|
78
|
+
} else {
|
|
79
|
+
content = documentContent;
|
|
25
80
|
}
|
|
26
81
|
}
|
|
27
82
|
|
|
@@ -46,19 +46,7 @@ input_schema:
|
|
|
46
46
|
- rules
|
|
47
47
|
- detailDataSource
|
|
48
48
|
- originalDocumentStructure
|
|
49
|
-
|
|
50
|
-
output_schema:
|
|
51
|
-
type: object
|
|
52
|
-
properties:
|
|
53
|
-
content:
|
|
54
|
-
type: string
|
|
55
|
-
description: Document content
|
|
56
|
-
needDiagram:
|
|
57
|
-
type: boolean
|
|
58
|
-
description: Does this document need to generate diagram?
|
|
59
|
-
required:
|
|
60
|
-
- content
|
|
61
|
-
- detailDataSource
|
|
49
|
+
output_key: content
|
|
62
50
|
afs:
|
|
63
51
|
modules:
|
|
64
52
|
- module: system-fs
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
name: preCheckGenerateDiagram
|
|
2
|
+
description: Pre-check for generating diagram
|
|
3
|
+
model:
|
|
4
|
+
reasoning_effort: 1
|
|
5
|
+
instructions:
|
|
6
|
+
url: ../../prompts/detail/d2-diagram/pre-check.md
|
|
7
|
+
input_schema:
|
|
8
|
+
type: object
|
|
9
|
+
properties:
|
|
10
|
+
documentContent:
|
|
11
|
+
type: string
|
|
12
|
+
description: Source content of the document
|
|
13
|
+
feedback:
|
|
14
|
+
type: string
|
|
15
|
+
description: User generation feedback
|
|
16
|
+
detailFeedback:
|
|
17
|
+
type: string
|
|
18
|
+
description: Current document detail feedback
|
|
19
|
+
previousGenerationContent:
|
|
20
|
+
type: string
|
|
21
|
+
description: Previous document content
|
|
22
|
+
required:
|
|
23
|
+
- documentContent
|
|
24
|
+
output_schema:
|
|
25
|
+
type: object
|
|
26
|
+
properties:
|
|
27
|
+
content:
|
|
28
|
+
type: string
|
|
29
|
+
description: Document content
|
|
30
|
+
details:
|
|
31
|
+
type: array
|
|
32
|
+
description: Detailed needDiagram score
|
|
33
|
+
items:
|
|
34
|
+
type: object
|
|
35
|
+
properties:
|
|
36
|
+
type:
|
|
37
|
+
type: string
|
|
38
|
+
score:
|
|
39
|
+
type: number
|
|
40
|
+
reason:
|
|
41
|
+
type: string
|
|
42
|
+
required:
|
|
43
|
+
- content
|
|
44
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_REASONING_EFFORT_LEVEL,
|
|
3
|
+
DEFAULT_REASONING_EFFORT_VALUE,
|
|
4
|
+
REASONING_EFFORT_LEVELS,
|
|
5
|
+
} from "../../utils/constants/index.mjs";
|
|
6
|
+
|
|
7
|
+
export default function mapReasoningEffortLevel({ level }, options) {
|
|
8
|
+
const g =
|
|
9
|
+
REASONING_EFFORT_LEVELS[level] || REASONING_EFFORT_LEVELS[DEFAULT_REASONING_EFFORT_LEVEL];
|
|
10
|
+
|
|
11
|
+
return {
|
|
12
|
+
reasoningEffort:
|
|
13
|
+
g[options.context.userContext.thinkingEffort] ?? DEFAULT_REASONING_EFFORT_VALUE,
|
|
14
|
+
};
|
|
15
|
+
}
|
package/aigne.yaml
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env aigne
|
|
2
2
|
|
|
3
3
|
model:
|
|
4
|
+
# model: aignehub/gpt-5
|
|
5
|
+
# model: aignehub/claude-sonnet-4-0
|
|
4
6
|
model: aignehub/gemini-2.5-pro # reasoning_effort 128-32768
|
|
5
7
|
# https://github.com/AIGNE-io/aigne-framework/blob/main/models/gemini/src/gemini-chat-model.ts#L115
|
|
6
8
|
reasoning_effort:
|
|
@@ -101,6 +103,7 @@ agents:
|
|
|
101
103
|
- ./agents/generate/merge-diagram.yaml
|
|
102
104
|
- ./agents/update/generate-diagram.yaml
|
|
103
105
|
- ./agents/update/check-generate-diagram.mjs
|
|
106
|
+
- ./agents/update/pre-check-generate-diagram.yaml
|
|
104
107
|
cli:
|
|
105
108
|
chat: ./agents/chat/index.yaml
|
|
106
109
|
agents:
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<
|
|
1
|
+
<custom_components_usage_rules>
|
|
2
2
|
When generating document details, you can use the following custom components at appropriate locations based on their descriptions and functionality to enhance document presentation:
|
|
3
3
|
|
|
4
4
|
## XCard: Individual link display card
|
|
@@ -48,11 +48,11 @@ Example 1: Inline Markdown formatting in card content
|
|
|
48
48
|
|
|
49
49
|
Example 2: Code block inside card content
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
````md
|
|
52
52
|
<x-card data-title="ctrl_break()" data-icon="lucide:keyboard">
|
|
53
53
|
Creates a listener for "ctrl-break" events.
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
```rust
|
|
56
56
|
use tokio::signal::windows::ctrl_break;
|
|
57
57
|
|
|
58
58
|
#[tokio::main]
|
|
@@ -62,10 +62,11 @@ stream.recv().await;
|
|
|
62
62
|
println!("got ctrl-break");
|
|
63
63
|
Ok(())
|
|
64
64
|
}
|
|
65
|
-
\`\`\`
|
|
66
|
-
</x-card>
|
|
67
65
|
```
|
|
68
66
|
|
|
67
|
+
````
|
|
68
|
+
|
|
69
|
+
|
|
69
70
|
## XCards: Multiple cards container
|
|
70
71
|
|
|
71
72
|
Suitable for displaying multiple links using a card list format, providing a richer and more visually appealing presentation.
|
|
@@ -80,7 +81,7 @@ Suitable for displaying multiple links using a card list format, providing a ric
|
|
|
80
81
|
|
|
81
82
|
### Usage Rules
|
|
82
83
|
|
|
83
|
-
- **Visual Consistency**: All
|
|
84
|
+
- **Visual Consistency**: All `<x-card>` elements within the same `<x-cards>` must maintain visual consistency:
|
|
84
85
|
- It's recommended to always provide data-icon for each card.
|
|
85
86
|
- Or all cards should have data-image.
|
|
86
87
|
- Avoid mixing (some with icons, some with only images).
|
|
@@ -106,6 +107,18 @@ Example 2: Two-column cards with images
|
|
|
106
107
|
</x-cards>
|
|
107
108
|
```
|
|
108
109
|
|
|
110
|
+
Example 3: Replace markdown format multiple links
|
|
111
|
+
|
|
112
|
+
```md
|
|
113
|
+
For more detailed information on specific features, please refer to the following sections:
|
|
114
|
+
|
|
115
|
+
<x-cards data-columns="3">
|
|
116
|
+
<x-card data-title="Using Discussions" data-href="/discussions">Introduce how to use discussions</x-card>
|
|
117
|
+
<x-card data-title="Using the Blog" data-href="/blog">Introduce how to use the Blog</x-card>
|
|
118
|
+
<x-card data-title="Using Chat" data-href="/chat">Introduce how to use Chat</x-card>
|
|
119
|
+
</x-cards>
|
|
120
|
+
```
|
|
121
|
+
|
|
109
122
|
### Bad Examples
|
|
110
123
|
|
|
111
124
|
Example 1: Using a single-column layout (`data-columns="1"`) is not allowed
|
|
@@ -125,6 +138,15 @@ Example 2: Contains only one `<x-card>` (must include multiple cards)
|
|
|
125
138
|
</x-cards>
|
|
126
139
|
```
|
|
127
140
|
|
|
141
|
+
Example 3: Markdown format multiple links
|
|
142
|
+
|
|
143
|
+
```md
|
|
144
|
+
For more detailed information on specific features, please refer to the following sections:
|
|
145
|
+
- [Using Discussions](./discussions.md)
|
|
146
|
+
- [Using the Blog](./blog.md)
|
|
147
|
+
- [Using Chat](./chat.md)
|
|
148
|
+
```
|
|
149
|
+
|
|
128
150
|
## XField: Structured data field
|
|
129
151
|
|
|
130
152
|
Suitable for displaying API parameters, return values, context data, and any structured data with metadata in a clean, organized format. Supports nested structures for complex data types.
|
|
@@ -517,4 +539,4 @@ Example 6: Missing blank line before x-field-group (violates "Spacing Around" ru
|
|
|
517
539
|
</x-field-group>
|
|
518
540
|
```
|
|
519
541
|
|
|
520
|
-
</
|
|
542
|
+
</custom_components_usage_rules>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<document_content>
|
|
2
|
+
{{documentContent}}
|
|
3
|
+
</document_content>
|
|
4
|
+
|
|
5
|
+
{% if feedback %}
|
|
6
|
+
<feedback>
|
|
7
|
+
{{feedback}}
|
|
8
|
+
</feedback>
|
|
9
|
+
{% endif %}
|
|
10
|
+
|
|
11
|
+
{% if detailFeedback %}
|
|
12
|
+
<content_review_feedback>
|
|
13
|
+
{{ detailFeedback }}
|
|
14
|
+
</content_review_feedback>
|
|
15
|
+
{% endif %}
|
|
16
|
+
|
|
17
|
+
{% if previousGenerationContent %}
|
|
18
|
+
<previous_generation_content>
|
|
19
|
+
{{ previousGenerationContent }}
|
|
20
|
+
</previous_generation_content>
|
|
21
|
+
{% endif %}
|
|
22
|
+
|
|
23
|
+
{% include "./rules.md" %}
|
|
@@ -1,26 +1,44 @@
|
|
|
1
1
|
<diagram_generation_rules>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
2
|
+
|
|
3
|
+
You must analyze the provided inputs to determine if a diagram is needed and where to insert a placeholder. You must not generate the diagram itself (e.g., no Mermaid, PlantUML, or other code). You are only deciding and placing the placeholder.
|
|
4
|
+
|
|
5
|
+
## Inputs
|
|
6
|
+
|
|
7
|
+
- `<document_content>`: The main body of text to be evaluated.
|
|
8
|
+
- `<previous_generation_content>`: The content from the previous run, which may contain DIAGRAM_PLACEHOLDER.
|
|
9
|
+
- `<feedback>`: Specific user instructions for this run (e.g., "add a diagram," "remove the diagram").
|
|
10
|
+
- `<content_review_feedback>`: General automated or human feedback on the content.
|
|
11
|
+
|
|
12
|
+
## Scoring conditions
|
|
13
|
+
|
|
14
|
+
- `add`: If `<feedback>` explicitly requests to add a diagram, ignore other conditions, +30000
|
|
15
|
+
- `remove`: If `<feedback>` explicitly requests to remove a diagram, ignore other conditions, -30000
|
|
16
|
+
- `previous-exists`: If `<previous_generation_content>` contains diagram, +21000
|
|
17
|
+
- `path-exclude`: If the document path or filename matches excluded patterns (e.g., `/faq/`, `CHANGELOG`, `release-notes`), -10000
|
|
18
|
+
- `less-words`: If document length <= 200 words AND less than 2 headings, -10000
|
|
19
|
+
- `overview`: If `<document_content>` provides a high-level overview, +3
|
|
20
|
+
- `architectural`: If `<document_content>` contains an architectural description (components/services/layers/modules), +3
|
|
21
|
+
- `workflow`: If `<document_content>` describes a workflow, sequence, user interactions, or data flow, +2
|
|
22
|
+
- `hierarchy`: If `<document_content>` describes a clear hierarchy (linked sub-docs / deeply nested sections), +1
|
|
23
|
+
- `introductory-major`: If `<document_content>` is an introductory page for a major section, +1
|
|
24
|
+
|
|
25
|
+
## Output Requirements
|
|
26
|
+
- `details` is an array. Each element must include:
|
|
27
|
+
- `type`: matched scoring condition's type name
|
|
28
|
+
- `score`: matched scoring condition's score
|
|
29
|
+
- `reason`: text explaining why this scoring condition is matched
|
|
30
|
+
- `content`: `<document_content>` with placeholder inserted
|
|
31
|
+
- Identify the most logical insertion point in the `<document_content>`. (This is often after an introductory paragraph or before a list/section that the diagram will explain).
|
|
32
|
+
- Insert the exact placeholder string: DIAGRAM_PLACEHOLDER
|
|
33
|
+
- Crucially: Adjust the surrounding text to integrate the placeholder smoothly. Add a lead-in sentence.
|
|
34
|
+
- Good example: "The following diagram illustrates this data flow:"
|
|
35
|
+
- Good example: "This architecture is shown in the overview below:"
|
|
36
|
+
- Bad example: (Just inserting the placeholder with no context).
|
|
37
|
+
- Return the modified document content.
|
|
38
|
+
- Keep the original structure of the document, including page headings and hierarchy
|
|
39
|
+
- Only modify parts of the document text to improve the alignment between diagrams and their context
|
|
40
|
+
- The output must not include the `document_content` tag
|
|
41
|
+
- Do not provide any explanations; include only the document content itself
|
|
42
|
+
|
|
26
43
|
</diagram_generation_rules>
|
|
44
|
+
|
|
@@ -12,26 +12,6 @@ Generate a d2 diagram that represents the following document content:
|
|
|
12
12
|
|
|
13
13
|
</user_rules>
|
|
14
14
|
|
|
15
|
-
<diagram_rules>
|
|
16
|
-
|
|
17
|
-
1. Diagram Triggers and Types: Select the most appropriate type when describing the following specific content
|
|
18
|
-
- Architecture Diagram (High-Level)
|
|
19
|
-
- **Trigger**: When the document provides a high-level overview of a system, project, or the overall documentation set.
|
|
20
|
-
- **Content**: Must illustrate the main components, their relationships, and the overall structure.
|
|
21
|
-
- Structural Diagram (Module-Level)
|
|
22
|
-
- **Trigger**: When generating the introductory document for a major section or module.
|
|
23
|
-
- **Content**: Must show the key sub-components, files, or core concepts within that specific module.
|
|
24
|
-
- Process and Interaction Diagrams (Detailed)
|
|
25
|
-
- **Trigger**: When the document describes a workflow, a sequence of events, user interactions, or data flow.
|
|
26
|
-
- **Diagram Type Selection**:
|
|
27
|
-
- **Flowchart**: Use for step-by-step processes, algorithms, or decision-making logic.
|
|
28
|
-
- **Sequence Diagram**: Use for time-ordered interactions between different components or actors (e.g., API calls).
|
|
29
|
-
2. Constraints and Best Practices
|
|
30
|
-
- **Keep it Simple**: Avoid overcomplicating the diagram.
|
|
31
|
-
- **Relevance**: Ensure every diagram **directly** illustrates a concept explained in the surrounding text. Avoid generating diagrams for simple concepts that are easily understood through text alone.
|
|
32
|
-
|
|
33
|
-
</diagram_rules>
|
|
34
|
-
|
|
35
15
|
<document_content>
|
|
36
16
|
{{documentContent}}
|
|
37
17
|
</document_content>
|
|
@@ -37,14 +37,14 @@ Glossary of specialized terms. Please ensure correct spelling when using these t
|
|
|
37
37
|
Documentation content generation rules:
|
|
38
38
|
{% include "./document-rules.md" %}
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
{% include "../custom/custom-components.md" %}
|
|
40
|
+
{% include "../custom/custom-components-usage-rules.md" %}
|
|
42
41
|
|
|
43
42
|
Custom code block generation rules:
|
|
44
43
|
{% include "../custom/custom-code-block.md" %}
|
|
45
44
|
|
|
46
45
|
{% include "../../common/document/media-file-list-usage-rules.md" %}
|
|
47
46
|
|
|
47
|
+
|
|
48
48
|
</content_generation_rules>
|
|
49
49
|
|
|
50
50
|
|
|
@@ -7,12 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
** Output content in {{ locale }} language. **
|
|
9
9
|
|
|
10
|
-
** Don't generate any diagram in the document, give boolean value in `needDiagram` field & plan a placeholder in document content for diagram (use `DIAGRAM_PLACEHOLDER` as placeholder text). **
|
|
11
|
-
- Use the current `<detail_data_source>`, `<content_review_feedback>`, and `<feedback>` to decide whether this document requires a diagram.
|
|
12
|
-
- If `<feedback>` contains a request to add a diagram, set `needDiagram` to true.
|
|
13
|
-
- If `<feedback>` contains a request to remove a diagram, set `needDiagram` to false.
|
|
14
10
|
|
|
15
|
-
- **Necessary**: Generate diagrams only when necessary.
|
|
16
11
|
</user_rules>
|
|
17
12
|
|
|
18
13
|
{% set operation_type = "generating" %}
|
|
@@ -32,14 +32,15 @@ Glossary of specialized terms. Please ensure correct spelling when using these t
|
|
|
32
32
|
Documentation content optimization rules:
|
|
33
33
|
{% include "../generate/document-rules.md" %}
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
{% include "../custom/custom-components.md" %}
|
|
35
|
+
{% include "../custom/custom-components-usage-rules.md" %}
|
|
37
36
|
|
|
38
37
|
Custom code block optimization rules:
|
|
39
38
|
{% include "../custom/custom-code-block.md" %}
|
|
40
39
|
|
|
41
40
|
{% include "../../common/document/media-file-list-usage-rules.md" %}
|
|
42
41
|
|
|
42
|
+
{% include "../d2-diagram/rules.md" %}
|
|
43
|
+
|
|
43
44
|
</content_optimization_rules>
|
|
44
45
|
|
|
45
46
|
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
{% set operation_type = "optimizing" %}
|
|
12
12
|
{% include "../../common/document/user-preferences.md" %}
|
|
13
13
|
|
|
14
|
-
<
|
|
14
|
+
<original_document_content>
|
|
15
15
|
{{originalContent}}
|
|
16
|
-
</
|
|
16
|
+
</original_document_content>
|
|
17
17
|
|
|
18
18
|
{% if needDataSources %}
|
|
19
19
|
<detail_data_source>
|
|
@@ -555,3 +555,35 @@ export const DOC_ACTION = {
|
|
|
555
555
|
update: "update",
|
|
556
556
|
clear: "clear",
|
|
557
557
|
};
|
|
558
|
+
|
|
559
|
+
// Default thinking effort level, available options: 'lite', 'standard', 'pro'
|
|
560
|
+
// This level can be defined by the user in the config file to influence reasoning effort mapping
|
|
561
|
+
export const DEFAULT_THINKING_EFFORT_LEVEL = "standard";
|
|
562
|
+
|
|
563
|
+
// Default reasoning effort level, available options: 'minimal', 'low', 'medium', 'high'
|
|
564
|
+
export const DEFAULT_REASONING_EFFORT_LEVEL = "low";
|
|
565
|
+
|
|
566
|
+
export const DEFAULT_REASONING_EFFORT_VALUE = 500;
|
|
567
|
+
|
|
568
|
+
export const REASONING_EFFORT_LEVELS = {
|
|
569
|
+
minimal: {
|
|
570
|
+
lite: 100,
|
|
571
|
+
standard: 300,
|
|
572
|
+
pro: 500,
|
|
573
|
+
},
|
|
574
|
+
low: {
|
|
575
|
+
lite: 200,
|
|
576
|
+
standard: 500,
|
|
577
|
+
pro: 1000,
|
|
578
|
+
},
|
|
579
|
+
medium: {
|
|
580
|
+
lite: 300,
|
|
581
|
+
standard: 800,
|
|
582
|
+
pro: 1500,
|
|
583
|
+
},
|
|
584
|
+
high: {
|
|
585
|
+
lite: 500,
|
|
586
|
+
standard: 1000,
|
|
587
|
+
pro: 2000,
|
|
588
|
+
},
|
|
589
|
+
};
|