@aigne/doc-smith 0.8.11-beta.6 → 0.8.11
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 +2 -0
- package/.aigne/doc-smith/output/structure-plan.json +2 -2
- package/.aigne/doc-smith/preferences.yml +28 -20
- package/.aigne/doc-smith/upload-cache.yaml +702 -0
- package/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +20 -0
- package/README.md +1 -1
- package/agents/generate/document-structure-tools/add-document.mjs +35 -10
- package/agents/generate/document-structure-tools/delete-document.mjs +35 -12
- package/agents/generate/document-structure-tools/move-document.mjs +43 -17
- package/agents/generate/document-structure-tools/update-document.mjs +37 -10
- package/agents/generate/update-document-structure.yaml +1 -7
- package/agents/generate/user-review-document-structure.mjs +5 -4
- package/agents/translate/translate-document.yaml +1 -9
- package/agents/update/check-update-is-single.mjs +2 -1
- package/agents/update/document-tools/update-document-content.mjs +24 -14
- package/agents/update/fs-tools/glob.mjs +184 -0
- package/agents/update/fs-tools/grep.mjs +317 -0
- package/agents/update/fs-tools/read-file.mjs +307 -0
- package/agents/update/generate-document.yaml +4 -7
- package/agents/update/update-document-detail.yaml +6 -10
- package/agents/update/user-review-document.mjs +13 -13
- package/assets/screenshots/doc-complete-setup.png +0 -0
- package/assets/screenshots/doc-generate-docs.png +0 -0
- package/assets/screenshots/doc-generate.png +0 -0
- package/assets/screenshots/doc-generated-successfully.png +0 -0
- package/assets/screenshots/doc-publish.png +0 -0
- package/assets/screenshots/doc-regenerate.png +0 -0
- package/assets/screenshots/doc-translate-langs.png +0 -0
- package/assets/screenshots/doc-translate.png +0 -0
- package/assets/screenshots/doc-update.png +0 -0
- package/docs/advanced-how-it-works.ja.md +31 -31
- package/docs/advanced-how-it-works.md +9 -9
- package/docs/advanced-how-it-works.zh-TW.md +24 -24
- package/docs/advanced-how-it-works.zh.md +20 -20
- package/docs/advanced-quality-assurance.ja.md +57 -61
- package/docs/advanced-quality-assurance.md +57 -61
- package/docs/advanced-quality-assurance.zh-TW.md +57 -61
- package/docs/advanced-quality-assurance.zh.md +57 -61
- package/docs/advanced.ja.md +8 -4
- package/docs/advanced.md +7 -3
- package/docs/advanced.zh-TW.md +9 -5
- package/docs/advanced.zh.md +9 -5
- package/docs/changelog.ja.md +206 -29
- package/docs/changelog.md +177 -0
- package/docs/changelog.zh-TW.md +229 -52
- package/docs/changelog.zh.md +204 -27
- package/docs/cli-reference.ja.md +82 -52
- package/docs/cli-reference.md +56 -26
- package/docs/cli-reference.zh-TW.md +82 -52
- package/docs/cli-reference.zh.md +70 -40
- package/docs/configuration-interactive-setup.ja.md +45 -42
- package/docs/configuration-interactive-setup.md +8 -5
- package/docs/configuration-interactive-setup.zh-TW.md +26 -23
- package/docs/configuration-interactive-setup.zh.md +25 -22
- package/docs/configuration-language-support.ja.md +33 -63
- package/docs/configuration-language-support.md +32 -62
- package/docs/configuration-language-support.zh-TW.md +35 -65
- package/docs/configuration-language-support.zh.md +32 -62
- package/docs/configuration-llm-setup.ja.md +25 -23
- package/docs/configuration-llm-setup.md +20 -18
- package/docs/configuration-llm-setup.zh-TW.md +21 -19
- package/docs/configuration-llm-setup.zh.md +20 -18
- package/docs/configuration-preferences.ja.md +67 -52
- package/docs/configuration-preferences.md +56 -41
- package/docs/configuration-preferences.zh-TW.md +69 -54
- package/docs/configuration-preferences.zh.md +68 -53
- package/docs/configuration.ja.md +65 -81
- package/docs/configuration.md +19 -35
- package/docs/configuration.zh-TW.md +62 -79
- package/docs/configuration.zh.md +50 -67
- package/docs/features-generate-documentation.ja.md +44 -69
- package/docs/features-generate-documentation.md +36 -61
- package/docs/features-generate-documentation.zh-TW.md +42 -67
- package/docs/features-generate-documentation.zh.md +41 -67
- package/docs/features-publish-your-docs.ja.md +36 -36
- package/docs/features-publish-your-docs.md +2 -2
- package/docs/features-publish-your-docs.zh-TW.md +21 -21
- package/docs/features-publish-your-docs.zh.md +23 -23
- package/docs/features-translate-documentation.ja.md +40 -31
- package/docs/features-translate-documentation.md +15 -6
- package/docs/features-translate-documentation.zh-TW.md +37 -28
- package/docs/features-translate-documentation.zh.md +23 -14
- package/docs/features-update-and-refine.ja.md +68 -118
- package/docs/features-update-and-refine.md +58 -108
- package/docs/features-update-and-refine.zh-TW.md +67 -116
- package/docs/features-update-and-refine.zh.md +64 -114
- package/docs/features.ja.md +29 -19
- package/docs/features.md +25 -15
- package/docs/features.zh-TW.md +28 -18
- package/docs/features.zh.md +31 -21
- package/docs/getting-started.ja.md +40 -43
- package/docs/getting-started.md +36 -39
- package/docs/getting-started.zh-TW.md +38 -41
- package/docs/getting-started.zh.md +45 -48
- package/docs/overview.ja.md +63 -11
- package/docs/overview.md +60 -8
- package/docs/overview.zh-TW.md +67 -15
- package/docs/overview.zh.md +62 -10
- package/media.md +9 -9
- package/package.json +1 -1
- package/prompts/detail/custom/custom-components.md +304 -188
- package/prompts/detail/document-rules.md +4 -4
- package/prompts/detail/generate-document.md +21 -8
- package/prompts/detail/update-document.md +8 -12
- package/prompts/structure/update-document-structure.md +12 -8
- package/prompts/utils/feedback-refiner.md +3 -3
- package/tests/agents/generate/document-structure-tools/move-document.test.mjs +9 -9
- package/tests/agents/generate/user-review-document-structure.test.mjs +29 -8
- package/tests/agents/update/document-tools/update-document-content.test.mjs +115 -112
- package/tests/agents/update/fs-tools/glob.test.mjs +438 -0
- package/tests/agents/update/fs-tools/grep.test.mjs +279 -0
- package/tests/agents/update/fs-tools/read-file.test.mjs +553 -0
- package/tests/agents/update/user-review-document.test.mjs +48 -27
- package/types/document-schema.mjs +5 -6
- package/types/document-structure-schema.mjs +20 -8
|
@@ -1,44 +1,46 @@
|
|
|
1
1
|
# LLM 设置
|
|
2
2
|
|
|
3
|
-
AIGNE DocSmith 使用大语言模型 (
|
|
3
|
+
AIGNE DocSmith 使用大语言模型 (LLM) 生成文档内容。配置 AI 模型提供商主要有两种方法:利用集成的 AIGNE Hub,或连接您选择的提供商的自定义 API 密钥。
|
|
4
4
|
|
|
5
5
|
## AIGNE Hub (推荐)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
配置 LLM 最直接的方法是通过 AIGNE Hub。它作为多个 LLM 提供商的网关,提供两大优势:
|
|
8
8
|
|
|
9
9
|
- **无需 API 密钥:** 您无需管理自己的 API 密钥或服务订阅即可生成文档。
|
|
10
|
-
-
|
|
10
|
+
- **灵活切换模型:** 您可以使用 `--model` 标志为任何命令更改 AI 模型。
|
|
11
11
|
|
|
12
|
-
要通过 AIGNE Hub
|
|
12
|
+
要通过 AIGNE Hub 使用特定模型,请在命令后附加 `--model` 标志。以下示例演示了其用法:
|
|
13
13
|
|
|
14
14
|
```bash 通过 AIGNE Hub 使用不同模型 icon=mdi:code-braces
|
|
15
|
-
# 使用 Google 的 Gemini 2.5 Flash 模型
|
|
16
|
-
aigne doc generate --model google:gemini-2.5-flash
|
|
17
|
-
|
|
18
|
-
# 使用 Anthropic 的 Claude 3.5 Sonnet 模型
|
|
19
|
-
aigne doc generate --model claude:claude-3-5-sonnet
|
|
20
|
-
|
|
21
15
|
# 使用 OpenAI 的 GPT-4o 模型
|
|
22
16
|
aigne doc generate --model openai:gpt-4o
|
|
17
|
+
|
|
18
|
+
# 使用 Anthropic 的 Claude 4.5 Sonnet 模型
|
|
19
|
+
aigne doc generate --model anthropic:claude-sonnet-4-5
|
|
20
|
+
|
|
21
|
+
# 使用 Google 的 Gemini 2.5 Pro 模型
|
|
22
|
+
aigne doc generate --model google:gemini-2.5-pro
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
如果未指定 `--model` 标志,DocSmith 将默认使用项目配置文件中定义的模型。
|
|
26
26
|
|
|
27
27
|
## 使用自定义 API 密钥
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
对于希望使用自己在 OpenAI、Anthropic 或 Google 等提供商处的账户的用户,可以使用个人 API 密钥配置 DocSmith。这种方法可以对 API 使用和计费进行直接控制。
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
配置通过交互式向导进行。要启动它,请运行以下命令:
|
|
32
32
|
|
|
33
|
-
```bash
|
|
33
|
+
```bash 启动交互式向导 icon=lucide:magic-wand
|
|
34
34
|
aigne doc init
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
向导将提示您选择提供商并输入必要的凭据。有关此过程的完整分步指南,请参阅[交互式设置](./configuration-interactive-setup.md)文档。
|
|
38
38
|
|
|
39
39
|
## 设置默认模型
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
为了在所有文档生成任务中保持一致性,可以在项目的 `aigne.yaml` 配置文件中设置默认的 LLM。任何未明确包含 `--model` 标志的命令都将使用此模型。
|
|
42
|
+
|
|
43
|
+
以下是配置示例:
|
|
42
44
|
|
|
43
45
|
```yaml aigne.yaml icon=mdi:file-code
|
|
44
46
|
chat_model:
|
|
@@ -47,8 +49,8 @@ chat_model:
|
|
|
47
49
|
temperature: 0.8
|
|
48
50
|
```
|
|
49
51
|
|
|
50
|
-
在此示例中,DocSmith
|
|
52
|
+
在此示例中,DocSmith 配置为使用 Google 的 `gemini-2.5-pro` 模型,并将 `temperature` 设置为 `0.8` 作为所有生成任务的默认值。
|
|
51
53
|
|
|
52
54
|
---
|
|
53
55
|
|
|
54
|
-
|
|
56
|
+
配置好 LLM 提供商后,下一步是管理文档的语言设置。请前往[语言支持](./configuration-language-support.md)指南,查看支持的语言完整列表并了解如何启用它们。
|
|
@@ -1,78 +1,93 @@
|
|
|
1
1
|
# プリファレンスの管理
|
|
2
2
|
|
|
3
|
-
AIGNE DocSmith
|
|
3
|
+
AIGNE DocSmith は、フィードバックから学習するように設計されています。生成されたコンテンツを改良または修正すると、DocSmith はそのフィードバックをプリファレンスと呼ばれる永続的なルールに変換できます。これらのルールにより、特定のスタイル、構造要件、コンテンツポリシーが将来のドキュメント作成タスクで一貫して適用されるようになります。すべてのプリファレンスは、プロジェクトルートの `.aigne/doc-smith/preferences.yml` にある人間が読めるYAMLファイルに保存されます。
|
|
4
4
|
|
|
5
5
|
## プリファレンスのライフサイクル
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
次の図は、フィードバックが再利用可能なルールになり、将来のタスクに適用され、コマンドラインから管理される方法を示しています。
|
|
8
8
|
|
|
9
9
|
```d2 プリファレンスのライフサイクル
|
|
10
10
|
direction: down
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
label: "
|
|
14
|
-
shape:
|
|
12
|
+
developer: {
|
|
13
|
+
label: "開発者"
|
|
14
|
+
shape: person
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
label: "
|
|
17
|
+
docsmith_system: {
|
|
18
|
+
label: "AIGNE DocSmith システム"
|
|
19
19
|
shape: rectangle
|
|
20
|
-
}
|
|
21
20
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
cli: {
|
|
22
|
+
label: "CLI コマンド\n(refine / translate)"
|
|
23
|
+
shape: rectangle
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
agent: {
|
|
27
|
+
label: "内部分析 Agent"
|
|
28
|
+
shape: rectangle
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
decision: {
|
|
32
|
+
label: "フィードバックは\n再利用可能なポリシーか?"
|
|
33
|
+
shape: diamond
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
create_rule: {
|
|
37
|
+
label: "新しいプリファレンスルールを作成"
|
|
38
|
+
shape: rectangle
|
|
39
|
+
}
|
|
25
40
|
}
|
|
26
41
|
|
|
27
|
-
|
|
28
|
-
label: "
|
|
42
|
+
preferences_file: {
|
|
43
|
+
label: ".aigne/doc-smith/preferences.yml"
|
|
29
44
|
shape: cylinder
|
|
30
45
|
}
|
|
31
46
|
|
|
32
|
-
|
|
33
|
-
label: "
|
|
34
|
-
shape:
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
cli: {
|
|
38
|
-
label: "5. CLI管理\n('aigne doc prefs')"
|
|
39
|
-
shape: rectangle
|
|
47
|
+
one_time_fix: {
|
|
48
|
+
label: "一度限りの修正として適用"
|
|
49
|
+
shape: oval
|
|
40
50
|
}
|
|
41
51
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
decision ->
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
52
|
+
developer -> docsmith_system.cli: "1. フィードバックを提供"
|
|
53
|
+
docsmith_system.cli -> docsmith_system.agent: "2. フィードバックをキャプチャ"
|
|
54
|
+
docsmith_system.agent -> docsmith_system.decision: "3. 分析"
|
|
55
|
+
docsmith_system.decision -> docsmith_system.create_rule: "はい"
|
|
56
|
+
docsmith_system.create_rule -> preferences_file: "4. ルールをファイルに保存"
|
|
57
|
+
docsmith_system.decision -> one_time_fix: "いいえ"
|
|
49
58
|
```
|
|
50
59
|
|
|
51
|
-
###
|
|
60
|
+
### プリファレンスの作成方法
|
|
52
61
|
|
|
53
|
-
`refine` または `translate`
|
|
62
|
+
`refine` または `translate` の段階でフィードバックを提供すると、内部 Agent が入力を分析します。フィードバックが一度限りの修正(例:タイポの修正)か、再利用可能なポリシー(例:「コードコメントは常に英語で書く」)かを判断します。それが永続的な指示を表す場合、新しいプリファレンスルールを作成し、プロジェクトの `preferences.yml` ファイルに保存します。
|
|
54
63
|
|
|
55
64
|
### ルールのプロパティ
|
|
56
65
|
|
|
57
|
-
`preferences.yml`
|
|
58
|
-
|
|
59
|
-
<x-field
|
|
60
|
-
<x-field data-name="
|
|
61
|
-
<x-field data-name="
|
|
62
|
-
<x-field data-name="
|
|
63
|
-
<x-field
|
|
64
|
-
|
|
65
|
-
<x-field data-name="
|
|
66
|
+
`preferences.yml` に保存される各ルールは、次の構造を持ちます。
|
|
67
|
+
|
|
68
|
+
<x-field-group>
|
|
69
|
+
<x-field data-name="id" data-type="string" data-desc="ルールの一意でランダムに生成された識別子(例:pref_a1b2c3d4e5f6g7h8)。"></x-field>
|
|
70
|
+
<x-field data-name="active" data-type="boolean" data-desc="ルールが現在有効かどうかを示します。無効なルールは生成タスク中に無視されます。"></x-field>
|
|
71
|
+
<x-field data-name="scope" data-type="string">
|
|
72
|
+
<x-field-desc markdown>ルールをいつ適用するかを定義します。有効なスコープは `global`、`structure`、`document`、または `translation` です。</x-field-desc>
|
|
73
|
+
</x-field>
|
|
74
|
+
<x-field data-name="rule" data-type="string" data-desc="将来のタスクでAIに渡される、具体的で洗練された指示。"></x-field>
|
|
75
|
+
<x-field data-name="feedback" data-type="string" data-desc="ユーザーから提供された元の自然言語のフィードバック。参照用に保存されます。"></x-field>
|
|
76
|
+
<x-field data-name="createdAt" data-type="string" data-desc="ルールが作成された日時を示すISO 8601タイムスタンプ。"></x-field>
|
|
77
|
+
<x-field data-name="paths" data-type="string[]" data-required="false">
|
|
78
|
+
<x-field-desc markdown>オプションのファイルパスのリスト。存在する場合、ルールはこれらの特定のソースファイルに対して生成されたコンテンツにのみ適用されます。</x-field-desc>
|
|
79
|
+
</x-field>
|
|
80
|
+
</x-field-group>
|
|
66
81
|
|
|
67
82
|
## CLIによるプリファレンスの管理
|
|
68
83
|
|
|
69
|
-
`aigne doc prefs`
|
|
84
|
+
`aigne doc prefs` コマンドを使用して、保存されているすべてのプリファレンスを表示および管理できます。これにより、ルールの一覧表示、有効化、無効化、または永久に削除することができます。
|
|
70
85
|
|
|
71
|
-
###
|
|
86
|
+
### すべてのプリファレンスを一覧表示
|
|
72
87
|
|
|
73
|
-
|
|
88
|
+
保存されているすべてのプリファレンス(有効なものと無効なものの両方)の完全なリストを表示するには、`--list` フラグを使用します。
|
|
74
89
|
|
|
75
|
-
```bash
|
|
90
|
+
```bash すべてのプリファレンスを一覧表示 icon=lucide:terminal
|
|
76
91
|
aigne doc prefs --list
|
|
77
92
|
```
|
|
78
93
|
|
|
@@ -83,12 +98,12 @@ aigne doc prefs --list
|
|
|
83
98
|
|
|
84
99
|
**フォーマットの説明:**
|
|
85
100
|
- 🟢 = 有効なプリファレンス, ⚪ = 無効なプリファレンス
|
|
86
|
-
- [scope] =
|
|
101
|
+
- [scope] = プリファレンススコープ (global, structure, document, translation)
|
|
87
102
|
- ID = 一意のプリファレンス識別子
|
|
88
103
|
- Paths = 特定のファイルパス(該当する場合)
|
|
89
104
|
|
|
90
105
|
🟢 [structure] pref_a1b2c3d4e5f6g7h8 | Paths: overview.md
|
|
91
|
-
|
|
106
|
+
概要ドキュメントの最後に「次のステップ」セクションを追加します。
|
|
92
107
|
|
|
93
108
|
⚪ [document] pref_i9j0k1l2m3n4o5p6
|
|
94
109
|
コードコメントは英語で記述する必要があります。
|
|
@@ -96,13 +111,13 @@ aigne doc prefs --list
|
|
|
96
111
|
|
|
97
112
|
### プリファレンスの無効化と再有効化
|
|
98
113
|
|
|
99
|
-
|
|
114
|
+
ルールを削除せずに一時的に無効にする必要がある場合は、`--toggle` フラグで有効ステータスを切り替えることができます。IDなしでコマンドを実行すると対話モードが起動し、切り替えるプリファレンスを1つ以上選択できます。
|
|
100
115
|
|
|
101
|
-
```bash
|
|
116
|
+
```bash プリファレンスを対話的に切り替える icon=lucide:terminal
|
|
102
117
|
aigne doc prefs --toggle
|
|
103
118
|
```
|
|
104
119
|
|
|
105
|
-
特定のルールを直接切り替えるには、`--id` フラグでそのID
|
|
120
|
+
特定のルールを直接切り替えるには、`--id` フラグでそのIDを指定します。このアクションは、ルールの `active` プロパティを変更します。
|
|
106
121
|
|
|
107
122
|
```bash 特定のプリファレンスを切り替える icon=lucide:terminal
|
|
108
123
|
aigne doc prefs --toggle --id pref_i9j0k1l2m3n4o5p6
|
|
@@ -110,15 +125,15 @@ aigne doc prefs --toggle --id pref_i9j0k1l2m3n4o5p6
|
|
|
110
125
|
|
|
111
126
|
### プリファレンスの削除
|
|
112
127
|
|
|
113
|
-
1つ以上のプリファレンスを完全に削除するには、`--remove`
|
|
128
|
+
1つ以上のプリファレンスを完全に削除するには、`--remove` フラグを使用します。この操作は元に戻せません。
|
|
114
129
|
|
|
115
130
|
対話的な選択プロンプトを表示するには、IDなしでコマンドを実行します。
|
|
116
131
|
|
|
117
|
-
```bash
|
|
132
|
+
```bash プリファレンスを対話的に削除する icon=lucide:terminal
|
|
118
133
|
aigne doc prefs --remove
|
|
119
134
|
```
|
|
120
135
|
|
|
121
|
-
|
|
136
|
+
特定のルールを直接削除するには、`--id` フラグでそのIDを指定します。
|
|
122
137
|
|
|
123
138
|
```bash 特定のプリファレンスを削除する icon=lucide:terminal
|
|
124
139
|
aigne doc prefs --remove --id pref_a1b2c3d4e5f6g7h8
|
|
@@ -126,4 +141,4 @@ aigne doc prefs --remove --id pref_a1b2c3d4e5f6g7h8
|
|
|
126
141
|
|
|
127
142
|
## 次のステップ
|
|
128
143
|
|
|
129
|
-
プリファレンスの管理は、DocSmith
|
|
144
|
+
プリファレンスの管理は、DocSmithをプロジェクトの特定のニーズに合わせて調整する上で重要な部分です。その他のカスタマイズオプションについては、メインの[設定ガイド](./configuration.md)をご覧ください。
|
|
@@ -9,68 +9,83 @@ The following diagram illustrates how your feedback becomes a reusable rule that
|
|
|
9
9
|
```d2 The Preference Lifecycle
|
|
10
10
|
direction: down
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
label: "
|
|
14
|
-
shape:
|
|
12
|
+
developer: {
|
|
13
|
+
label: "Developer"
|
|
14
|
+
shape: person
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
label: "
|
|
17
|
+
docsmith_system: {
|
|
18
|
+
label: "AIGNE DocSmith System"
|
|
19
19
|
shape: rectangle
|
|
20
|
-
}
|
|
21
20
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
cli: {
|
|
22
|
+
label: "CLI Command\n(refine / translate)"
|
|
23
|
+
shape: rectangle
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
agent: {
|
|
27
|
+
label: "Internal Analysis Agent"
|
|
28
|
+
shape: rectangle
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
decision: {
|
|
32
|
+
label: "Is feedback a\nreusable policy?"
|
|
33
|
+
shape: diamond
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
create_rule: {
|
|
37
|
+
label: "Create New Preference Rule"
|
|
38
|
+
shape: rectangle
|
|
39
|
+
}
|
|
25
40
|
}
|
|
26
41
|
|
|
27
|
-
|
|
28
|
-
label: "
|
|
42
|
+
preferences_file: {
|
|
43
|
+
label: ".aigne/doc-smith/preferences.yml"
|
|
29
44
|
shape: cylinder
|
|
30
45
|
}
|
|
31
46
|
|
|
32
|
-
|
|
33
|
-
label: "
|
|
34
|
-
shape:
|
|
47
|
+
one_time_fix: {
|
|
48
|
+
label: "Apply as a one-time fix"
|
|
49
|
+
shape: oval
|
|
35
50
|
}
|
|
36
51
|
|
|
37
|
-
cli:
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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
|
-
|
|
52
|
+
developer -> docsmith_system.cli: "1. Provides feedback"
|
|
53
|
+
docsmith_system.cli -> docsmith_system.agent: "2. Captures feedback"
|
|
54
|
+
docsmith_system.agent -> docsmith_system.decision: "3. Analyzes"
|
|
55
|
+
docsmith_system.decision -> docsmith_system.create_rule: "Yes"
|
|
56
|
+
docsmith_system.create_rule -> preferences_file: "4. Saves rule to file"
|
|
57
|
+
docsmith_system.decision -> one_time_fix: "No"
|
|
49
58
|
```
|
|
50
59
|
|
|
51
60
|
### How Preferences are Created
|
|
52
61
|
|
|
53
|
-
When you provide feedback during the `refine` or `translate` stages, an internal agent analyzes your input. It determines if the feedback is a one-time fix (e.g., correcting a typo) or a reusable policy (e.g., "always write code comments in English"). If it represents a lasting instruction, it creates a new preference rule.
|
|
62
|
+
When you provide feedback during the `refine` or `translate` stages, an internal agent analyzes your input. It determines if the feedback is a one-time fix (e.g., correcting a typo) or a reusable policy (e.g., "always write code comments in English"). If it represents a lasting instruction, it creates a new preference rule and saves it to your project's `preferences.yml` file.
|
|
54
63
|
|
|
55
64
|
### Rule Properties
|
|
56
65
|
|
|
57
66
|
Each rule saved in `preferences.yml` has the following structure:
|
|
58
67
|
|
|
59
|
-
<x-field
|
|
60
|
-
<x-field data-name="
|
|
61
|
-
<x-field data-name="
|
|
62
|
-
<x-field data-name="
|
|
63
|
-
<x-field
|
|
64
|
-
|
|
65
|
-
<x-field data-name="
|
|
68
|
+
<x-field-group>
|
|
69
|
+
<x-field data-name="id" data-type="string" data-desc="A unique, randomly generated identifier for the rule (e.g., pref_a1b2c3d4e5f6g7h8)."></x-field>
|
|
70
|
+
<x-field data-name="active" data-type="boolean" data-desc="Indicates if the rule is currently enabled. Inactive rules are ignored during generation tasks."></x-field>
|
|
71
|
+
<x-field data-name="scope" data-type="string">
|
|
72
|
+
<x-field-desc markdown>Defines when the rule should be applied. Valid scopes are `global`, `structure`, `document`, or `translation`.</x-field-desc>
|
|
73
|
+
</x-field>
|
|
74
|
+
<x-field data-name="rule" data-type="string" data-desc="The specific, distilled instruction that will be passed to the AI in future tasks."></x-field>
|
|
75
|
+
<x-field data-name="feedback" data-type="string" data-desc="The original, natural language feedback provided by the user, preserved for reference."></x-field>
|
|
76
|
+
<x-field data-name="createdAt" data-type="string" data-desc="The ISO 8601 timestamp indicating when the rule was created."></x-field>
|
|
77
|
+
<x-field data-name="paths" data-type="string[]" data-required="false">
|
|
78
|
+
<x-field-desc markdown>An optional list of file paths. If present, the rule only applies to content generated for these specific source files.</x-field-desc>
|
|
79
|
+
</x-field>
|
|
80
|
+
</x-field-group>
|
|
66
81
|
|
|
67
82
|
## Managing Preferences with the CLI
|
|
68
83
|
|
|
69
|
-
|
|
84
|
+
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.
|
|
70
85
|
|
|
71
86
|
### Listing All Preferences
|
|
72
87
|
|
|
73
|
-
To see all saved preferences, both active and inactive, use the `--list` flag.
|
|
88
|
+
To see a complete list of all saved preferences, both active and inactive, use the `--list` flag.
|
|
74
89
|
|
|
75
90
|
```bash List all preferences icon=lucide:terminal
|
|
76
91
|
aigne doc prefs --list
|
|
@@ -96,13 +111,13 @@ The command displays a formatted list showing the status, scope, ID, and any pat
|
|
|
96
111
|
|
|
97
112
|
### Deactivating and Reactivating Preferences
|
|
98
113
|
|
|
99
|
-
If you
|
|
114
|
+
If you need to temporarily disable a rule without deleting it, you can toggle its active status with the `--toggle` flag. Running the command without an ID will launch an interactive mode, allowing you to select one or more preferences to toggle.
|
|
100
115
|
|
|
101
116
|
```bash Toggle preferences interactively icon=lucide:terminal
|
|
102
117
|
aigne doc prefs --toggle
|
|
103
118
|
```
|
|
104
119
|
|
|
105
|
-
To toggle a specific rule directly, provide its ID using the `--id` flag. This
|
|
120
|
+
To toggle a specific rule directly, provide its ID using the `--id` flag. This action changes the rule's `active` property.
|
|
106
121
|
|
|
107
122
|
```bash Toggle a specific preference icon=lucide:terminal
|
|
108
123
|
aigne doc prefs --toggle --id pref_i9j0k1l2m3n4o5p6
|
|
@@ -110,7 +125,7 @@ aigne doc prefs --toggle --id pref_i9j0k1l2m3n4o5p6
|
|
|
110
125
|
|
|
111
126
|
### Removing Preferences
|
|
112
127
|
|
|
113
|
-
To permanently delete one or more preferences, use the `--remove` flag. This action
|
|
128
|
+
To permanently delete one or more preferences, use the `--remove` flag. This action cannot be undone.
|
|
114
129
|
|
|
115
130
|
For an interactive selection prompt, run the command without an ID.
|
|
116
131
|
|
|
@@ -118,7 +133,7 @@ For an interactive selection prompt, run the command without an ID.
|
|
|
118
133
|
aigne doc prefs --remove
|
|
119
134
|
```
|
|
120
135
|
|
|
121
|
-
To remove a specific rule directly
|
|
136
|
+
To remove a specific rule directly, provide its ID using the `--id` flag.
|
|
122
137
|
|
|
123
138
|
```bash Remove a specific preference icon=lucide:terminal
|
|
124
139
|
aigne doc prefs --remove --id pref_a1b2c3d4e5f6g7h8
|
|
@@ -126,4 +141,4 @@ aigne doc prefs --remove --id pref_a1b2c3d4e5f6g7h8
|
|
|
126
141
|
|
|
127
142
|
## Next Steps
|
|
128
143
|
|
|
129
|
-
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).
|
|
144
|
+
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,90 +1,105 @@
|
|
|
1
1
|
# 管理偏好設定
|
|
2
2
|
|
|
3
|
-
AIGNE DocSmith
|
|
3
|
+
AIGNE DocSmith 的設計旨在從您的回饋中學習。當您優化或修正生成的內容時,DocSmith 可以將該回饋轉化為持久性規則,稱為偏好設定。這些規則確保您特定的風格、結構要求和內容策略在未來的文檔任務中得到一致應用。所有偏好設定都儲存在您專案根目錄下一個人類可讀的 YAML 檔案中,路徑為 `.aigne/doc-smith/preferences.yml`。
|
|
4
4
|
|
|
5
5
|
## 偏好設定的生命週期
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
下圖說明了您的回饋如何成為一個可重複使用的規則,該規則可應用於未來的任務,並可透過命令列進行管理。
|
|
8
8
|
|
|
9
|
-
```d2
|
|
9
|
+
```d2 偏好設定的生命週期
|
|
10
10
|
direction: down
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
label: "
|
|
14
|
-
shape:
|
|
12
|
+
developer: {
|
|
13
|
+
label: "開發者"
|
|
14
|
+
shape: person
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
label: "
|
|
17
|
+
docsmith_system: {
|
|
18
|
+
label: "AIGNE DocSmith 系統"
|
|
19
19
|
shape: rectangle
|
|
20
|
-
}
|
|
21
20
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
cli: {
|
|
22
|
+
label: "CLI 指令\n(refine / translate)"
|
|
23
|
+
shape: rectangle
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
agent: {
|
|
27
|
+
label: "內部分析 Agent"
|
|
28
|
+
shape: rectangle
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
decision: {
|
|
32
|
+
label: "回饋是否為\n可重複使用的策略?"
|
|
33
|
+
shape: diamond
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
create_rule: {
|
|
37
|
+
label: "建立新的偏好設定規則"
|
|
38
|
+
shape: rectangle
|
|
39
|
+
}
|
|
25
40
|
}
|
|
26
41
|
|
|
27
|
-
|
|
28
|
-
label: "
|
|
42
|
+
preferences_file: {
|
|
43
|
+
label: ".aigne/doc-smith/preferences.yml"
|
|
29
44
|
shape: cylinder
|
|
30
45
|
}
|
|
31
46
|
|
|
32
|
-
|
|
33
|
-
label: "
|
|
34
|
-
shape:
|
|
47
|
+
one_time_fix: {
|
|
48
|
+
label: "作為一次性修復應用"
|
|
49
|
+
shape: oval
|
|
35
50
|
}
|
|
36
51
|
|
|
37
|
-
cli:
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
refiner -> decision: "分析"
|
|
44
|
-
decision -> pref_file: "是"
|
|
45
|
-
decision -> "捨棄(一次性修復)": "否"
|
|
46
|
-
pref_file -> future_tasks: "應用於"
|
|
47
|
-
cli <-> pref_file: "管理"
|
|
48
|
-
|
|
52
|
+
developer -> docsmith_system.cli: "1. 提供回饋"
|
|
53
|
+
docsmith_system.cli -> docsmith_system.agent: "2. 捕捉回饋"
|
|
54
|
+
docsmith_system.agent -> docsmith_system.decision: "3. 進行分析"
|
|
55
|
+
docsmith_system.decision -> docsmith_system.create_rule: "是"
|
|
56
|
+
docsmith_system.create_rule -> preferences_file: "4. 將規則儲存至檔案"
|
|
57
|
+
docsmith_system.decision -> one_time_fix: "否"
|
|
49
58
|
```
|
|
50
59
|
|
|
51
60
|
### 如何建立偏好設定
|
|
52
61
|
|
|
53
|
-
當您在 `refine` 或 `translate` 階段提供回饋時,一個內部
|
|
62
|
+
當您在 `refine` 或 `translate` 階段提供回饋時,一個內部 Agent 會分析您的輸入。它會判斷該回饋是一次性修復(例如,修正一個錯字)還是可重複使用的策略(例如,「程式碼註解必須以英文撰寫」)。如果它代表一個持久性的指令,它會建立一個新的偏好設定規則,並將其儲存到您專案的 `preferences.yml` 檔案中。
|
|
54
63
|
|
|
55
64
|
### 規則屬性
|
|
56
65
|
|
|
57
66
|
儲存在 `preferences.yml` 中的每個規則都具有以下結構:
|
|
58
67
|
|
|
59
|
-
<x-field
|
|
60
|
-
<x-field data-name="
|
|
61
|
-
<x-field data-name="
|
|
62
|
-
<x-field data-name="
|
|
63
|
-
<x-field
|
|
64
|
-
|
|
65
|
-
<x-field data-name="
|
|
68
|
+
<x-field-group>
|
|
69
|
+
<x-field data-name="id" data-type="string" data-desc="規則的唯一隨機生成識別碼(例如:pref_a1b2c3d4e5f6g7h8)。"></x-field>
|
|
70
|
+
<x-field data-name="active" data-type="boolean" data-desc="表示規則目前是否啟用。未啟用的規則在生成任務期間會被忽略。"></x-field>
|
|
71
|
+
<x-field data-name="scope" data-type="string">
|
|
72
|
+
<x-field-desc markdown>定義規則應在何時應用。有效的範圍為 `global`、`structure`、`document` 或 `translation`。</x-field-desc>
|
|
73
|
+
</x-field>
|
|
74
|
+
<x-field data-name="rule" data-type="string" data-desc="在未來任務中將傳遞給 AI 的具體、精煉的指令。"></x-field>
|
|
75
|
+
<x-field data-name="feedback" data-type="string" data-desc="使用者提供的原始自然語言回饋,保留以供參考。"></x-field>
|
|
76
|
+
<x-field data-name="createdAt" data-type="string" data-desc="表示規則建立時間的 ISO 8601 時間戳記。"></x-field>
|
|
77
|
+
<x-field data-name="paths" data-type="string[]" data-required="false">
|
|
78
|
+
<x-field-desc markdown>可選的檔案路徑列表。如果存在,此規則僅適用於為這些特定來源檔案生成的內容。</x-field-desc>
|
|
79
|
+
</x-field>
|
|
80
|
+
</x-field-group>
|
|
66
81
|
|
|
67
82
|
## 使用 CLI 管理偏好設定
|
|
68
83
|
|
|
69
|
-
您可以使用 `aigne doc prefs`
|
|
84
|
+
您可以使用 `aigne doc prefs` 指令來檢視和管理所有已儲存的偏好設定。這讓您可以列出、啟用、停用或永久移除規則。
|
|
70
85
|
|
|
71
86
|
### 列出所有偏好設定
|
|
72
87
|
|
|
73
|
-
|
|
88
|
+
要查看所有已儲存偏好設定的完整列表(包括啟用和未啟用的),請使用 `--list` 標記。
|
|
74
89
|
|
|
75
|
-
```bash
|
|
90
|
+
```bash 列出所有偏好設定 icon=lucide:terminal
|
|
76
91
|
aigne doc prefs --list
|
|
77
92
|
```
|
|
78
93
|
|
|
79
|
-
|
|
94
|
+
該指令會顯示一個格式化的列表,顯示每個規則的狀態、範圍、ID 以及任何路徑限制。
|
|
80
95
|
|
|
81
|
-
```text
|
|
96
|
+
```text 輸出範例 icon=lucide:clipboard-list
|
|
82
97
|
# 使用者偏好設定
|
|
83
98
|
|
|
84
99
|
**格式說明:**
|
|
85
100
|
- 🟢 = 啟用中的偏好設定,⚪ = 未啟用的偏好設定
|
|
86
101
|
- [scope] = 偏好設定範圍 (global, structure, document, translation)
|
|
87
|
-
- ID =
|
|
102
|
+
- ID = 唯一偏好設定識別碼
|
|
88
103
|
- Paths = 特定檔案路徑(如果適用)
|
|
89
104
|
|
|
90
105
|
🟢 [structure] pref_a1b2c3d4e5f6g7h8 | Paths: overview.md
|
|
@@ -94,36 +109,36 @@ aigne doc prefs --list
|
|
|
94
109
|
程式碼註解必須以英文撰寫。
|
|
95
110
|
```
|
|
96
111
|
|
|
97
|
-
###
|
|
112
|
+
### 停用與重新啟用偏好設定
|
|
98
113
|
|
|
99
|
-
|
|
114
|
+
如果您需要暫時停用一個規則而不刪除它,您可以使用 `--toggle` 標記來切換其啟用狀態。若執行指令時不帶 ID,將會啟動互動模式,讓您選擇一個或多個偏好設定進行切換。
|
|
100
115
|
|
|
101
|
-
```bash
|
|
116
|
+
```bash 以互動模式切換偏好設定 icon=lucide:terminal
|
|
102
117
|
aigne doc prefs --toggle
|
|
103
118
|
```
|
|
104
119
|
|
|
105
|
-
|
|
120
|
+
要直接切換特定規則,請使用 `--id` 標記提供其 ID。此操作會更改規則的 `active` 屬性。
|
|
106
121
|
|
|
107
|
-
```bash
|
|
122
|
+
```bash 切換特定偏好設定 icon=lucide:terminal
|
|
108
123
|
aigne doc prefs --toggle --id pref_i9j0k1l2m3n4o5p6
|
|
109
124
|
```
|
|
110
125
|
|
|
111
126
|
### 移除偏好設定
|
|
112
127
|
|
|
113
|
-
|
|
128
|
+
要永久刪除一個或多個偏好設定,請使用 `--remove` 標記。此操作無法復原。
|
|
114
129
|
|
|
115
|
-
若要進入互動式選擇提示,請在不帶 ID
|
|
130
|
+
若要進入互動式選擇提示,請在不帶 ID 的情況下執行該指令。
|
|
116
131
|
|
|
117
|
-
```bash
|
|
132
|
+
```bash 以互動模式移除偏好設定 icon=lucide:terminal
|
|
118
133
|
aigne doc prefs --remove
|
|
119
134
|
```
|
|
120
135
|
|
|
121
|
-
|
|
136
|
+
要直接移除特定規則,請使用 `--id` 標記提供其 ID。
|
|
122
137
|
|
|
123
|
-
```bash
|
|
138
|
+
```bash 移除特定偏好設定 icon=lucide:terminal
|
|
124
139
|
aigne doc prefs --remove --id pref_a1b2c3d4e5f6g7h8
|
|
125
140
|
```
|
|
126
141
|
|
|
127
142
|
## 後續步驟
|
|
128
143
|
|
|
129
|
-
|
|
144
|
+
管理偏好設定是根據您專案的特定需求量身打造 DocSmith 的關鍵部分。如需更多自訂選項,請探索主要的[設定指南](./configuration.md)。
|