Files
OCR/.env
egg 7233e9cb7b fix: logging, warnings, and soft-delete consistency
- Fix duplicate logging in multi-worker mode with file lock for cleanup scheduler
- Add Pydantic V2 model_config to suppress protected_namespaces warning
- Suppress PaddlePaddle ccache warnings
- Fix admin.py using non-existent User.username (now uses email)
- Fix get_user_stats to exclude soft-deleted tasks from statistics
- Fix create_task to exclude soft-deleted tasks from user limit check
- Change LOG_LEVEL default to INFO

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-14 15:40:31 +08:00

117 lines
3.3 KiB
Bash

# Tool_OCR - Environment Configuration Template
# Copy this file to .env and fill in your actual values
# ===== Database Configuration =====
MYSQL_HOST=mysql.theaken.com
MYSQL_PORT=33306
MYSQL_USER=A060
MYSQL_PASSWORD=WLeSCi0yhtc7
MYSQL_DATABASE=db_A060
# ===== Application Configuration =====
# Server ports
BACKEND_PORT=8000
FRONTEND_PORT=5173
# Security
SECRET_KEY=your-secret-key-here-please-change-this-to-random-string
ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=1440
# ===== External Authentication Configuration =====
# External authentication API URL
EXTERNAL_AUTH_API_URL=https://pj-auth-api.vercel.app
# Authentication endpoint path
EXTERNAL_AUTH_ENDPOINT=/api/auth/login
# API request timeout in seconds
EXTERNAL_AUTH_TIMEOUT=30
# Token refresh buffer in seconds (refresh tokens X seconds before expiry)
TOKEN_REFRESH_BUFFER=300
# ===== Task Management Configuration =====
# Database table prefix for clear namespace separation
DATABASE_TABLE_PREFIX=tool_ocr_
# Enable task history feature
ENABLE_TASK_HISTORY=true
# Auto-delete old tasks after X days (0 to disable)
TASK_RETENTION_DAYS=30
# Maximum tasks per user (0 for unlimited)
MAX_TASKS_PER_USER=1000
# ===== OCR Configuration =====
# Note: PaddleOCR/PaddleX models are stored in ~/.paddleocr/ and ~/.paddlex/ by default
# Supported languages (comma-separated)
OCR_LANGUAGES=ch,en,japan,korean
# Default confidence threshold
OCR_CONFIDENCE_THRESHOLD=0.5
# Maximum concurrent OCR workers
MAX_OCR_WORKERS=4
# GPU Acceleration Configuration
# Force CPU mode even if GPU is available (default: false)
FORCE_CPU_MODE=false
# GPU memory fraction (0.0-1.0, default: 0.8)
GPU_MEMORY_FRACTION=0.8
# GPU device ID to use (default: 0, -1 for CPU)
GPU_DEVICE_ID=0
# ===== File Upload Configuration =====
# Maximum file size in bytes (50MB default)
MAX_UPLOAD_SIZE=52428800
# Allowed file extensions (comma-separated)
ALLOWED_EXTENSIONS=png,jpg,jpeg,pdf,bmp,tiff,doc,docx,ppt,pptx
# Upload directories
UPLOAD_DIR=./uploads
TEMP_DIR=./uploads/temp
PROCESSED_DIR=./uploads/processed
IMAGES_DIR=./uploads/images
# ===== Export Configuration =====
# Storage directories
STORAGE_DIR=./storage
MARKDOWN_DIR=./storage/markdown
JSON_DIR=./storage/json
EXPORTS_DIR=./storage/exports
# ===== PDF Generation Configuration =====
# Pandoc path (Linux)
PANDOC_PATH=/usr/bin/pandoc
# WeasyPrint font directory
FONT_DIR=/usr/share/fonts
# Default PDF page size
PDF_PAGE_SIZE=A4
# Default PDF margins (mm)
PDF_MARGIN_TOP=20
PDF_MARGIN_BOTTOM=20
PDF_MARGIN_LEFT=20
PDF_MARGIN_RIGHT=20
# ===== Translation Configuration (DIFY API) =====
# Enable translation feature
ENABLE_TRANSLATION=true
# DIFY API base URL
DIFY_BASE_URL=https://dify.theaken.com/v1
# DIFY API key (required for translation)
DIFY_API_KEY=app-YOPrF2ro5fshzMkCZviIuUJd
# API request timeout in seconds
DIFY_TIMEOUT=120.0
# Maximum retry attempts
DIFY_MAX_RETRIES=3
# Batch translation limits
DIFY_MAX_BATCH_CHARS=5000
DIFY_MAX_BATCH_ITEMS=20
# ===== Background Tasks Configuration =====
# Task queue type: memory (default) or redis (future)
TASK_QUEUE_TYPE=memory
# Redis URL (if using redis)
# REDIS_URL=redis://localhost:6379/0
# ===== CORS Configuration =====
# Allowed origins (comma-separated, * for all)
CORS_ORIGINS=http://localhost:5173,http://127.0.0.1:5173
# ===== Logging Configuration =====
LOG_LEVEL=INFO
LOG_FILE=./logs/app.log