fix: 解决md不允许上传的问题

This commit is contained in:
oliviamn 2025-05-26 00:06:37 +08:00
parent b3cf9f98a7
commit 345fd05a2b
4 changed files with 8 additions and 3 deletions

View File

@ -20,7 +20,7 @@ class Settings(BaseSettings):
UPLOAD_FOLDER: Path = BASE_DIR / "storage" / "uploads"
PROCESSED_FOLDER: Path = BASE_DIR / "storage" / "processed"
MAX_FILE_SIZE: int = 50 * 1024 * 1024 # 50MB
ALLOWED_EXTENSIONS: set = {"pdf", "docx", "doc"}
ALLOWED_EXTENSIONS: set = {"pdf", "docx", "doc", "md"}
# Celery
CELERY_BROKER_URL: str = "redis://redis:6379/0"

View File

@ -5,8 +5,8 @@ from ..services.ollama_client import OllamaClient
logger = logging.getLogger(__name__)
class DocumentService:
def __init__(self, ollama_client: OllamaClient):
self.ollama_client = ollama_client
def __init__(self):
pass
def process_document(self, input_path: str, output_path: str) -> bool:
try:

View File

@ -8,6 +8,8 @@ services:
volumes:
- ./storage:/app/storage
- ./legal_doc_masker.db:/app/legal_doc_masker.db
env_file:
- .env
environment:
- CELERY_BROKER_URL=redis://redis:6379/0
- CELERY_RESULT_BACKEND=redis://redis:6379/0
@ -20,6 +22,8 @@ services:
volumes:
- ./storage:/app/storage
- ./legal_doc_masker.db:/app/legal_doc_masker.db
env_file:
- .env
environment:
- CELERY_BROKER_URL=redis://redis:6379/0
- CELERY_RESULT_BACKEND=redis://redis:6379/0

View File

@ -30,6 +30,7 @@ const FileUpload: React.FC<FileUploadProps> = ({ onUploadComplete }) => {
'application/pdf': ['.pdf'],
'application/msword': ['.doc'],
'application/vnd.openxmlformats-officedocument.wordprocessingml.document': ['.docx'],
'text/markdown': ['.md'],
},
});