llm_translate 0.4.0 → 0.6.0

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.
data/test_new_config.yml DELETED
@@ -1,184 +0,0 @@
1
- # llm_translate.yml - 翻译工具配置文件
2
-
3
- # AI 模型配置
4
- ai:
5
- # API 密钥
6
- api_key: xxxx
7
-
8
- # API 主机地址
9
- host: https://aihubmix.com
10
-
11
- # 模型提供商
12
- provider: "claude"
13
-
14
- # 模型名称
15
- model: "claude-3-7-sonnet-20250219"
16
-
17
- # 模型参数
18
- temperature: 0.3
19
- max_tokens: 4000
20
- top_p: 1.0
21
-
22
- # 请求重试配置
23
- retry_attempts: 3
24
- retry_delay: 2 # 秒
25
-
26
- # 请求超时时间
27
- timeout: 60 # 秒
28
-
29
- # 翻译配置
30
- translation:
31
- # 默认翻译 prompt
32
- default_prompt: |
33
- 请将以下 Markdown 内容翻译为中文,保持所有格式不变:
34
- - 保留代码块、链接、图片等 Markdown 语法
35
- - 保留英文的专业术语和产品名称
36
- - 确保翻译自然流畅
37
-
38
- 内容:
39
- {content}
40
-
41
- # 目标语言
42
- target_language: "zh-CN"
43
-
44
- # 源语言(auto 为自动检测)
45
- source_language: "auto"
46
-
47
- # 是否保留原文格式
48
- preserve_formatting: true
49
-
50
- # 是否翻译代码注释
51
- translate_code_comments: false
52
-
53
-
54
-
55
- # 文件处理配置
56
- files:
57
- # 输入目录
58
- input_directory: "./docs"
59
-
60
- # 输出目录
61
- output_directory: "./docs-translated"
62
-
63
- # 输入文件
64
- input_file: "./README.md"
65
-
66
- # 输出文件
67
- output_file: "./README.zh.md"
68
-
69
- # 文件名后缀策略
70
- filename_strategy: "suffix" # suffix, replace, directory
71
- filename_suffix: ".zh" # 仅当 strategy 为 suffix 时使用
72
-
73
- # 包含的文件模式
74
- include_patterns:
75
- - "**/*.md"
76
- - "**/*.markdown"
77
-
78
- # 排除的文件模式
79
- exclude_patterns:
80
- - "**/node_modules/**"
81
- - "**/.*"
82
- - "**/*.tmp"
83
- - "**/README.md" # 示例:排除 README 文件
84
-
85
- # 是否保持目录结构
86
- preserve_directory_structure: true
87
-
88
- # 文件覆盖策略
89
- overwrite_policy: "ask" # ask, overwrite, skip, backup
90
-
91
- # 备份目录(当 overwrite_policy 为 backup 时)
92
- backup_directory: "./backups"
93
-
94
- # 日志配置
95
- logging:
96
- # 日志级别
97
- level: "info" # debug, info, warn, error
98
-
99
- # 日志输出位置
100
- output: "console" # console, file, both
101
-
102
- # 日志文件路径(当 output 包含 file 时)
103
- file_path: "./logs/llm_translate.log"
104
-
105
- # 是否记录详细的翻译过程
106
- verbose_translation: false
107
-
108
- # 错误日志文件
109
- error_log_path: "./logs/errors.log"
110
-
111
- # 错误处理配置
112
- error_handling:
113
- # 遇到错误时的行为
114
- on_error: "log_and_continue" # stop, log_and_continue, skip_file
115
-
116
- # 最大连续错误数(超过则停止)
117
- max_consecutive_errors: 5
118
-
119
- # 错误重试次数
120
- retry_on_failure: 2
121
-
122
- # 生成错误报告
123
- generate_error_report: true
124
- error_report_path: "./logs/error_report.md"
125
-
126
- # 性能配置
127
- performance:
128
- # 并发处理文件数
129
- concurrent_files: 3
130
-
131
- # 批处理大小(同时翻译的文件数)
132
- batch_size: 5
133
-
134
- # 请求间隔(避免 API 限流)
135
- request_interval: 1 # 秒
136
-
137
- # 内存使用限制
138
- max_memory_mb: 500
139
-
140
- # 输出配置
141
- output:
142
- # 是否显示进度条
143
- show_progress: true
144
-
145
- # 是否显示翻译统计
146
- show_statistics: true
147
-
148
- # 是否生成翻译报告
149
- generate_report: true
150
- report_path: "./reports/translation_report.md"
151
-
152
- # 输出格式
153
- format: "markdown" # markdown, json, yaml
154
-
155
- # 是否保留元数据
156
- include_metadata: true
157
-
158
- # 预设配置(可通过 --preset 参数使用)
159
- presets:
160
- chinese:
161
- translation:
162
- target_language: "zh-CN"
163
- default_prompt: "翻译为简体中文,保持技术术语的准确性"
164
-
165
- japanese:
166
- translation:
167
- target_language: "ja"
168
- default_prompt: "日本語に翻訳してください。技術用語は正確に保ってください"
169
-
170
- english:
171
- translation:
172
- target_language: "en"
173
- default_prompt: "Translate to English, maintaining technical accuracy"
174
-
175
- # 自定义 Hook(高级功能)
176
- hooks:
177
- # 翻译前处理
178
- pre_translation: null
179
-
180
- # 翻译后处理
181
- post_translation: null
182
-
183
- # 文件处理完成后
184
- post_file_processing: null