新增mineru部署converter

This commit is contained in:
xunbu
2025-11-04 16:57:44 +08:00
parent 534a71c67b
commit 34ddb0b94c

View File

@@ -17,23 +17,23 @@ 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[str] | None = None
backend: Literal["pipeline", "vlm"] = "pipeline" # 默认值 backend: Literal["pipeline", "vlm"] = "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
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
return_content_list: bool = False # 默认值 # return_content_list: bool = False
return_images: bool = True # 默认值 # return_images: bool = True
response_format_zip: bool = True # 默认值 # response_format_zip: bool = True
start_page_id: int = 0 # 默认值 start_page_id: int = 0
end_page_id: int = 99999 # 默认值 end_page_id: int = 99999
def gethash(self) ->Hashable: def gethash(self) ->Hashable:
return (self.backend,self.formula_enable,self.table_enable) return (self.backend,self.formula_enable,self.start_page_id,self.end_page_id)
# 配置HTTP客户端 # 配置HTTP客户端
timeout = httpx.Timeout( timeout = httpx.Timeout(
@@ -61,16 +61,16 @@ class ConverterMineruDeploy(X2MarkdownConverter):
data = { data = {
"output_dir": self.config.output_dir, "output_dir": self.config.output_dir,
"backend": self.config.backend, "backend": self.config.backend,
"parse_method": self.config.parse_method, "parse_method": "auto",
"formula_enable": self.config.formula_enable, "formula_enable": self.config.formula_enable,
"table_enable": self.config.table_enable, "table_enable": True,
"server_url": self.config.server_url, "server_url": None,
"return_md": self.config.return_md, "return_md": True,
"return_middle_json": self.config.return_middle_json, "return_middle_json": True,
"return_model_output": self.config.return_model_output, "return_model_output": False,
"return_content_list": self.config.return_content_list, "return_content_list": False,
"return_images": self.config.return_images, "return_images": True,
"response_format_zip": self.config.response_format_zip, "response_format_zip": True,
"start_page_id": self.config.start_page_id, "start_page_id": self.config.start_page_id,
"end_page_id": self.config.end_page_id "end_page_id": self.config.end_page_id
} }