diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index d4f132d..7144ad5 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -6,10 +6,10 @@
-
+
+
-
@@ -58,6 +58,7 @@
"Python.app (1).executor": "Run",
"Python.app.executor": "Run",
"Python.app2.executor": "Run",
+ "Python.app_test (1).executor": "Run",
"Python.convert.executor": "Run",
"Python.markdown_splitter.executor": "Debug",
"Python.markdown_utils.executor": "Run",
@@ -98,7 +99,7 @@
-
+
@@ -261,7 +262,27 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -287,7 +308,53 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -301,7 +368,7 @@
-
+
@@ -310,7 +377,7 @@
-
+
@@ -319,58 +386,12 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -524,11 +545,11 @@
-
+
+
+
-
-
@@ -593,7 +614,9 @@
-
+
+
+
@@ -601,26 +624,27 @@
-
-
+
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/docutranslate/agents/markdown_agent.py b/docutranslate/agents/markdown_agent.py
index 30523f9..bc65882 100644
--- a/docutranslate/agents/markdown_agent.py
+++ b/docutranslate/agents/markdown_agent.py
@@ -13,13 +13,13 @@ class MDRefineAgent(Agent):
对于缺失、中断的句子,应该查看缺失的语句是否可能被错误的放在了其他位置,并通过句子拼接修复不合理之处
去掉异常字词,修复错误格式
# 要求
-If refine is unnecessary, return the original text.
-NO explanations. NO notes.
+如果修正不必要,则返回原文。
+不要解释,不要注释。
不要修改标题的级别(如一级标题不要修改为二级标题)
形如的占位符不要改变
code、latex和HTML保持结构
所有公式(包括短公式)都应该是latex公式
-修复不正确的latex公式,包括要被$正确包裹以构造合法latex表达式
+修复不正确的latex公式,要用$正确包裹以构造合法latex表达式
# 输出
修正后的markdown纯文本(不是markdown代码块)
# 示例
diff --git a/docutranslate/app.py b/docutranslate/app.py
index eb2e3fc..8f1759b 100644
--- a/docutranslate/app.py
+++ b/docutranslate/app.py
@@ -85,8 +85,8 @@ HTML_TEMPLATE = """
:root { --primary-color: #1e88e5; --border-radius: 0.25rem; }
body { padding: 20px; background-color: #f9f9f9; }
.container { max-width: 800px; margin: auto; background-color: white; padding: 2rem; border-radius: 8px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05); }
- h1 { font-size: 1.8rem; margin-bottom: 1.5rem; color: var(--primary-color); display: flex; align-items: center; gap: 0.5rem; }
- .log-area { background-color: #f5f5f5; border: 1px solid #e0e0e0; border-radius: var(--border-radius); padding: 10px; height: 200px; overflow-y: scroll; white-space: pre-wrap; word-break: break-all; font-family: monospace; font-size: 0.85em; line-height: 1.4; margin-top: 1rem; }
+ h1 { font-size: 1.8rem; margin-bottom: 1.5rem; display: flex; align-items: center; gap: 0.5rem; }
+ .log-area { background-color: #f5f5f5; border: 1px solid #e0e0e0; padding: 10px; height: 200px; overflow-y: scroll; white-space: pre-wrap; word-break: break-all; font-family: monospace; font-size: 0.85em; line-height: 1.4; margin-top: 1rem; }
.error-message { color: #d32f2f; font-weight: 500; }
.success-message { color: #2e7d32; font-weight: 500; }
.form-group { margin-bottom: 1rem; }
@@ -101,7 +101,7 @@ HTML_TEMPLATE = """
#resultArea { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid #eee; }
#downloadButtons { display: none; margin-top: 1rem; }
.section-header { display: flex; align-items: center; margin-bottom: 0.5rem; font-size: 1.1rem; font-weight: 500; }
- select, input[type="text"], input[type="password"], input[type="file"] { padding: 0.5rem; border: 1px solid #ddd; border-radius: var(--border-radius); background-color: white; }
+ select, input[type="text"], input[type="password"], input[type="file"] { padding: 0.5rem; border: 1px solid #ddd; background-color: white; }
button, a[role="button"] { padding: 0.5rem 1rem; }
.options-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }
@media print { .no-print { display: none !important; } body { padding: 0; background-color: white; } .container { box-shadow: none; max-width: 100%; padding: 0; } }
@@ -109,7 +109,7 @@ HTML_TEMPLATE = """
.modal-content { position: relative; background-color: #fff; margin: 2% auto; padding: 20px; width: 90%; max-width: 900px; max-height: 90vh; border-radius: 8px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2); overflow: auto; }
.close-modal { position: absolute; top: 10px; right: 10px; font-size: 24px; font-weight: bold; color: #666; cursor: pointer; }
.modal-actions { display: flex; justify-content: flex-end; margin-top: 20px; gap: 10px; }
- #previewFrame { width: 100%; min-height: 500px; border: 1px solid #ddd; border-radius: var(--border-radius); }
+ #previewFrame { width: 100%; min-height: 500px; border: 1px solid #ddd; }
#printFrame { display: none; }
.hidden { display: none !important; }
@media (max-width: 768px) { .form-grid, .options-grid { grid-template-columns: 1fr; } .container { padding: 1rem; } }
diff --git a/docutranslate/translater.py b/docutranslate/translater.py
index 1c1ff69..26f0eb5 100644
--- a/docutranslate/translater.py
+++ b/docutranslate/translater.py
@@ -128,7 +128,7 @@ class FileTranslater:
if refine_agent is None:
refine_agent = MDRefineAgent(**self.default_agent_params())
result: list[str] = refine_agent.send_prompts(chuncks)
- self.markdown = "\n".join(result)
+ self.markdown = "\n\n".join(result)
self._unmask_uris_in_markdown()
translater_logger.info("markdown已修正")
return self.markdown
@@ -140,7 +140,7 @@ class FileTranslater:
if translate_agent is None:
translate_agent = MDTranslateAgent(to_lang=to_lang, **self.default_agent_params())
result: list[str] = translate_agent.send_prompts(chuncks)
- self.markdown = "\n".join(result)
+ self.markdown = "\n\n".join(result)
self._unmask_uris_in_markdown()
translater_logger.info("翻译完成")
return self.markdown
diff --git a/pyproject.toml b/pyproject.toml
index 4322dd4..c70c156 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
[project]
name = "docutranslate"
-version = "0.2.4"
+version = "0.2.6"
description = "文件翻译工具"
readme = "README.md"
requires-python = ">=3.10"
@@ -9,7 +9,7 @@ dependencies = [
"httpx",
"markdown2",
"fastapi[standard]>=0.115.12",
-# "pyinstaller>=6.13.0",
+ "pyinstaller>=6.13.0",
]
[project.scripts]