Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion apps/api/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@ ILOVEAPI_SECRET_KEY=
# MINERU_TOKEN_RPM_LIMIT=300
# MINERU_TOKEN_DAILY_LIMIT=10000
# MINERU_TOKEN_COOLDOWN_SECONDS=60
# FORCE_MINERU_UPLOAD_ENABLED=false
# False prefers S3 URL mode when the source object is reusable. Set true only
# when MinerU cannot fetch your storage URLs and direct upload is required.
# MINERU_UPLOAD_MODE_ENABLED=false
# ILOVEAPI_BASE_URL=https://api.ilovepdf.com/v1
# ILOVEAPI_TIMEOUT=120

Expand Down
5 changes: 3 additions & 2 deletions apps/worker/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ ILOVEAPI_SECRET_KEY=
# MINERU_TOKEN_RPM_LIMIT=300
# MINERU_TOKEN_DAILY_LIMIT=10000
# MINERU_TOKEN_COOLDOWN_SECONDS=60
# FORCE_MINERU_UPLOAD_ENABLED=false
# False prefers S3 URL mode when the source object is reusable. Set true only
# when MinerU cannot fetch your storage URLs and direct upload is required.
# MINERU_UPLOAD_MODE_ENABLED=false
# ILOVEAPI_BASE_URL=https://api.ilovepdf.com/v1
# ILOVEAPI_TIMEOUT=120

Expand All @@ -117,4 +119,3 @@ MAX_FILE_SIZE=104857600
# Legacy parser compatibility fields.
# ALL_DF_COLS=content,path,type,length,keywords,summary,know_id,tokens,connectto,addtime,page_nums
# SPLIT_CHAR=/

Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,7 @@


def _should_use_mineru_s3_url_mode(s3_key: Optional[str]) -> bool:
if settings.FORCE_MINERU_UPLOAD_ENABLED:
return False

return settings.ENVIRONMENT != "development" and s3_key is not None
return not settings.MINERU_UPLOAD_MODE_ENABLED and s3_key is not None


def _log_mineru_url_mode_storage_fallback(
Expand Down
7 changes: 4 additions & 3 deletions packages/shared-python/shared/core/config/mineru.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,12 @@ class MineruConfig(BaseModel):
default=2,
description="Backoff factor between upload retries.",
)
FORCE_MINERU_UPLOAD_ENABLED: bool = Field(
MINERU_UPLOAD_MODE_ENABLED: bool = Field(
default=False,
description=(
"Force MinerU direct-upload ingestion and disable S3 URL mode even when "
"a reusable source object is available."
"Use MinerU direct-upload ingestion instead of S3 URL mode. "
"Disabled by default so workers prefer S3 URL mode when a reusable "
"source object is available."
),
)
MINERU_URL_MODE_PRESIGN_EXPIRY: int = Field(
Expand Down
Loading