diff --git a/src/server/app.py b/src/server/app.py index 4fb45c9..54a0f99 100644 --- a/src/server/app.py +++ b/src/server/app.py @@ -1,5 +1,6 @@ """FastAPI 服务层.""" import os +import uuid import logging from pathlib import Path @@ -126,7 +127,7 @@ def ingest_document( file_name = path.name else: # content 模式 (file_path/content 互斥由 Pydantic 校验保证) - file_name = req.file_name or "untitled.md" + file_name = req.file_name or f"untitled_{uuid.uuid4().hex[:8]}.md" count = ingestor.ingest_content(req.content, file_name) return {"status": "ok", "chunks": count, "file": file_name, "collection": ingestor.collection_name} except HTTPException: