fix(avatar): allow knowledge uploads up to 20MB

This commit is contained in:
stefanfeng
2026-09-04 13:47:46 +08:00
parent b98a2b9507
commit 28553aba15
2 changed files with 6 additions and 2 deletions
@@ -17,7 +17,7 @@ UPLOAD_DIR = os.path.abspath(os.getenv("UPLOAD_DIR", os.path.join(BASE_DIR, "upl
os.makedirs(UPLOAD_DIR, exist_ok=True)
ALLOWED_EXT = {".md", ".txt", ".pdf", ".doc", ".docx", ".xlsx"}
MAX_UPLOAD_BYTES = 10 * 1024 * 1024
MAX_UPLOAD_BYTES = 20 * 1024 * 1024
class QAIn(BaseModel):
@@ -82,7 +82,7 @@ async def upload_doc(avatar_id: str, file: UploadFile = File(...), authorization
path = os.path.join(avatar_dir, stored)
content = await file.read()
if len(content) > MAX_UPLOAD_BYTES:
return fail("文件不能超过 10MB", code=400)
return fail("文件不能超过 20MB", code=400)
with open(path, "wb") as f:
f.write(content)
doc = KnowledgeDoc(