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"