Commit a5a680b7 authored by myhloli's avatar myhloli
Browse files

refactor: use dynamic suffix lists for file type checks in fast_api.py

parent 802ccd93
......@@ -11,7 +11,7 @@ from typing import List, Optional
from loguru import logger
from base64 import b64encode
from mineru.cli.common import aio_do_parse, read_fn
from mineru.cli.common import aio_do_parse, read_fn, pdf_suffixes, image_suffixes
from mineru.utils.cli_parser import arg_parse
from mineru.version import __version__
......@@ -69,7 +69,7 @@ async def parse_pdf(
file_path = Path(file.filename)
# 如果是图像文件或PDF,使用read_fn处理
if file_path.suffix.lower() in [".pdf", ".png", ".jpeg", ".jpg"]:
if file_path.suffix.lower() in pdf_suffixes + image_suffixes:
# 创建临时文件以便使用read_fn
temp_path = Path(unique_dir) / file_path.name
with open(temp_path, "wb") as f:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment