feat: Release v0.10 - Modular Architecture & External Config
- Refactor codebase into src/ (preprocessing, translation, assembly) - Add pipeline/ scripts for individual stages - Externalize configuration to config/config.yaml - Fix Cover Image preservation - Update documentation and manuals
This commit is contained in:
@@ -1,54 +0,0 @@
|
||||
{
|
||||
"translation": {
|
||||
"chunk_size": 5000,
|
||||
"temperature": 0.3,
|
||||
"glossary": {
|
||||
"enabled": true,
|
||||
"auto_generate": true,
|
||||
"sample_size": 3000
|
||||
}
|
||||
},
|
||||
"output": {
|
||||
"output_dir": "output",
|
||||
"filename_suffix": "_bilingual"
|
||||
},
|
||||
"logging": {
|
||||
"level": "INFO",
|
||||
"file": "logs/translator.log",
|
||||
"rotation": "10 MB",
|
||||
"retention": "7 days"
|
||||
},
|
||||
"providers": {
|
||||
"openrouter": {
|
||||
"base_url": "https://openrouter.ai/api/v1",
|
||||
"api_key": "YOUR_OPENROUTER_API_KEY",
|
||||
"models": {
|
||||
"fast": "google/gemini-2.0-flash-001",
|
||||
"smart": "google/gemini-2.0-flash-thinking-exp:free"
|
||||
},
|
||||
"extra_headers": {
|
||||
"HTTP-Referer": "https://github.com/epub-translator",
|
||||
"X-Title": "EPUB Translator"
|
||||
},
|
||||
"rate_limits": {
|
||||
"requests_per_minute": 60,
|
||||
"concurrent_requests": 32
|
||||
}
|
||||
},
|
||||
"v3": {
|
||||
"base_url": "https://api.gpt.ge/v1",
|
||||
"api_key": "YOUR_V3_API_KEY",
|
||||
"models": {
|
||||
"fast": "gpt-4o-mini",
|
||||
"smart": "gpt-4o"
|
||||
},
|
||||
"extra_headers": {
|
||||
"x-foo": "true"
|
||||
},
|
||||
"rate_limits": {
|
||||
"requests_per_minute": 500,
|
||||
"concurrent_requests": 50
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
# LLM Configuration
|
||||
llm:
|
||||
# Model name (e.g., gpt-4o, gpt-3.5-turbo, deepseek-chat)
|
||||
model: "google/gemini-3-flash-preview"
|
||||
#model: "gemini-3-pro-low"
|
||||
|
||||
# API Base URL (default is OpenAI)
|
||||
#base_url: "https://api.gpt.ge/v1"
|
||||
#base_url: "http://192.168.50.100:11434/v1"
|
||||
base_url: "https://openrouter.ai/api/v1"
|
||||
|
||||
# Timeout for API requests in seconds
|
||||
timeout: 60
|
||||
|
||||
# Rate Limiting
|
||||
requests_per_minute: 60
|
||||
concurrent_requests: 4
|
||||
|
||||
# Translation Settings
|
||||
translation:
|
||||
# Characters per chunk (approximate)
|
||||
chunk_size: 6000
|
||||
|
||||
# System prompt instruction file (optional, overrides default if present)
|
||||
# style_guide_path: "config/style_guide.txt"
|
||||
@@ -1,39 +0,0 @@
|
||||
{
|
||||
"llm": {
|
||||
"provider": "openrouter",
|
||||
"base_url": "https://openrouter.ai/api/v1",
|
||||
"api_key": "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",
|
||||
"models": {
|
||||
"fast": "google/gemini-3-flash-preview",
|
||||
"smart": "google/gemini-3-pro-preview"
|
||||
},
|
||||
"arena_models": [
|
||||
"google/gemini-3-flash-preview",
|
||||
"openai/gpt-5-mini",
|
||||
"anthropic/claude-haiku-4.5"
|
||||
],
|
||||
"judge_model": "openai/gpt-5.1",
|
||||
"rate_limits": {
|
||||
"requests_per_minute": 60,
|
||||
"concurrent_requests": 32
|
||||
}
|
||||
},
|
||||
"translation": {
|
||||
"chunk_size": 5000,
|
||||
"temperature": 0.3,
|
||||
"strategy": "arena_winner"
|
||||
},
|
||||
"processing": {
|
||||
"min_paragraph_length": 5
|
||||
},
|
||||
"output": {
|
||||
"output_dir": "output",
|
||||
"filename_suffix": "_bilingual"
|
||||
},
|
||||
"logging": {
|
||||
"level": "INFO",
|
||||
"file": "logs/translator.log",
|
||||
"rotation": "10 MB",
|
||||
"retention": "7 days"
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -1,10 +1,10 @@
|
||||
{
|
||||
"translation": {
|
||||
"system": "你是一位精通中英文的专业翻译家。你的任务是翻译书籍内容。\n\n要求:\n1. 准确传达原文含义,语言流畅自然,符合中文阅读习惯。\n2. 严格保持【p_xxxxx】编号格式,不要遗漏,不要修改编号。\n3. 不要添加任何解释、注释或无关内容,只返回【编号】+【译文】。\n\n{{glossary_instruction}}",
|
||||
"user_template": "请翻译以下段落:\n\n{{content}}"
|
||||
"system": "你是一位精通中英文的专业翻译家。你的任务是将英文书籍内容翻译成中文。\n\n【核心要求】\n1. 准确传达原文含义,语言流畅自然,符合中文阅读习惯。\n2. 保持原文的风格和语气。\n\n【格式要求 - 极其重要】\n1. 每行格式:#N: 译文(N是行号,必须原样保留)\n2. 输入多少行,输出必须是相同数量的行\n3. **占位符规则**:原文中的 φXφ 和 φ/Xφ 标记必须原样保留在译文中\n - 成对标记:\"φ1φBoldφ/1φ\" → \"φ1φ粗体φ/1φ\"\n - 单体标记:\"φ2φ\" 表示公式或符号,保持位置不变\n - 尾注锚点:文末的 \"φ3φ\" 是超链接,必须保留\n\n【禁止事项】\n- 禁止修改 #N: 行号\n- 禁止删除或修改任何 φXφ 标记\n- 禁止添加解释或注释\n- 禁止合并或拆分行",
|
||||
"user_template": "请翻译以下段落(务必原样保留所有 φnφ 格式标记):\n\n{{content}}"
|
||||
},
|
||||
"glossary_extraction": {
|
||||
"system": "你是一位资深的文学编辑和领域专家。你的任务是分析书籍样本,提取关键术语并制定统一的译名表。",
|
||||
"user_template": "请阅读以下书籍片段(包含前言和正文采样)。\n\n任务:\n1. 识别文中出现的人名(如 'Masa', 'Steve Jobs')、地名、机构名。\n2. 识别特定的行业术语或关键概念。\n3. 为上述词汇提供标准的中文译名。如果像 'Masa' 这样的昵称有对应的全名(如孙正义),请务必使用全名。\n\n请以 JSON 格式输出,格式如下:\n{\n \"Masa\": \"孙正义\",\n \"Apple\": \"苹果公司\",\n ...\n}\n\n书籍片段:\n\n{{content}}"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user