From 9cb0b960435ca93a14facf9a4cb9e5a9b4a426c0 Mon Sep 17 00:00:00 2001 From: xunbu Date: Wed, 28 May 2025 17:37:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86=E4=BA=8C=E6=AC=A1?= =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=90=8E=E4=B8=8B=E8=BD=BD=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/workspace.xml | 7 ++++--- docutranslate/__init__.py | 2 +- docutranslate/app.py | 9 +++------ 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 9dffb3f..eb2bad9 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -6,8 +6,8 @@ - - + + @@ -613,7 +614,7 @@ - + diff --git a/docutranslate/__init__.py b/docutranslate/__init__.py index 6bd6edb..9699b43 100644 --- a/docutranslate/__init__.py +++ b/docutranslate/__init__.py @@ -1,4 +1,4 @@ -__version__="0.2.29" +__version__="0.2.30" diff --git a/docutranslate/app.py b/docutranslate/app.py index 0bbf985..a099724 100644 --- a/docutranslate/app.py +++ b/docutranslate/app.py @@ -279,7 +279,7 @@ async def handle_translate( "code_ocr": code_ocr, "refine_markdown": refine_markdown, "convert_engin": convert_engin, "mineru_token": mineru_token, - "custom_prompt_translate":custom_prompt_translate, + "custom_prompt_translate": custom_prompt_translate, } loop = asyncio.get_running_loop() @@ -386,9 +386,7 @@ async def download_markdown(filename_with_ext: str): print("Markdown 内容尚未准备好或不可用。") raise HTTPException(status_code=404, detail="Markdown 内容尚未准备好或不可用。") - requested_stem = Path(filename_with_ext).stem.replace("_translated", "") - if requested_stem != current_state["original_filename_stem"]: - print("请求的文件名与当前结果不符。") + if Path(filename_with_ext).stem != f"{current_state['original_filename_stem']}_translated": raise HTTPException(status_code=404, detail="请求的文件名与当前结果不符。") actual_filename = f"{current_state['original_filename_stem']}_translated.md" @@ -406,8 +404,7 @@ async def download_html(filename_with_ext: str): "original_filename_stem"]: raise HTTPException(status_code=404, detail="HTML 内容尚未准备好或不可用。") - requested_stem = Path(filename_with_ext).stem.replace("_translated", "") - if requested_stem != current_state["original_filename_stem"]: + if Path(filename_with_ext).stem != f"{current_state['original_filename_stem']}_translated": raise HTTPException(status_code=404, detail="请求的文件名与当前结果不符。") actual_filename = f"{current_state['original_filename_stem']}_translated.html"