适配最新的mineru-api,允许设置lang_list和server-url
This commit is contained in:
@@ -460,7 +460,14 @@ class MarkdownWorkflowParams(BaseWorkflowParams):
|
|||||||
"http://127.0.0.1:8000",
|
"http://127.0.0.1:8000",
|
||||||
description="[仅当 convert_engine='mineru_deploy'] 本地部署的 MinerU 服务地址。",
|
description="[仅当 convert_engine='mineru_deploy'] 本地部署的 MinerU 服务地址。",
|
||||||
)
|
)
|
||||||
mineru_deploy_backend: Literal["pipeline", "transformers", "mlx-engine", "vllm-engine", "vllm-async-engine"] = Field(
|
mineru_deploy_backend: Literal[
|
||||||
|
"pipeline",
|
||||||
|
"vlm-transformers",
|
||||||
|
"vlm-mlx-engine",
|
||||||
|
"vlm-vllm-async-engine",
|
||||||
|
"vlm-lmdeploy-engine",
|
||||||
|
"vlm-http-client"
|
||||||
|
] = Field(
|
||||||
"pipeline",
|
"pipeline",
|
||||||
description="[仅当 convert_engine='mineru_deploy'] 本地部署的 MinerU 服务使用的后端。",
|
description="[仅当 convert_engine='mineru_deploy'] 本地部署的 MinerU 服务使用的后端。",
|
||||||
)
|
)
|
||||||
@@ -474,6 +481,12 @@ class MarkdownWorkflowParams(BaseWorkflowParams):
|
|||||||
mineru_deploy_end_page_id: int = Field(
|
mineru_deploy_end_page_id: int = Field(
|
||||||
99999, description="[仅当 convert_engine='mineru_deploy'] 结束解析页面。"
|
99999, description="[仅当 convert_engine='mineru_deploy'] 结束解析页面。"
|
||||||
)
|
)
|
||||||
|
mineru_deploy_lang_list: Optional[List[str]] = Field(
|
||||||
|
None, description="[仅当 convert_engine='mineru_deploy' 且 backend='pipeline'] 语言列表。"
|
||||||
|
)
|
||||||
|
mineru_deploy_server_url: Optional[str] = Field(
|
||||||
|
None, description="[仅当 convert_engine='mineru_deploy' 且 backend='vlm-http-client'] Server URL."
|
||||||
|
)
|
||||||
|
|
||||||
@model_validator(mode="after")
|
@model_validator(mode="after")
|
||||||
def check_engine_params(self):
|
def check_engine_params(self):
|
||||||
@@ -1005,6 +1018,8 @@ async def _perform_translation(
|
|||||||
formula_enable=payload.mineru_deploy_formula_enable,
|
formula_enable=payload.mineru_deploy_formula_enable,
|
||||||
start_page_id=payload.mineru_deploy_start_page_id,
|
start_page_id=payload.mineru_deploy_start_page_id,
|
||||||
end_page_id=payload.mineru_deploy_end_page_id,
|
end_page_id=payload.mineru_deploy_end_page_id,
|
||||||
|
lang_list=payload.mineru_deploy_lang_list,
|
||||||
|
server_url=payload.mineru_deploy_server_url,
|
||||||
)
|
)
|
||||||
elif payload.convert_engine == "docling" and DOCLING_EXIST:
|
elif payload.convert_engine == "docling" and DOCLING_EXIST:
|
||||||
converter_config = ConverterDoclingConfig(
|
converter_config = ConverterDoclingConfig(
|
||||||
|
|||||||
@@ -17,12 +17,12 @@ from docutranslate.utils.markdown_utils import embed_inline_image_from_zip
|
|||||||
class ConverterMineruDeployConfig(X2MarkdownConverterConfig):
|
class ConverterMineruDeployConfig(X2MarkdownConverterConfig):
|
||||||
base_url: str = "http://127.0.0.1:8000"
|
base_url: str = "http://127.0.0.1:8000"
|
||||||
output_dir: str = "./output" # 覆盖默认值 ./output
|
output_dir: str = "./output" # 覆盖默认值 ./output
|
||||||
# lang_list: list[str] | None = None
|
lang_list: list[Literal["ch", "ch_server", "ch_lite", "en", "korean", "japan", "chinese_cht", "ta", "te", "ka", "th", "el", "latin", "arabic", "east_slavic", "cyrillic", "devanagari"]] | None = None
|
||||||
backend: Literal["pipeline", "transformers", "mlx-engine", "vllm-engine", "vllm-async-engine"] = "pipeline"
|
backend: Literal["pipeline", "vlm-transformers", "vlm-mlx-engine", "vlm-vllm-async-engine", "vlm-lmdeploy-engine","vlm-http-client"] = "pipeline"
|
||||||
# parse_method: str = "auto"
|
# parse_method: str = "auto"
|
||||||
formula_enable: bool = True
|
formula_enable: bool = True
|
||||||
# table_enable: bool = True
|
# table_enable: bool = True
|
||||||
# server_url: str | None = None
|
server_url: str | None = None #(Adapted only for vlm-http-client backend)openai compatible server url, e.g., http://127.0.0.1:30000
|
||||||
# return_md: bool = True
|
# return_md: bool = True
|
||||||
# return_middle_json: bool = True
|
# return_middle_json: bool = True
|
||||||
# return_model_output: bool = False
|
# return_model_output: bool = False
|
||||||
|
|||||||
@@ -71,6 +71,9 @@
|
|||||||
"mineruDeployBackendMlx": "MLX Engine",
|
"mineruDeployBackendMlx": "MLX Engine",
|
||||||
"mineruDeployBackendVllm": "VLLM Engine",
|
"mineruDeployBackendVllm": "VLLM Engine",
|
||||||
"mineruDeployBackendVllmAsync": "VLLM Async Engine",
|
"mineruDeployBackendVllmAsync": "VLLM Async Engine",
|
||||||
|
"mineruDeployLangListLabel": "语言列表 (Pipeline模式)",
|
||||||
|
"mineruDeployServerUrlLabel": "Server URL",
|
||||||
|
"mineruDeployServerUrlPlaceholder": "例如: http://127.0.0.1:30000",
|
||||||
"mineruDeployStartPageLabel": "起始页面",
|
"mineruDeployStartPageLabel": "起始页面",
|
||||||
"mineruDeployEndPageLabel": "结束页面",
|
"mineruDeployEndPageLabel": "结束页面",
|
||||||
"mineruDeployFormulaEnableLabel": "启用公式解析",
|
"mineruDeployFormulaEnableLabel": "启用公式解析",
|
||||||
@@ -163,7 +166,7 @@
|
|||||||
"engineOptionDocling": "Docling",
|
"engineOptionDocling": "Docling",
|
||||||
"engineOptionMineruDeploy": "Mineru部署服务",
|
"engineOptionMineruDeploy": "Mineru部署服务",
|
||||||
"engineOptionMineru_deploy": "Mineru部署服务",
|
"engineOptionMineru_deploy": "Mineru部署服务",
|
||||||
"apiHrefInfo302ai": "👈由此链接注册可享受1刀免费额度",
|
"apiHrefInfo302ai": "👈由此链接注册可享受1美元免费额度",
|
||||||
"glossaryEmpty": "术语表为空",
|
"glossaryEmpty": "术语表为空",
|
||||||
"status_selectFileFirst": "请先选择文件!",
|
"status_selectFileFirst": "请先选择文件!",
|
||||||
"status_fillRequired": "请填写所有必填项!",
|
"status_fillRequired": "请填写所有必填项!",
|
||||||
@@ -265,6 +268,9 @@
|
|||||||
"mineruDeployBackendMlx": "MLX Engine",
|
"mineruDeployBackendMlx": "MLX Engine",
|
||||||
"mineruDeployBackendVllm": "VLLM Engine",
|
"mineruDeployBackendVllm": "VLLM Engine",
|
||||||
"mineruDeployBackendVllmAsync": "VLLM Async Engine",
|
"mineruDeployBackendVllmAsync": "VLLM Async Engine",
|
||||||
|
"mineruDeployLangListLabel": "Language List (Pipeline Mode)",
|
||||||
|
"mineruDeployServerUrlLabel": "Server URL",
|
||||||
|
"mineruDeployServerUrlPlaceholder": "e.g., http://127.0.0.1:30000",
|
||||||
"mineruDeployStartPageLabel": "Start Page",
|
"mineruDeployStartPageLabel": "Start Page",
|
||||||
"mineruDeployEndPageLabel": "End Page",
|
"mineruDeployEndPageLabel": "End Page",
|
||||||
"mineruDeployFormulaEnableLabel": "Enable Formula Parsing",
|
"mineruDeployFormulaEnableLabel": "Enable Formula Parsing",
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user