@aigne/doc-smith 0.8.9 → 0.8.10-beta.1
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 -1
- package/.aigne/doc-smith/preferences.yml +4 -4
- package/.aigne/doc-smith/upload-cache.yaml +180 -0
- package/.github/workflows/release.yml +6 -2
- package/.release-please-manifest.json +3 -0
- package/CHANGELOG.md +20 -0
- package/LICENSE +93 -0
- package/README.md +6 -2
- package/RELEASE.md +10 -0
- package/agents/generate/check-need-generate-structure.mjs +40 -18
- package/agents/generate/index.yaml +1 -0
- package/agents/generate/user-review-document-structure.mjs +168 -0
- package/agents/update/generate-and-translate-document.yaml +3 -3
- package/agents/utils/check-feedback-refiner.mjs +2 -0
- package/agents/utils/save-docs.mjs +16 -22
- package/aigne.yaml +1 -0
- package/docs/advanced-how-it-works.md +26 -24
- package/docs/advanced-how-it-works.zh.md +32 -30
- package/docs/advanced-quality-assurance.md +6 -9
- package/docs/advanced-quality-assurance.zh.md +19 -22
- package/docs/cli-reference.md +35 -76
- package/docs/cli-reference.zh.md +48 -89
- package/docs/configuration-interactive-setup.md +18 -18
- package/docs/configuration-interactive-setup.zh.md +33 -33
- package/docs/configuration-language-support.md +12 -12
- package/docs/configuration-language-support.zh.md +20 -20
- package/docs/configuration-llm-setup.md +14 -13
- package/docs/configuration-llm-setup.zh.md +16 -15
- package/docs/configuration-preferences.md +22 -27
- package/docs/configuration-preferences.zh.md +35 -40
- package/docs/configuration.md +31 -45
- package/docs/configuration.zh.md +48 -62
- package/docs/features-generate-documentation.md +6 -7
- package/docs/features-generate-documentation.zh.md +21 -22
- package/docs/features-publish-your-docs.md +38 -30
- package/docs/features-publish-your-docs.zh.md +45 -37
- package/docs/features-translate-documentation.md +14 -74
- package/docs/features-translate-documentation.zh.md +19 -79
- package/docs/features-update-and-refine.md +19 -18
- package/docs/features-update-and-refine.zh.md +33 -32
- package/docs-mcp/get-docs-structure.mjs +1 -1
- package/package.json +3 -3
- package/prompts/detail/document-rules.md +1 -1
- package/prompts/structure/check-document-structure.md +11 -15
- package/release-please-config.json +13 -0
- package/tests/agents/generate/check-need-generate-structure.test.mjs +21 -24
- package/tests/agents/generate/user-review-document-structure.test.mjs +294 -0
- package/utils/auth-utils.mjs +2 -2
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
# Interactive Setup
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
AIGNE DocSmith includes an interactive setup wizard, launched with the `aigne doc init` command, to streamline project configuration. This guided process asks a series of questions about your documentation goals and generates a `config.yaml` file from your answers. It is the recommended method for starting a new documentation project, as it helps prevent configuration errors and provides specific recommendations based on your inputs.
|
|
4
4
|
|
|
5
5
|
## Running the Wizard
|
|
6
6
|
|
|
7
|
-
To
|
|
7
|
+
To start the process, run the following command in the root directory of your project:
|
|
8
8
|
|
|
9
9
|
```bash aigne doc init icon=lucide:sparkles
|
|
10
10
|
npx aigne doc init
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
The wizard will then
|
|
13
|
+
The wizard will then walk you through an 8-step process to configure your documentation.
|
|
14
14
|
|
|
15
15
|
## The Guided Process
|
|
16
16
|
|
|
17
|
-
The wizard
|
|
17
|
+
The wizard prompts for the following key configuration details:
|
|
18
18
|
|
|
19
|
-
1. **Primary Goal**: Defines the main
|
|
20
|
-
2. **Target Audience**: Specifies
|
|
19
|
+
1. **Primary Goal**: Defines the main purpose for your readers (e.g., getting started, finding answers).
|
|
20
|
+
2. **Target Audience**: Specifies the primary readers of the documentation (e.g., non-technical end-users, developers).
|
|
21
21
|
3. **Reader Knowledge Level**: Assesses the typical starting knowledge of your audience.
|
|
22
|
-
4. **Documentation Depth**: Determines
|
|
22
|
+
4. **Documentation Depth**: Determines the level of detail and scope of the content.
|
|
23
23
|
5. **Primary Language**: Sets the main language for the documentation.
|
|
24
24
|
6. **Translation Languages**: Selects additional languages for translation.
|
|
25
|
-
7. **Output Directory**: Specifies
|
|
25
|
+
7. **Output Directory**: Specifies the location for the generated documentation files.
|
|
26
26
|
8. **Source Code Paths**: Defines which files and directories to analyze, with support for glob patterns.
|
|
27
27
|
|
|
28
28
|
## Assisted Configuration
|
|
29
29
|
|
|
30
|
-
The wizard
|
|
30
|
+
The wizard uses a set of predefined rules to help you create a coherent and effective configuration.
|
|
31
31
|
|
|
32
32
|
```d2
|
|
33
33
|
direction: down
|
|
@@ -38,12 +38,12 @@ User-Selections: {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
Wizard-Engine: {
|
|
41
|
-
label: "2. Wizard's
|
|
41
|
+
label: "2. Wizard's Rule Engine"
|
|
42
42
|
shape: rectangle
|
|
43
43
|
grid-columns: 2
|
|
44
44
|
|
|
45
45
|
Filtering: {
|
|
46
|
-
label: "Option Filtering\n(Prevents
|
|
46
|
+
label: "Option Filtering\n(Prevents incompatible selections)"
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
Conflict-Detection: {
|
|
@@ -70,27 +70,27 @@ Guided-Experience -> User-Selections: "Refines"
|
|
|
70
70
|
|
|
71
71
|
### Default Suggestions and Option Filtering
|
|
72
72
|
|
|
73
|
-
As you
|
|
73
|
+
As you make selections, the wizard provides defaults and filters subsequent options to guide you toward a logical configuration. This is based on a set of cross-question conflict rules.
|
|
74
74
|
|
|
75
75
|
- **Default Suggestions**: If you select "Get started quickly" as your primary goal, the wizard will recommend "Is a total beginner" as the reader's knowledge level.
|
|
76
|
-
- **Real-time Filtering**: If your target audience is "End users (non-technical)," the wizard will hide
|
|
76
|
+
- **Real-time Filtering**: If your target audience is "End users (non-technical)," the wizard will hide the "Is an expert" knowledge level. The rule's reasoning is that non-technical users are typically not experienced technical users, thus preventing an incompatible selection.
|
|
77
77
|
|
|
78
78
|
### Conflict Detection and Resolution
|
|
79
79
|
|
|
80
|
-
|
|
80
|
+
In some cases, you may have multiple goals or audiences that require a specific documentation structure to be effective, such as creating documentation for both non-technical **End Users** and expert **Developers**. The wizard identifies these as "resolvable conflicts."
|
|
81
81
|
|
|
82
|
-
It then formulates a strategy to address these
|
|
82
|
+
It then formulates a strategy to address these needs within the document structure. For the End User vs. Developer example, the resolution strategy is to create separate user paths:
|
|
83
83
|
|
|
84
84
|
- **User Guide Path**: Uses plain language, focuses on UI interactions, and is oriented toward business outcomes.
|
|
85
85
|
- **Developer Guide Path**: Is code-first, technically precise, and includes SDK examples and configuration snippets.
|
|
86
86
|
|
|
87
|
-
This approach ensures
|
|
87
|
+
This approach ensures the final documentation is structured to serve multiple audiences effectively, rather than creating a single, confusing mix of content.
|
|
88
88
|
|
|
89
89
|
## Generated Output
|
|
90
90
|
|
|
91
|
-
|
|
91
|
+
After you complete the wizard, it saves a `config.yaml` file in your project. This file is fully commented, explaining each option and listing all available choices, which makes it easy to review and modify manually later.
|
|
92
92
|
|
|
93
|
-
Here is a snippet of
|
|
93
|
+
Here is a snippet of a generated file:
|
|
94
94
|
|
|
95
95
|
```yaml config.yaml icon=logos:yaml
|
|
96
96
|
# Project information for documentation publishing
|
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
# 交互式设置
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
AIGNE DocSmith 包含一个交互式设置向导,通过 `aigne doc init` 命令启动,以简化项目配置。该引导过程会询问一系列关于你的文档目标的问题,并根据你的回答生成一个 `config.yaml` 文件。这是启动新文档项目的推荐方法,因为它有助于防止配置错误,并根据你的输入提供具体建议。
|
|
4
4
|
|
|
5
5
|
## 运行向导
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
要开始此过程,请在项目的根目录中运行以下命令:
|
|
8
8
|
|
|
9
9
|
```bash aigne doc init icon=lucide:sparkles
|
|
10
10
|
npx aigne doc init
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
然后,向导将引导你完成一个 8 步流程来配置文档。
|
|
14
14
|
|
|
15
|
-
##
|
|
15
|
+
## 引导流程
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
向导会提示输入以下关键配置细节:
|
|
18
18
|
|
|
19
|
-
1.
|
|
20
|
-
2.
|
|
19
|
+
1. **主要目标**:定义读者的主要目的(例如,入门、寻找答案)。
|
|
20
|
+
2. **目标受众**:指明文档的主要读者(例如,非技术最终用户、开发者)。
|
|
21
21
|
3. **读者知识水平**:评估受众的典型初始知识水平。
|
|
22
|
-
4.
|
|
22
|
+
4. **文档深度**:确定内容的详细程度和范围。
|
|
23
23
|
5. **主要语言**:设置文档的主要语言。
|
|
24
|
-
6.
|
|
25
|
-
7.
|
|
24
|
+
6. **翻译语言**:选择其他需要翻译的语言。
|
|
25
|
+
7. **输出目录**:指定生成文档文件的位置。
|
|
26
26
|
8. **源代码路径**:定义要分析的文件和目录,支持 glob 模式。
|
|
27
27
|
|
|
28
28
|
## 辅助配置
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
向导使用一套预定义规则来帮助你创建一致且有效的配置。
|
|
31
31
|
|
|
32
32
|
```d2
|
|
33
33
|
direction: down
|
|
@@ -38,12 +38,12 @@ User-Selections: {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
Wizard-Engine: {
|
|
41
|
-
label: "2.
|
|
41
|
+
label: "2. 向导的规则引擎"
|
|
42
42
|
shape: rectangle
|
|
43
43
|
grid-columns: 2
|
|
44
44
|
|
|
45
45
|
Filtering: {
|
|
46
|
-
label: "
|
|
46
|
+
label: "选项筛选\n(防止不兼容的选择)"
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
Conflict-Detection: {
|
|
@@ -59,61 +59,61 @@ Guided-Experience: {
|
|
|
59
59
|
|
|
60
60
|
Final-Config: {
|
|
61
61
|
label: "4. 最终配置"
|
|
62
|
-
content: "config.yaml
|
|
62
|
+
content: "config.yaml 生成时\n包含冲突解决策略"
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
User-Selections -> Wizard-Engine
|
|
66
66
|
Wizard-Engine.Filtering -> Guided-Experience
|
|
67
67
|
Wizard-Engine.Conflict-Detection -> Final-Config
|
|
68
|
-
Guided-Experience -> User-Selections: "
|
|
68
|
+
Guided-Experience -> User-Selections: "完善"
|
|
69
69
|
```
|
|
70
70
|
|
|
71
|
-
###
|
|
71
|
+
### 默认建议和选项筛选
|
|
72
72
|
|
|
73
|
-
|
|
73
|
+
在你进行选择时,向导会提供默认值并筛选后续选项,以引导你进行逻辑配置。这是基于一套跨问题冲突规则。
|
|
74
74
|
|
|
75
|
-
-
|
|
76
|
-
-
|
|
75
|
+
- **默认建议**:如果你选择“快速入门”作为主要目标,向导将推荐“完全是初学者”作为读者的知识水平。
|
|
76
|
+
- **实时筛选**:如果你的目标受众是“最终用户(非技术人员)”,向导将隐藏“是专家”这一知识水平选项。该规则的理由是,非技术用户通常不是经验丰富的技术用户,从而防止不兼容的选择。
|
|
77
77
|
|
|
78
78
|
### 冲突检测与解决
|
|
79
79
|
|
|
80
|
-
|
|
80
|
+
在某些情况下,你可能有多个目标或受众,需要特定的文档结构才能有效,例如为非技术的 **最终用户** 和专业的 **开发者** 创建文档。向导将这些识别为“可解决的冲突”。
|
|
81
81
|
|
|
82
|
-
|
|
82
|
+
然后,它会制定一个策略来解决文档结构中的这些需求。对于最终用户与开发者的例子,解决策略是创建独立的用户路径:
|
|
83
83
|
|
|
84
|
-
- **用户指南路径**:使用通俗易懂的语言,侧重于 UI
|
|
84
|
+
- **用户指南路径**:使用通俗易懂的语言,侧重于 UI 交互,并以业务成果为导向。
|
|
85
85
|
- **开发者指南路径**:代码优先,技术上精确,并包含 SDK 示例和配置片段。
|
|
86
86
|
|
|
87
|
-
|
|
87
|
+
这种方法确保最终的文档结构能够有效地服务于多个受众,而不是创建一个单一、混乱的内容混合体。
|
|
88
88
|
|
|
89
|
-
##
|
|
89
|
+
## 生成输出
|
|
90
90
|
|
|
91
|
-
|
|
91
|
+
完成向导后,它会在你的项目中保存一个 `config.yaml` 文件。该文件带有完整的注释,解释了每个选项并列出了所有可用选择,这使得以后手动审查和修改变得容易。
|
|
92
92
|
|
|
93
|
-
|
|
93
|
+
以下是生成文件的片段:
|
|
94
94
|
|
|
95
95
|
```yaml config.yaml icon=logos:yaml
|
|
96
96
|
# 用于文档发布的项目信息
|
|
97
97
|
projectName: your-project-name
|
|
98
|
-
projectDesc:
|
|
98
|
+
projectDesc: 你的项目描述。
|
|
99
99
|
projectLogo: ""
|
|
100
100
|
|
|
101
101
|
# =============================================================================
|
|
102
102
|
# 文档配置
|
|
103
103
|
# =============================================================================
|
|
104
104
|
|
|
105
|
-
#
|
|
105
|
+
# 目的:你希望读者实现的主要成果是什么?
|
|
106
106
|
# 可用选项(根据需要取消注释并修改):
|
|
107
107
|
# getStarted - 快速入门:帮助新用户在 30 分钟内从零开始上手
|
|
108
|
-
# completeTasks -
|
|
108
|
+
# completeTasks - 完成特定任务:引导用户了解常见工作流程和用例
|
|
109
109
|
documentPurpose:
|
|
110
110
|
- completeTasks
|
|
111
111
|
- findAnswers
|
|
112
112
|
|
|
113
|
-
#
|
|
113
|
+
# 目标受众:谁会最常阅读本文档?
|
|
114
114
|
# 可用选项(根据需要取消注释并修改):
|
|
115
115
|
# endUsers - 最终用户(非技术人员):使用产品但不编写代码的人
|
|
116
|
-
# developers -
|
|
116
|
+
# developers - 集成你的产品/API 的开发者:将此产品添加到其项目中的工程师
|
|
117
117
|
targetAudienceTypes:
|
|
118
118
|
- endUsers
|
|
119
119
|
- developers
|
|
@@ -123,11 +123,11 @@ targetAudienceTypes:
|
|
|
123
123
|
|
|
124
124
|
## 后续步骤
|
|
125
125
|
|
|
126
|
-
|
|
126
|
+
配置文件就绪后,你就可以生成、翻译或发布文档了。
|
|
127
127
|
|
|
128
128
|
<x-cards>
|
|
129
129
|
<x-card data-title="生成文档" data-icon="lucide:play-circle" data-href="/features/generate-documentation">
|
|
130
|
-
|
|
130
|
+
了解如何使用单个命令从源代码自动创建一套完整的文档。
|
|
131
131
|
</x-card>
|
|
132
132
|
<x-card data-title="配置指南" data-icon="lucide:settings" data-href="/configuration">
|
|
133
133
|
深入了解所有可用设置,并学习如何手动微调 config.yaml 文件。
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# Language Support
|
|
2
2
|
|
|
3
|
-
AIGNE DocSmith
|
|
3
|
+
AIGNE DocSmith uses AI to provide automated documentation translation into 12 languages. This allows you to generate and maintain documentation for a global audience using the `aigne doc translate` command.
|
|
4
4
|
|
|
5
|
-
The translation workflow processes your source documents through
|
|
5
|
+
The translation workflow processes your source documents through an AI engine to generate localized versions in your selected target languages.
|
|
6
6
|
|
|
7
7
|
```d2
|
|
8
8
|
direction: down
|
|
@@ -55,25 +55,25 @@ DocSmith offers AI-powered translations for the following languages. You can def
|
|
|
55
55
|
|
|
56
56
|
## How to Configure and Use Translation
|
|
57
57
|
|
|
58
|
-
Translation languages are set when you initialize your project with `aigne doc init`. You can add new languages or translate documents at any time using the `aigne doc translate` command, which
|
|
58
|
+
Translation languages are set when you initialize your project with `aigne doc init`. You can add new languages or translate documents at any time using the `aigne doc translate` command, which has two modes of operation.
|
|
59
59
|
|
|
60
|
-
### Interactive Mode
|
|
60
|
+
### Interactive Mode for Guided Translation
|
|
61
61
|
|
|
62
|
-
For a guided experience, run the command without any arguments. This is the recommended approach for most users.
|
|
62
|
+
For a step-by-step guided experience, run the command without any arguments. This is the recommended approach for most users.
|
|
63
63
|
|
|
64
64
|
```bash Interactive Translation icon=lucide:wand
|
|
65
65
|
aigne doc translate
|
|
66
66
|
```
|
|
67
67
|
|
|
68
|
-
The interactive mode will then
|
|
68
|
+
The interactive mode will then present a series of prompts that allow you to:
|
|
69
69
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
1. Select which of your existing documents to translate from a list.
|
|
71
|
+
2. Choose one or more target languages from the supported list.
|
|
72
|
+
3. Add new translation languages to your project's configuration if they are not already included.
|
|
73
73
|
|
|
74
|
-
### Command-Line Arguments
|
|
74
|
+
### Command-Line Arguments for Automation
|
|
75
75
|
|
|
76
|
-
For direct control or for use in automated scripts
|
|
76
|
+
For direct control or for use in automated scripts, you can specify documents and languages directly as command-line arguments. This is ideal for developers and CI/CD pipelines.
|
|
77
77
|
|
|
78
78
|
```bash Command Example icon=lucide:terminal
|
|
79
79
|
# Translate overview.md and examples.md into Chinese and Japanese
|
|
@@ -91,4 +91,4 @@ Key parameters for the command include:
|
|
|
91
91
|
|
|
92
92
|
---
|
|
93
93
|
|
|
94
|
-
This section covers the available languages and how to enable them. For a complete guide on the translation workflow,
|
|
94
|
+
This section covers the available languages and how to enable them. For a complete guide on the translation workflow, see the [Translate Documentation](./features-translate-documentation.md) guide.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# 语言支持
|
|
2
2
|
|
|
3
|
-
AIGNE DocSmith 提供 12
|
|
3
|
+
AIGNE DocSmith 使用 AI 提供 12 种语言的自动化文档翻译。这使您可以使用 `aigne doc translate` 命令为全球用户生成和维护文档。
|
|
4
4
|
|
|
5
|
-
翻译工作流通过
|
|
5
|
+
翻译工作流通过 AI 引擎处理您的源文档,以生成您所选目标语言的本地化版本。
|
|
6
6
|
|
|
7
7
|
```d2
|
|
8
8
|
direction: down
|
|
@@ -18,7 +18,7 @@ AI-Engine: {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
Translated-Docs: {
|
|
21
|
-
label: "
|
|
21
|
+
label: "翻译后的文档"
|
|
22
22
|
shape: rectangle
|
|
23
23
|
grid-columns: 3
|
|
24
24
|
|
|
@@ -36,11 +36,11 @@ AI-Engine -> Translated-Docs: "生成"
|
|
|
36
36
|
|
|
37
37
|
## 支持的语言
|
|
38
38
|
|
|
39
|
-
DocSmith 为以下语言提供 AI
|
|
39
|
+
DocSmith 为以下语言提供 AI 翻译。您可以在初始设置期间定义项目的主要语言,并选择任意数量的目标语言进行翻译。
|
|
40
40
|
|
|
41
41
|
| 语言 | 语言代码 | 示例文本 |
|
|
42
42
|
|---|---|---|
|
|
43
|
-
|
|
|
43
|
+
| English | `en` | Hello |
|
|
44
44
|
| 简体中文 | `zh` | 你好 |
|
|
45
45
|
| 繁體中文 | `zh-TW` | 你好 |
|
|
46
46
|
| 日本語 | `ja` | こんにちは |
|
|
@@ -53,27 +53,27 @@ DocSmith 为以下语言提供 AI 翻译功能。你可以在初始设置期间
|
|
|
53
53
|
| Italiano | `it` | Ciao |
|
|
54
54
|
| العربية | `ar` | مرحبا |
|
|
55
55
|
|
|
56
|
-
##
|
|
56
|
+
## 如何配置和使用翻译
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
翻译语言在您使用 `aigne doc init` 初始化项目时设置。您可以随时使用 `aigne doc translate` 命令添加新语言或翻译文档,该命令有两种操作模式。
|
|
59
59
|
|
|
60
|
-
###
|
|
60
|
+
### 用于引导式翻译的交互模式
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
要获得分步指导体验,请在不带任何参数的情况下运行该命令。这是推荐给大多数用户的方法。
|
|
63
63
|
|
|
64
64
|
```bash Interactive Translation icon=lucide:wand
|
|
65
65
|
aigne doc translate
|
|
66
66
|
```
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
然后,交互模式将显示一系列提示,允许您:
|
|
69
69
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
1. 从列表中选择要翻译的现有文档。
|
|
71
|
+
2. 从支持的列表中选择一个或多个目标语言。
|
|
72
|
+
3. 如果项目中尚未包含新的翻译语言,则将其添加到项目配置中。
|
|
73
73
|
|
|
74
|
-
###
|
|
74
|
+
### 用于自动化的命令行参数
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
为了直接控制或在自动化脚本中使用,您可以直接将文档和语言指定为命令行参数。这对于开发人员和 CI/CD 流水线非常理想。
|
|
77
77
|
|
|
78
78
|
```bash Command Example icon=lucide:terminal
|
|
79
79
|
# 将 overview.md 和 examples.md 翻译成中文和日文
|
|
@@ -84,11 +84,11 @@ aigne doc translate --langs zh --langs ja --docs overview.md --docs examples.md
|
|
|
84
84
|
|
|
85
85
|
| 参数 | 描述 |
|
|
86
86
|
|---|---|
|
|
87
|
-
| `--langs` |
|
|
88
|
-
| `--docs` | 指定要翻译的文档路径(例如 `overview.md
|
|
89
|
-
| `--feedback` |
|
|
90
|
-
| `--glossary` | 使用自定义术语表文件(例如 `@path/to/glossary.md
|
|
87
|
+
| `--langs` | 指定目标语言代码。此标志可多次使用以选择多种语言。 |
|
|
88
|
+
| `--docs` | 指定要翻译的文档路径(例如 `overview.md`)。此标志也可以多次使用。 |
|
|
89
|
+
| `--feedback` | 提供具体说明以指导翻译模型(例如 `"Use a formal tone"`)。 |
|
|
90
|
+
| `--glossary` | 使用自定义术语表文件(例如 `@path/to/glossary.md`)以确保项目特定术语的翻译一致。 |
|
|
91
91
|
|
|
92
92
|
---
|
|
93
93
|
|
|
94
|
-
|
|
94
|
+
本节介绍了可用的语言以及如何启用它们。有关翻译工作流的完整指南,请参阅[翻译文档](./features-translate-documentation.md)指南。
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
# LLM Setup
|
|
2
2
|
|
|
3
|
-
AIGNE DocSmith uses Large Language Models (LLMs) to generate documentation content.
|
|
3
|
+
AIGNE DocSmith uses Large Language Models (LLMs) to generate documentation content. You can configure the AI model provider in two ways: using the integrated AIGNE Hub, or by connecting your own custom API keys.
|
|
4
4
|
|
|
5
5
|
## AIGNE Hub (Recommended)
|
|
6
6
|
|
|
7
|
-
The
|
|
7
|
+
The most direct way to start is with AIGNE Hub. It functions as a gateway to multiple LLM providers, offering two main benefits:
|
|
8
8
|
|
|
9
|
-
- **No API Key Required:**
|
|
10
|
-
- **Easy Model Switching:**
|
|
9
|
+
- **No API Key Required:** You can generate documents without managing your own API keys or service subscriptions.
|
|
10
|
+
- **Easy Model Switching:** You can change the AI model for any command by using the `--model` flag.
|
|
11
11
|
|
|
12
12
|
To use a specific model through AIGNE Hub, add the `--model` flag to your command. Here are a few examples:
|
|
13
13
|
|
|
14
|
-
```bash
|
|
14
|
+
```bash Using Different Models via AIGNE Hub icon=mdi:code-braces
|
|
15
|
+
# Use Google's Gemini 2.5 Flash model
|
|
15
16
|
aigne doc generate --model google:gemini-2.5-flash
|
|
16
17
|
|
|
17
18
|
# Use Anthropic's Claude 3.5 Sonnet model
|
|
@@ -21,33 +22,33 @@ aigne doc generate --model claude:claude-3-5-sonnet
|
|
|
21
22
|
aigne doc generate --model openai:gpt-4o
|
|
22
23
|
```
|
|
23
24
|
|
|
24
|
-
If you
|
|
25
|
+
If you do not specify a model, DocSmith will use the default model defined in your project's configuration.
|
|
25
26
|
|
|
26
27
|
## Using Custom API Keys
|
|
27
28
|
|
|
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.
|
|
29
|
+
If you prefer to use your own accounts with providers like OpenAI or Anthropic, you can configure DocSmith with your personal API keys. This method gives you direct control over API usage and billing.
|
|
29
30
|
|
|
30
|
-
Configuration is handled through an interactive wizard. To launch it, run:
|
|
31
|
+
Configuration is handled through an interactive wizard. To launch it, run the following command:
|
|
31
32
|
|
|
32
33
|
```bash
|
|
33
34
|
aigne doc init
|
|
34
35
|
```
|
|
35
36
|
|
|
36
|
-
The wizard will prompt you to select your provider and enter your credentials. For a complete guide,
|
|
37
|
+
The wizard will prompt you to select your provider and enter your credentials. For a complete guide, refer to the [Interactive Setup](./configuration-interactive-setup.md) documentation.
|
|
37
38
|
|
|
38
39
|
## Setting a Default Model
|
|
39
40
|
|
|
40
|
-
To
|
|
41
|
+
To maintain 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 for any command that does not include the `--model` flag.
|
|
41
42
|
|
|
42
|
-
```yaml aigne.yaml icon=mdi:file-
|
|
43
|
+
```yaml aigne.yaml icon=mdi:file-code
|
|
43
44
|
chat_model:
|
|
44
45
|
provider: google
|
|
45
46
|
name: gemini-2.5-pro
|
|
46
47
|
temperature: 0.8
|
|
47
48
|
```
|
|
48
49
|
|
|
49
|
-
In this
|
|
50
|
+
In this example, DocSmith is configured to use Google's `gemini-2.5-pro` model with a `temperature` setting of `0.8` by default.
|
|
50
51
|
|
|
51
52
|
---
|
|
52
53
|
|
|
53
|
-
|
|
54
|
+
With your LLM provider configured, you are ready to manage language settings 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,17 +1,18 @@
|
|
|
1
1
|
# LLM 设置
|
|
2
2
|
|
|
3
|
-
AIGNE DocSmith
|
|
3
|
+
AIGNE DocSmith 使用大语言模型 (LLM) 生成文档内容。你可以通过两种方式配置 AI 模型提供商:使用集成的 AIGNE Hub,或连接你自己的自定义 API 密钥。
|
|
4
4
|
|
|
5
|
-
## AIGNE Hub
|
|
5
|
+
## AIGNE Hub(推荐)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
最直接的入门方式是使用 AIGNE Hub。它作为一个通往多个 LLM 提供商的网关,提供两大主要优势:
|
|
8
8
|
|
|
9
|
-
- **无需 API 密钥:**
|
|
10
|
-
- **轻松切换模型:**
|
|
9
|
+
- **无需 API 密钥:** 你无需管理自己的 API 密钥或服务订阅即可生成文档。
|
|
10
|
+
- **轻松切换模型:** 你可以通过使用 `--model` 标志为任何命令更改 AI 模型。
|
|
11
11
|
|
|
12
|
-
要通过 AIGNE Hub 使用特定模型,请在命令中添加 `--model`
|
|
12
|
+
要通过 AIGNE Hub 使用特定模型,请在命令中添加 `--model` 标志。以下是几个示例:
|
|
13
13
|
|
|
14
|
-
```bash
|
|
14
|
+
```bash 通过 AIGNE Hub 使用不同模型 icon=mdi:code-braces
|
|
15
|
+
# 使用 Google 的 Gemini 2.5 Flash 模型
|
|
15
16
|
aigne doc generate --model google:gemini-2.5-flash
|
|
16
17
|
|
|
17
18
|
# 使用 Anthropic 的 Claude 3.5 Sonnet 模型
|
|
@@ -21,33 +22,33 @@ aigne doc generate --model claude:claude-3-5-sonnet
|
|
|
21
22
|
aigne doc generate --model openai:gpt-4o
|
|
22
23
|
```
|
|
23
24
|
|
|
24
|
-
|
|
25
|
+
如果你未指定模型,DocSmith 将使用项目配置中定义的默认模型。
|
|
25
26
|
|
|
26
27
|
## 使用自定义 API 密钥
|
|
27
28
|
|
|
28
|
-
如果你更喜欢使用自己在 OpenAI 或 Anthropic
|
|
29
|
+
如果你更喜欢使用自己在 OpenAI 或 Anthropic 等提供商处的账户,可以用你的个人 API 密钥来配置 DocSmith。这种方法让你能够直接控制 API 的使用和计费。
|
|
29
30
|
|
|
30
|
-
|
|
31
|
+
配置通过一个交互式向导进行处理。要启动它,请运行以下命令:
|
|
31
32
|
|
|
32
33
|
```bash
|
|
33
34
|
aigne doc init
|
|
34
35
|
```
|
|
35
36
|
|
|
36
|
-
|
|
37
|
+
向导将提示你选择提供商并输入凭据。有关完整指南,请参阅 [交互式设置](./configuration-interactive-setup.md) 文档。
|
|
37
38
|
|
|
38
39
|
## 设置默认模型
|
|
39
40
|
|
|
40
|
-
|
|
41
|
+
为了在所有文档生成任务中保持一致性,你可以在项目的 `aigne.yaml` 配置文件中设置一个默认的 LLM。任何不包含 `--model` 标志的命令都将使用此模型。
|
|
41
42
|
|
|
42
|
-
```yaml aigne.yaml icon=mdi:file-
|
|
43
|
+
```yaml aigne.yaml icon=mdi:file-code
|
|
43
44
|
chat_model:
|
|
44
45
|
provider: google
|
|
45
46
|
name: gemini-2.5-pro
|
|
46
47
|
temperature: 0.8
|
|
47
48
|
```
|
|
48
49
|
|
|
49
|
-
|
|
50
|
+
在此示例中,DocSmith 被配置为默认使用 Google 的 `gemini-2.5-pro` 模型,并将 `temperature` 设置为 `0.8`。
|
|
50
51
|
|
|
51
52
|
---
|
|
52
53
|
|
|
53
|
-
|
|
54
|
+
配置好 LLM 提供商后,你就可以管理文档的语言设置了。请继续阅读 [语言支持](./configuration-language-support.md) 指南,查看支持的语言完整列表并了解如何启用它们。
|
|
@@ -4,7 +4,7 @@ AIGNE DocSmith is designed to learn from your feedback. When you refine or corre
|
|
|
4
4
|
|
|
5
5
|
## The Preference Lifecycle
|
|
6
6
|
|
|
7
|
-
The following diagram illustrates how your feedback becomes a reusable rule that can be applied to future tasks and managed
|
|
7
|
+
The following diagram illustrates how your feedback becomes a reusable rule that can be applied to future tasks and managed from the command line.
|
|
8
8
|
|
|
9
9
|
```d2 The Preference Lifecycle
|
|
10
10
|
direction: down
|
|
@@ -48,23 +48,23 @@ cli <-> pref_file: "Manages"
|
|
|
48
48
|
|
|
49
49
|
```
|
|
50
50
|
|
|
51
|
-
### How
|
|
51
|
+
### How Preferences are Created
|
|
52
52
|
|
|
53
|
-
When you provide feedback during the `refine` or `translate` stages, an internal agent
|
|
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.
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
### Rule Properties
|
|
56
56
|
|
|
57
|
-
|
|
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. |
|
|
57
|
+
Each rule saved in `preferences.yml` has the following structure:
|
|
66
58
|
|
|
67
|
-
|
|
59
|
+
<x-field data-name="id" data-type="string" data-desc="A unique, randomly generated identifier for the rule (e.g., pref_a1b2c3d4e5f6g7h8)."></x-field>
|
|
60
|
+
<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>
|
|
61
|
+
<x-field data-name="scope" data-type="string" data-desc="Defines when the rule should be applied. Valid scopes are 'global', 'structure', 'document', or 'translation'."></x-field>
|
|
62
|
+
<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>
|
|
63
|
+
<x-field data-name="feedback" data-type="string" data-desc="The original, natural language feedback provided by the user, preserved for reference."></x-field>
|
|
64
|
+
<x-field data-name="createdAt" data-type="string" data-desc="The ISO 8601 timestamp indicating when the rule was created."></x-field>
|
|
65
|
+
<x-field data-name="paths" data-type="string[]" data-required="false" data-desc="An optional list of file paths. If present, the rule only applies to content generated for these specific source files."></x-field>
|
|
66
|
+
|
|
67
|
+
## Managing Preferences with the CLI
|
|
68
68
|
|
|
69
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.
|
|
70
70
|
|
|
@@ -76,9 +76,7 @@ To see all saved preferences, both active and inactive, use the `--list` flag.
|
|
|
76
76
|
aigne doc prefs --list
|
|
77
77
|
```
|
|
78
78
|
|
|
79
|
-
The command displays a formatted list
|
|
80
|
-
|
|
81
|
-
**Example Output:**
|
|
79
|
+
The command displays a formatted list showing the status, scope, ID, and any path limitations for each rule.
|
|
82
80
|
|
|
83
81
|
```text Example Output icon=lucide:clipboard-list
|
|
84
82
|
# User Preferences
|
|
@@ -94,20 +92,17 @@ The command displays a formatted list explaining the status, scope, ID, and any
|
|
|
94
92
|
|
|
95
93
|
⚪ [document] pref_i9j0k1l2m3n4o5p6
|
|
96
94
|
Code comments must be written in English.
|
|
97
|
-
|
|
98
95
|
```
|
|
99
96
|
|
|
100
|
-
###
|
|
101
|
-
|
|
102
|
-
If you want to temporarily disable a rule without deleting it, you can toggle its active status. Use the `--toggle` flag.
|
|
97
|
+
### Deactivating and Reactivating Preferences
|
|
103
98
|
|
|
104
|
-
Running the command without an ID will launch an interactive mode, allowing you to select one or more preferences to toggle
|
|
99
|
+
If you want to temporarily disable a rule without deleting it, you can toggle its active status using the `--toggle` flag. Running the command without an ID will launch an interactive mode, allowing you to select one or more preferences to toggle.
|
|
105
100
|
|
|
106
101
|
```bash Toggle preferences interactively icon=lucide:terminal
|
|
107
102
|
aigne doc prefs --toggle
|
|
108
103
|
```
|
|
109
104
|
|
|
110
|
-
To toggle specific
|
|
105
|
+
To toggle a specific rule directly, provide its ID using the `--id` flag. This corresponds to the `deactivateRule` function, which sets the rule's `active` property to `false`.
|
|
111
106
|
|
|
112
107
|
```bash Toggle a specific preference icon=lucide:terminal
|
|
113
108
|
aigne doc prefs --toggle --id pref_i9j0k1l2m3n4o5p6
|
|
@@ -115,15 +110,15 @@ aigne doc prefs --toggle --id pref_i9j0k1l2m3n4o5p6
|
|
|
115
110
|
|
|
116
111
|
### Removing Preferences
|
|
117
112
|
|
|
118
|
-
To permanently delete one or more preferences, use the `--remove` flag. This action cannot be undone.
|
|
113
|
+
To permanently delete one or more preferences, use the `--remove` flag. This action, which corresponds to the `removeRule` function, cannot be undone.
|
|
119
114
|
|
|
120
|
-
For an interactive selection prompt, run the command without an ID
|
|
115
|
+
For an interactive selection prompt, run the command without an ID.
|
|
121
116
|
|
|
122
117
|
```bash Remove preferences interactively icon=lucide:terminal
|
|
123
118
|
aigne doc prefs --remove
|
|
124
119
|
```
|
|
125
120
|
|
|
126
|
-
To remove specific
|
|
121
|
+
To remove a specific rule directly by its ID, use the `--id` flag.
|
|
127
122
|
|
|
128
123
|
```bash Remove a specific preference icon=lucide:terminal
|
|
129
124
|
aigne doc prefs --remove --id pref_a1b2c3d4e5f6g7h8
|
|
@@ -131,4 +126,4 @@ aigne doc prefs --remove --id pref_a1b2c3d4e5f6g7h8
|
|
|
131
126
|
|
|
132
127
|
## Next Steps
|
|
133
128
|
|
|
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).
|
|
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).
|