@aigne/doc-smith 0.8.3 → 0.8.5
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/config.yaml +3 -3
- package/.aigne/doc-smith/preferences.yml +58 -12
- package/.aigne/doc-smith/upload-cache.yaml +600 -207
- package/CHANGELOG.md +22 -0
- package/README.md +77 -5
- package/agents/input-generator.mjs +12 -6
- package/agents/publish-docs.mjs +53 -4
- package/docs/_sidebar.md +1 -1
- package/docs/advanced-how-it-works.md +55 -60
- package/docs/advanced-how-it-works.zh.md +60 -65
- package/docs/advanced-quality-assurance.md +73 -38
- package/docs/advanced-quality-assurance.zh.md +73 -38
- package/docs/advanced.md +2 -14
- package/docs/advanced.zh.md +5 -17
- package/docs/changelog.md +41 -4
- package/docs/changelog.zh.md +77 -40
- package/docs/cli-reference.md +79 -13
- package/docs/cli-reference.zh.md +92 -26
- package/docs/configuration-interactive-setup.md +102 -49
- package/docs/configuration-interactive-setup.zh.md +102 -49
- package/docs/configuration-language-support.md +69 -39
- package/docs/configuration-language-support.zh.md +68 -38
- package/docs/configuration-llm-setup.md +25 -62
- package/docs/configuration-llm-setup.zh.md +25 -62
- package/docs/configuration-preferences.md +79 -67
- package/docs/configuration-preferences.zh.md +78 -67
- package/docs/configuration.md +122 -109
- package/docs/configuration.zh.md +130 -117
- package/docs/features-generate-documentation.md +44 -24
- package/docs/features-generate-documentation.zh.md +52 -32
- package/docs/features-publish-your-docs.md +41 -40
- package/docs/features-publish-your-docs.zh.md +50 -49
- package/docs/features-translate-documentation.md +73 -17
- package/docs/features-translate-documentation.zh.md +76 -20
- package/docs/features-update-and-refine.md +72 -21
- package/docs/features-update-and-refine.zh.md +80 -29
- package/docs/features.md +24 -28
- package/docs/features.zh.md +25 -29
- package/docs/getting-started.md +87 -38
- package/docs/getting-started.zh.md +88 -39
- package/docs/overview.md +17 -35
- package/docs/overview.zh.md +18 -36
- package/package.json +9 -8
- package/prompts/content-detail-generator.md +1 -0
- package/prompts/document/custom-code-block.md +101 -0
- package/prompts/document/d2-chart/rules.md +941 -1031
- package/prompts/document/detail-generator.md +7 -53
- package/tests/input-generator.test.mjs +2 -2
- package/tests/kroki-utils.test.mjs +88 -17
- package/utils/auth-utils.mjs +9 -2
- package/utils/blocklet.mjs +25 -6
- package/utils/constants.mjs +17 -1
- package/utils/deploy.mjs +404 -0
- package/utils/kroki-utils.mjs +22 -14
- package/utils/markdown-checker.mjs +1 -1
- package/utils/utils.mjs +3 -2
- package/prompts/document/d2-chart/diy-examples.md +0 -44
- package/prompts/document/d2-chart/shape-rules.md +0 -182
|
@@ -1,90 +1,53 @@
|
|
|
1
|
-
---
|
|
2
|
-
labels: ["Reference"]
|
|
3
|
-
---
|
|
4
|
-
|
|
5
1
|
# LLM Setup
|
|
6
2
|
|
|
7
|
-
AIGNE DocSmith
|
|
8
|
-
|
|
9
|
-
This guide will walk you through both options.
|
|
10
|
-
|
|
11
|
-
## Using AIGNE Hub (Recommended)
|
|
3
|
+
AIGNE DocSmith uses Large Language Models (LLMs) to generate documentation content. The tool provides two primary methods for configuring your AI model provider: using the integrated AIGNE Hub for a streamlined experience, or connecting your own custom API keys for direct provider access.
|
|
12
4
|
|
|
13
|
-
|
|
5
|
+
## AIGNE Hub (Recommended)
|
|
14
6
|
|
|
15
|
-
|
|
16
|
-
- **Easy Model Switching:** You can switch between different state-of-the-art models from providers like Google, Anthropic, and OpenAI with a simple command-line flag.
|
|
7
|
+
The simplest way to get started is with AIGNE Hub. It acts as a gateway to multiple LLM providers, offering two key advantages:
|
|
17
8
|
|
|
18
|
-
|
|
9
|
+
- **No API Key Required:** Generate documents without needing to manage your own API keys or service subscriptions.
|
|
10
|
+
- **Easy Model Switching:** Change the AI model for any command using a simple flag.
|
|
19
11
|
|
|
20
|
-
|
|
12
|
+
To use a specific model through AIGNE Hub, add the `--model` flag to your command. Here are a few examples:
|
|
21
13
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
**Using Google's Gemini 1.5 Flash:**
|
|
25
|
-
```bash
|
|
14
|
+
```bash Use Google's Gemini 2.5 Flash model
|
|
26
15
|
aigne doc generate --model google:gemini-2.5-flash
|
|
27
|
-
```
|
|
28
16
|
|
|
29
|
-
|
|
30
|
-
```bash
|
|
17
|
+
# Use Anthropic's Claude 3.5 Sonnet model
|
|
31
18
|
aigne doc generate --model claude:claude-3-5-sonnet
|
|
32
|
-
```
|
|
33
19
|
|
|
34
|
-
|
|
35
|
-
```bash
|
|
20
|
+
# Use OpenAI's GPT-4o model
|
|
36
21
|
aigne doc generate --model openai:gpt-4o
|
|
37
22
|
```
|
|
38
23
|
|
|
39
|
-
|
|
24
|
+
If you don't specify a model, DocSmith will use the default model defined in your project's configuration.
|
|
25
|
+
|
|
26
|
+
## Using Custom API Keys
|
|
40
27
|
|
|
41
|
-
If you prefer to use your own
|
|
28
|
+
If you prefer to use your own accounts with providers like OpenAI or Anthropic, you can configure DocSmith with your personal API keys. This gives you direct control over API usage and billing.
|
|
42
29
|
|
|
43
|
-
|
|
30
|
+
Configuration is handled through an interactive wizard. To launch it, run:
|
|
44
31
|
|
|
45
32
|
```bash
|
|
46
|
-
# Launch the interactive configuration wizard
|
|
47
33
|
aigne doc init
|
|
48
34
|
```
|
|
49
35
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
## How It Works
|
|
53
|
-
|
|
54
|
-
The following diagram illustrates how DocSmith processes requests with different LLM configurations.
|
|
55
|
-
|
|
56
|
-
```d2
|
|
57
|
-
direction: down
|
|
36
|
+
The wizard will prompt you to select your provider and enter your credentials. For a complete guide, please see the [Interactive Setup](./configuration-interactive-setup.md) documentation.
|
|
58
37
|
|
|
59
|
-
|
|
60
|
-
shape: person
|
|
61
|
-
label: "Developer"
|
|
62
|
-
}
|
|
38
|
+
## Setting a Default Model
|
|
63
39
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
DocSmith: {
|
|
67
|
-
shape: package
|
|
68
|
-
"Configuration Check": {
|
|
69
|
-
"AIGNE Hub (Default)": "No API Key Needed"
|
|
70
|
-
"Custom Provider": "User API Key Found"
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
LLM_Providers: {
|
|
75
|
-
label: "LLM Providers"
|
|
76
|
-
shape: cloud
|
|
77
|
-
"AIGNE Hub": "Manages access to multiple models"
|
|
78
|
-
"Direct API (e.g., OpenAI)": "Uses custom key"
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
User -> CLI: "Runs command"
|
|
82
|
-
CLI -> DocSmith: "Initiates process"
|
|
83
|
-
DocSmith."Configuration Check"."AIGNE Hub (Default)" -> LLM_Providers."AIGNE Hub" : "Routes request via Hub"
|
|
84
|
-
DocSmith."Configuration Check"."Custom Provider" -> LLM_Providers."Direct API (e.g., OpenAI)" : "Routes request with user's key"
|
|
40
|
+
To ensure consistency across all documentation generation tasks, you can set a default LLM in your project's `aigne.yaml` configuration file. This model will be used automatically unless you override it with the `--model` flag.
|
|
85
41
|
|
|
42
|
+
```yaml aigne.yaml icon=mdi:file-document
|
|
43
|
+
chat_model:
|
|
44
|
+
provider: google
|
|
45
|
+
name: gemini-2.5-pro
|
|
46
|
+
temperature: 0.8
|
|
86
47
|
```
|
|
87
48
|
|
|
49
|
+
In this configuration, DocSmith defaults to using Google's `gemini-2.5-pro` model with a `temperature` of `0.8` for all generation tasks.
|
|
50
|
+
|
|
88
51
|
---
|
|
89
52
|
|
|
90
|
-
|
|
53
|
+
Now that your LLM provider is configured, you can explore how to manage translations for your documentation. Proceed to the [Language Support](./configuration-language-support.md) guide to see the full list of supported languages and learn how to enable them.
|
|
@@ -1,90 +1,53 @@
|
|
|
1
|
-
---
|
|
2
|
-
labels: ["Reference"]
|
|
3
|
-
---
|
|
4
|
-
|
|
5
1
|
# LLM 设置
|
|
6
2
|
|
|
7
|
-
AIGNE DocSmith
|
|
8
|
-
|
|
9
|
-
本指南将引导你了解这两种选项。
|
|
10
|
-
|
|
11
|
-
## 使用 AIGNE Hub (推荐)
|
|
3
|
+
AIGNE DocSmith 使用大型语言模型 (LLMs) 生成文档内容。该工具提供两种配置 AI 模型提供商的主要方法:使用集成的 AIGNE Hub 以获得简化的体验,或连接你自己的自定义 API 密钥以直接访问提供商。
|
|
12
4
|
|
|
13
|
-
|
|
5
|
+
## AIGNE Hub (推荐)
|
|
14
6
|
|
|
15
|
-
|
|
16
|
-
- **轻松切换模型:** 你可以通过一个简单的命令行标志,在 Google、Anthropic 和 OpenAI 等提供商提供的不同顶尖模型之间进行切换。
|
|
7
|
+
最简单的入门方法是使用 AIGNE Hub。它充当多个 LLM 提供商的网关,提供两大关键优势:
|
|
17
8
|
|
|
18
|
-
|
|
9
|
+
- **无需 API 密钥:** 无需管理自己的 API 密钥或服务订阅即可生成文档。
|
|
10
|
+
- **轻松切换模型:** 使用一个简单的标志即可为任何命令更改 AI 模型。
|
|
19
11
|
|
|
20
|
-
|
|
12
|
+
要通过 AIGNE Hub 使用特定模型,请在命令中添加 `--model` 标志。以下是一些示例:
|
|
21
13
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
**使用 Google 的 Gemini 1.5 Flash:**
|
|
25
|
-
```bash
|
|
14
|
+
```bash 使用 Google 的 Gemini 2.5 Flash 模型
|
|
26
15
|
aigne doc generate --model google:gemini-2.5-flash
|
|
27
|
-
```
|
|
28
16
|
|
|
29
|
-
|
|
30
|
-
```bash
|
|
17
|
+
# 使用 Anthropic 的 Claude 3.5 Sonnet 模型
|
|
31
18
|
aigne doc generate --model claude:claude-3-5-sonnet
|
|
32
|
-
```
|
|
33
19
|
|
|
34
|
-
|
|
35
|
-
```bash
|
|
20
|
+
# 使用 OpenAI 的 GPT-4o 模型
|
|
36
21
|
aigne doc generate --model openai:gpt-4o
|
|
37
22
|
```
|
|
38
23
|
|
|
39
|
-
|
|
24
|
+
如果不指定模型,DocSmith 将使用项目配置中定义的默认模型。
|
|
25
|
+
|
|
26
|
+
## 使用自定义 API 密钥
|
|
40
27
|
|
|
41
|
-
|
|
28
|
+
如果你更喜欢使用自己在 OpenAI 或 Anthropic 等提供商处的账户,可以用个人 API 密钥来配置 DocSmith。这样你就可以直接控制 API 的使用和计费。
|
|
42
29
|
|
|
43
|
-
|
|
30
|
+
配置通过交互式向导完成。运行以下命令以启动它:
|
|
44
31
|
|
|
45
32
|
```bash
|
|
46
|
-
# 启动交互式配置向导
|
|
47
33
|
aigne doc init
|
|
48
34
|
```
|
|
49
35
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
## 工作原理
|
|
53
|
-
|
|
54
|
-
下图说明了 DocSmith 在不同 LLM 配置下处理请求的流程。
|
|
55
|
-
|
|
56
|
-
```d2
|
|
57
|
-
direction: down
|
|
36
|
+
该向导将提示你选择提供商并输入凭据。有关完整指南,请参阅 [交互式设置](./configuration-interactive-setup.md) 文档。
|
|
58
37
|
|
|
59
|
-
|
|
60
|
-
shape: person
|
|
61
|
-
label: "开发者"
|
|
62
|
-
}
|
|
38
|
+
## 设置默认模型
|
|
63
39
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
DocSmith: {
|
|
67
|
-
shape: package
|
|
68
|
-
"配置检查": {
|
|
69
|
-
"AIGNE Hub (默认)": "无需 API 密钥"
|
|
70
|
-
"自定义提供商": "找到用户 API 密钥"
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
LLM_Providers: {
|
|
75
|
-
label: "LLM 提供商"
|
|
76
|
-
shape: cloud
|
|
77
|
-
"AIGNE Hub": "管理对多个模型的访问"
|
|
78
|
-
"直接 API (例如 OpenAI)": "使用自定义密钥"
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
User -> CLI: "运行命令"
|
|
82
|
-
CLI -> DocSmith: "启动流程"
|
|
83
|
-
DocSmith."配置检查"."AIGNE Hub (默认)" -> LLM_Providers."AIGNE Hub" : "通过 Hub 路由请求"
|
|
84
|
-
DocSmith."配置检查"."自定义提供商" -> LLM_Providers."直接 API (例如 OpenAI)" : "使用用户密钥路由请求"
|
|
40
|
+
为确保所有文档生成任务的一致性,你可以在项目的 `aigne.yaml` 配置文件中设置默认的 LLM。除非使用 `--model` 标志覆盖,否则将自动使用此模型。
|
|
85
41
|
|
|
42
|
+
```yaml aigne.yaml icon=mdi:file-document
|
|
43
|
+
chat_model:
|
|
44
|
+
provider: google
|
|
45
|
+
name: gemini-2.5-pro
|
|
46
|
+
temperature: 0.8
|
|
86
47
|
```
|
|
87
48
|
|
|
49
|
+
在此配置中,DocSmith 默认对所有生成任务使用 Google 的 `gemini-2.5-pro` 模型,并将 `temperature` 设置为 `0.8`。
|
|
50
|
+
|
|
88
51
|
---
|
|
89
52
|
|
|
90
|
-
|
|
53
|
+
既然你的 LLM 提供商已配置完毕,你可以探索如何管理文档的翻译。请继续阅读 [语言支持](./configuration-language-support.md) 指南,查看支持的语言完整列表并了解如何启用它们。
|
|
@@ -1,60 +1,86 @@
|
|
|
1
|
-
---
|
|
2
|
-
labels: ["Reference"]
|
|
3
|
-
---
|
|
4
|
-
|
|
5
1
|
# Managing Preferences
|
|
6
2
|
|
|
7
|
-
DocSmith is designed to learn from your feedback. When you refine
|
|
3
|
+
AIGNE DocSmith is designed to learn from your feedback. When you refine or correct generated content, DocSmith can convert that feedback into persistent rules, called preferences. These rules ensure that your specific style, structural requirements, and content policies are applied consistently in future documentation tasks. All preferences are stored in a human-readable YAML file located at `.aigne/doc-smith/preferences.yml` in your project root.
|
|
8
4
|
|
|
9
|
-
|
|
5
|
+
## The Preference Lifecycle
|
|
10
6
|
|
|
11
|
-
|
|
7
|
+
The following diagram illustrates how your feedback becomes a reusable rule that can be applied to future tasks and managed via the command line.
|
|
12
8
|
|
|
13
|
-
|
|
9
|
+
```d2 The Preference Lifecycle
|
|
10
|
+
direction: down
|
|
14
11
|
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
feedback: {
|
|
13
|
+
label: "1. User provides feedback\nduring 'refine' or 'translate'"
|
|
14
|
+
shape: rectangle
|
|
15
|
+
}
|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
refiner: {
|
|
18
|
+
label: "2. Feedback Refiner Agent\nAnalyzes feedback"
|
|
19
|
+
shape: rectangle
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
decision: {
|
|
23
|
+
label: "Is it a reusable policy?"
|
|
24
|
+
shape: diamond
|
|
25
|
+
}
|
|
23
26
|
|
|
24
|
-
|
|
27
|
+
pref_file: {
|
|
28
|
+
label: "3. preferences.yml\nRule is saved"
|
|
29
|
+
shape: cylinder
|
|
30
|
+
}
|
|
25
31
|
|
|
26
|
-
|
|
27
|
-
|
|
32
|
+
future_tasks: {
|
|
33
|
+
label: "4. Future Tasks\nSaved rules are applied"
|
|
34
|
+
shape: rectangle
|
|
28
35
|
}
|
|
29
36
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
style.animated: true
|
|
37
|
+
cli: {
|
|
38
|
+
label: "5. CLI Management\n('aigne doc prefs')"
|
|
39
|
+
shape: rectangle
|
|
34
40
|
}
|
|
35
41
|
|
|
42
|
+
feedback -> refiner: "Input"
|
|
43
|
+
refiner -> decision: "Analyzes"
|
|
44
|
+
decision -> pref_file: "Yes"
|
|
45
|
+
decision -> "Discard (One-time fix)": "No"
|
|
46
|
+
pref_file -> future_tasks: "Applies to"
|
|
47
|
+
cli <-> pref_file: "Manages"
|
|
48
|
+
|
|
36
49
|
```
|
|
37
50
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
51
|
+
### How DocSmith Learns from Feedback
|
|
52
|
+
|
|
53
|
+
When you provide feedback during the `refine` or `translate` stages, an internal agent called the 'Feedback Refiner' analyzes your input. Its goal is to distinguish between a one-time fix (e.g., correcting a typo) and a reusable policy (e.g., "always write code comments in English"). If it determines the feedback represents a lasting instruction, it creates a new preference rule.
|
|
54
|
+
|
|
55
|
+
Each rule has several key properties that define its behavior:
|
|
56
|
+
|
|
57
|
+
| Property | Description |
|
|
58
|
+
|---|---|
|
|
59
|
+
| **id** | A unique identifier for the rule (e.g., `pref_a1b2c3d4`). |
|
|
60
|
+
| **active** | A boolean (`true`/`false`) indicating if the rule is currently enabled. |
|
|
61
|
+
| **scope** | Defines when the rule should be applied: `global`, `structure`, `document`, or `translation`. |
|
|
62
|
+
| **rule** | The instruction that will be passed to the AI in future tasks. |
|
|
63
|
+
| **feedback** | The original natural language feedback you provided. |
|
|
64
|
+
| **createdAt** | The ISO 8601 timestamp of when the rule was created. |
|
|
65
|
+
| **paths** | An optional list of file paths. If present, the rule only applies to content generated for those specific paths. |
|
|
42
66
|
|
|
43
|
-
## Managing Preferences via CLI
|
|
67
|
+
## Managing Preferences via the CLI
|
|
44
68
|
|
|
45
|
-
|
|
69
|
+
You can view and manage all your saved preferences using the `aigne doc prefs` command. This allows you to list, activate, deactivate, or permanently remove rules.
|
|
46
70
|
|
|
47
|
-
###
|
|
71
|
+
### Listing All Preferences
|
|
48
72
|
|
|
49
|
-
To see
|
|
73
|
+
To see all saved preferences, both active and inactive, use the `--list` flag.
|
|
50
74
|
|
|
51
|
-
```bash
|
|
75
|
+
```bash List all preferences icon=lucide:terminal
|
|
52
76
|
aigne doc prefs --list
|
|
53
77
|
```
|
|
54
78
|
|
|
55
|
-
The
|
|
79
|
+
The command displays a formatted list explaining the status, scope, ID, and any path limitations for each rule.
|
|
56
80
|
|
|
57
|
-
|
|
81
|
+
**Example Output:**
|
|
82
|
+
|
|
83
|
+
```text Example Output icon=lucide:clipboard-list
|
|
58
84
|
# User Preferences
|
|
59
85
|
|
|
60
86
|
**Format explanation:**
|
|
@@ -63,60 +89,46 @@ The output provides a clear overview of each rule:
|
|
|
63
89
|
- ID = Unique preference identifier
|
|
64
90
|
- Paths = Specific file paths (if applicable)
|
|
65
91
|
|
|
66
|
-
🟢 [
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
⚪ [
|
|
70
|
-
|
|
92
|
+
🟢 [structure] pref_a1b2c3d4e5f6g7h8 | Paths: overview.md
|
|
93
|
+
Add a 'Next Steps' section at the end of overview documents.
|
|
94
|
+
|
|
95
|
+
⚪ [document] pref_i9j0k1l2m3n4o5p6
|
|
96
|
+
Code comments must be written in English.
|
|
97
|
+
|
|
71
98
|
```
|
|
72
99
|
|
|
73
|
-
|
|
74
|
-
- **Scope**: Indicates where the rule applies (e.g., `translation`, `structure`).
|
|
75
|
-
- **ID**: A unique identifier used to manage the rule.
|
|
76
|
-
- **Paths**: If a rule is limited to specific files, they will be listed here.
|
|
77
|
-
|
|
78
|
-
### Toggle Preference Status
|
|
79
|
-
|
|
80
|
-
You can activate or deactivate preferences using the `--toggle` flag. This is useful for temporarily disabling a rule without deleting it permanently.
|
|
100
|
+
### Toggling Preference Status
|
|
81
101
|
|
|
82
|
-
|
|
102
|
+
If you want to temporarily disable a rule without deleting it, you can toggle its active status. Use the `--toggle` flag.
|
|
83
103
|
|
|
84
|
-
|
|
104
|
+
Running the command without an ID will launch an interactive mode, allowing you to select one or more preferences to toggle:
|
|
85
105
|
|
|
86
|
-
```bash
|
|
106
|
+
```bash Toggle preferences interactively icon=lucide:terminal
|
|
87
107
|
aigne doc prefs --toggle
|
|
88
108
|
```
|
|
89
109
|
|
|
90
|
-
|
|
110
|
+
To toggle specific rules directly, provide their IDs using the `--id` flag:
|
|
91
111
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
```bash
|
|
95
|
-
aigne doc prefs --toggle --id pref_5e6f7g8h
|
|
112
|
+
```bash Toggle a specific preference icon=lucide:terminal
|
|
113
|
+
aigne doc prefs --toggle --id pref_i9j0k1l2m3n4o5p6
|
|
96
114
|
```
|
|
97
115
|
|
|
98
|
-
###
|
|
99
|
-
|
|
100
|
-
To permanently delete one or more preferences, use the `--remove` flag.
|
|
116
|
+
### Removing Preferences
|
|
101
117
|
|
|
102
|
-
|
|
118
|
+
To permanently delete one or more preferences, use the `--remove` flag. This action cannot be undone.
|
|
103
119
|
|
|
104
|
-
|
|
120
|
+
For an interactive selection prompt, run the command without an ID:
|
|
105
121
|
|
|
106
|
-
```bash
|
|
122
|
+
```bash Remove preferences interactively icon=lucide:terminal
|
|
107
123
|
aigne doc prefs --remove
|
|
108
124
|
```
|
|
109
125
|
|
|
110
|
-
|
|
126
|
+
To remove specific rules directly by their ID, use the `--id` flag:
|
|
111
127
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
```bash
|
|
115
|
-
aigne doc prefs --remove --id pref_1a2b3c4d
|
|
128
|
+
```bash Remove a specific preference icon=lucide:terminal
|
|
129
|
+
aigne doc prefs --remove --id pref_a1b2c3d4e5f6g7h8
|
|
116
130
|
```
|
|
117
131
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
---
|
|
132
|
+
## Next Steps
|
|
121
133
|
|
|
122
|
-
|
|
134
|
+
Managing preferences is a key part of tailoring DocSmith to your project's specific needs. For more customization options, explore the main [Configuration Guide](./configuration.md).
|
|
@@ -1,123 +1,134 @@
|
|
|
1
|
-
---
|
|
2
|
-
labels: ["Reference"]
|
|
3
|
-
---
|
|
4
|
-
|
|
5
1
|
# 管理偏好
|
|
6
2
|
|
|
7
|
-
DocSmith
|
|
3
|
+
AIGNE DocSmith 旨在从您的反馈中学习。当您优化或更正生成的内容时,DocSmith 可以将这些反馈转化为持久性规则,即偏好。这些规则确保您特定的风格、结构要求和内容策略在未来的文档任务中得到一致应用。所有偏好都存储在项目根目录下 `.aigne/doc-smith/preferences.yml` 文件中,该文件为人类可读的 YAML 格式。
|
|
8
4
|
|
|
9
|
-
|
|
5
|
+
## 偏好生命周期
|
|
10
6
|
|
|
11
|
-
|
|
7
|
+
下图说明了您的反馈如何成为一个可重用的规则,该规则可应用于未来的任务,并通过命令行进行管理。
|
|
12
8
|
|
|
13
|
-
|
|
9
|
+
```d2 偏好生命周期
|
|
10
|
+
direction: down
|
|
14
11
|
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
feedback: {
|
|
13
|
+
label: "1. 用户在 'refine' 或 'translate' 期间\n提供反馈"
|
|
14
|
+
shape: rectangle
|
|
15
|
+
}
|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
refiner: {
|
|
18
|
+
label: "2. Feedback Refiner Agent\n分析反馈"
|
|
19
|
+
shape: rectangle
|
|
21
20
|
}
|
|
22
21
|
|
|
23
|
-
|
|
22
|
+
decision: {
|
|
23
|
+
label: "这是一个可重用的策略吗?"
|
|
24
|
+
shape: diamond
|
|
25
|
+
}
|
|
24
26
|
|
|
25
|
-
|
|
27
|
+
pref_file: {
|
|
28
|
+
label: "3. preferences.yml\n规则已保存"
|
|
29
|
+
shape: cylinder
|
|
30
|
+
}
|
|
26
31
|
|
|
27
|
-
|
|
28
|
-
|
|
32
|
+
future_tasks: {
|
|
33
|
+
label: "4. 未来的任务\n应用已保存的规则"
|
|
34
|
+
shape: rectangle
|
|
29
35
|
}
|
|
30
36
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
style.animated: true
|
|
37
|
+
cli: {
|
|
38
|
+
label: "5. CLI 管理\n('aigne doc prefs')"
|
|
39
|
+
shape: rectangle
|
|
35
40
|
}
|
|
36
41
|
|
|
42
|
+
feedback -> refiner: "输入"
|
|
43
|
+
refiner -> decision: "分析"
|
|
44
|
+
decision -> pref_file: "是"
|
|
45
|
+
decision -> "丢弃(一次性修复)": "否"
|
|
46
|
+
pref_file -> future_tasks: "应用于"
|
|
47
|
+
cli <-> pref_file: "管理"
|
|
48
|
+
|
|
37
49
|
```
|
|
38
50
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
51
|
+
### DocSmith 如何从反馈中学习
|
|
52
|
+
|
|
53
|
+
当您在 `refine` 或 `translate` 阶段提供反馈时,一个名为 'Feedback Refiner' 的内部 Agent 会分析您的输入。其目标是区分一次性修复(例如,更正拼写错误)和可重用策略(例如,“始终用英语编写代码注释”)。如果它确定反馈代表一个持久性指令,就会创建一个新的偏好规则。
|
|
54
|
+
|
|
55
|
+
每个规则都有几个关键属性来定义其行为:
|
|
56
|
+
|
|
57
|
+
| 属性 | 描述 |
|
|
58
|
+
|---|---|
|
|
59
|
+
| **id** | 规则的唯一标识符(例如,`pref_a1b2c3d4`)。 |
|
|
60
|
+
| **active** | 一个布尔值(`true`/`false`),指示规则当前是否已启用。 |
|
|
61
|
+
| **scope** | 定义规则的应用时机:`global`、`structure`、`document` 或 `translation`。 |
|
|
62
|
+
| **rule** | 将在未来任务中传递给 AI 的指令。 |
|
|
63
|
+
| **feedback** | 您提供的原始自然语言反馈。 |
|
|
64
|
+
| **createdAt** | 规则创建时的 ISO 8601 时间戳。 |
|
|
65
|
+
| **paths** | 一个可选的文件路径列表。如果存在,该规则仅适用于为这些特定路径生成的内容。 |
|
|
43
66
|
|
|
44
67
|
## 通过 CLI 管理偏好
|
|
45
68
|
|
|
46
|
-
`aigne doc prefs`
|
|
69
|
+
您可以使用 `aigne doc prefs` 命令查看和管理所有已保存的偏好。这允许您列出、激活、停用或永久删除规则。
|
|
47
70
|
|
|
48
71
|
### 列出所有偏好
|
|
49
72
|
|
|
50
|
-
|
|
73
|
+
要查看所有已保存的偏好(包括活动和非活动的),请使用 `--list` 标志。
|
|
51
74
|
|
|
52
|
-
```bash
|
|
75
|
+
```bash 列出所有偏好 icon=lucide:terminal
|
|
53
76
|
aigne doc prefs --list
|
|
54
77
|
```
|
|
55
78
|
|
|
56
|
-
|
|
79
|
+
该命令会显示一个格式化列表,解释每个规则的状态、范围、ID 以及任何路径限制。
|
|
57
80
|
|
|
58
|
-
|
|
81
|
+
**示例输出:**
|
|
82
|
+
|
|
83
|
+
```text 示例输出 icon=lucide:clipboard-list
|
|
59
84
|
# 用户偏好
|
|
60
85
|
|
|
61
86
|
**格式说明:**
|
|
62
87
|
- 🟢 = 活动偏好, ⚪ = 非活动偏好
|
|
63
|
-
- [scope] =
|
|
64
|
-
- ID =
|
|
88
|
+
- [scope] = 偏好范围 (global, structure, document, translation)
|
|
89
|
+
- ID = 偏好唯一标识符
|
|
65
90
|
- Paths = 特定文件路径 (如果适用)
|
|
66
91
|
|
|
67
|
-
🟢 [
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
⚪ [
|
|
71
|
-
|
|
92
|
+
🟢 [structure] pref_a1b2c3d4e5f6g7h8 | Paths: overview.md
|
|
93
|
+
在概览文档末尾添加一个 'Next Steps' 部分。
|
|
94
|
+
|
|
95
|
+
⚪ [document] pref_i9j0k1l2m3n4o5p6
|
|
96
|
+
代码注释必须用英语编写。
|
|
97
|
+
|
|
72
98
|
```
|
|
73
99
|
|
|
74
|
-
- **状态 (🟢 / ⚪)**:显示规则当前是活动还是非活动状态。
|
|
75
|
-
- **作用域**:指明规则的应用范围(例如,`translation`、`structure`)。
|
|
76
|
-
- **ID**:用于管理规则的唯一标识符。
|
|
77
|
-
- **路径**:如果规则仅限于特定文件,这些文件将在此处列出。
|
|
78
|
-
|
|
79
100
|
### 切换偏好状态
|
|
80
101
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
**交互模式**
|
|
102
|
+
如果您想临时禁用某个规则而不删除它,可以切换其活动状态。请使用 `--toggle` 标志。
|
|
84
103
|
|
|
85
|
-
|
|
104
|
+
不带 ID 运行该命令将启动交互模式,允许您选择一个或多个要切换的偏好:
|
|
86
105
|
|
|
87
|
-
```bash
|
|
106
|
+
```bash 以交互方式切换偏好 icon=lucide:terminal
|
|
88
107
|
aigne doc prefs --toggle
|
|
89
108
|
```
|
|
90
109
|
|
|
91
|
-
|
|
110
|
+
要直接切换特定规则,请使用 `--id` 标志提供其 ID:
|
|
92
111
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
```bash
|
|
96
|
-
aigne doc prefs --toggle --id pref_5e6f7g8h
|
|
112
|
+
```bash 切换特定偏好 icon=lucide:terminal
|
|
113
|
+
aigne doc prefs --toggle --id pref_i9j0k1l2m3n4o5p6
|
|
97
114
|
```
|
|
98
115
|
|
|
99
|
-
###
|
|
100
|
-
|
|
101
|
-
要永久删除一个或多个偏好,请使用 `--remove` 标志。
|
|
116
|
+
### 移除偏好
|
|
102
117
|
|
|
103
|
-
|
|
118
|
+
要永久删除一个或多个偏好,请使用 `--remove` 标志。此操作无法撤销。
|
|
104
119
|
|
|
105
|
-
|
|
120
|
+
要进入交互式选择提示,请不带 ID 运行该命令:
|
|
106
121
|
|
|
107
|
-
```bash
|
|
122
|
+
```bash 以交互方式移除偏好 icon=lucide:terminal
|
|
108
123
|
aigne doc prefs --remove
|
|
109
124
|
```
|
|
110
125
|
|
|
111
|
-
|
|
126
|
+
要通过 ID 直接移除特定规则,请使用 `--id` 标志:
|
|
112
127
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
```bash
|
|
116
|
-
aigne doc prefs --remove --id pref_1a2b3c4d
|
|
128
|
+
```bash 移除特定偏好 icon=lucide:terminal
|
|
129
|
+
aigne doc prefs --remove --id pref_a1b2c3d4e5f6g7h8
|
|
117
130
|
```
|
|
118
131
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
---
|
|
132
|
+
## 后续步骤
|
|
122
133
|
|
|
123
|
-
|
|
134
|
+
管理偏好是根据项目特定需求定制 DocSmith 的关键部分。要了解更多自定义选项,请查阅主要的[配置指南](./configuration.md)。
|