From 814a47cca3a721ba506053d27bd50e07778287b0 Mon Sep 17 00:00:00 2001 From: xunbu Date: Tue, 13 May 2025 18:01:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/workspace.xml | 18 +++++++++--------- README.md | 2 +- app.spec | 2 +- docutranslate/agents/markdown_agent.py | 8 +++----- docutranslate/app.py | 6 +++--- docutranslate/translater.py | 2 +- pyproject.toml | 2 +- 7 files changed, 19 insertions(+), 21 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 333b42a..a7f6090 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -5,12 +5,12 @@ - - - - + + + + + + - - + - @@ -636,7 +636,7 @@ - + diff --git a/README.md b/README.md index 5e967fe..8977137 100644 --- a/README.md +++ b/README.md @@ -136,7 +136,7 @@ translater = FileTranslater(base_url="", # 默认的模型baseurl key="", # 默认的模型api-key model_id="", # 默认的模型id chunksize=3500, # markdown分块长度(单位byte),分块越大效果越好,不建议超过8000 - max_concurrent=10, # 并发数,受到ai平台并发量限制,如果文章很长建议适当加大到20以上 + max_concurrent=15, # 并发数,受到ai平台并发量限制,如果文章很长建议适当加大到20以上 docling_artifact=None, # 使用提前下载好的docling模型 timeout=2000, # 调用api的超时时间 tips=True # 开场提示 diff --git a/app.spec b/app.spec index b264975..81a7eec 100644 --- a/app.spec +++ b/app.spec @@ -50,5 +50,5 @@ coll = COLLECT( strip=False, upx=True, upx_exclude=[], - name='app', + name='DocuTranslate', ) diff --git a/docutranslate/agents/markdown_agent.py b/docutranslate/agents/markdown_agent.py index db27216..e5c1562 100644 --- a/docutranslate/agents/markdown_agent.py +++ b/docutranslate/agents/markdown_agent.py @@ -2,7 +2,6 @@ from typing import Unpack from .agent_async import Agent, AgentArgs - class MDRefineAgent(Agent): def __init__(self,**kwargs:Unpack[AgentArgs]): super().__init__(**kwargs) @@ -43,15 +42,14 @@ class MDTranslateAgent(Agent): super().__init__(**kwargs) self.system_prompt=f""" # 角色 -You are a professional, authentic machine translation engine. +你是一个专业的机器翻译引擎 # 工作 翻译输入的markdown文本 目标语言{to_lang} # 要求 -If translation is unnecessary (e.g. proper nouns, codes, etc.), return the original text. -NO explanations. NO notes. +如果翻译不必要(例如专有名词、代码等),则返回原文。 +没有解释,没有注释。 不要修改标题的级别(如一级标题不要修改为二级标题) -文章的作者名不要翻译 引用的参考文献和其作者不要翻译 形如的占位符不要改变 code、latex和HTML只翻译说明文字,其余保持原文 diff --git a/docutranslate/app.py b/docutranslate/app.py index 93795ef..eb2e3fc 100644 --- a/docutranslate/app.py +++ b/docutranslate/app.py @@ -118,8 +118,7 @@ HTML_TEMPLATE = """

- - DocuTranslate (Polling) + DocuTranslate

@@ -135,7 +134,8 @@ HTML_TEMPLATE = """ - + +