From 276a1401f45e1a218c6afd51786bcb3778b992a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E8=88=AA=E5=AE=87?= <3364451258@qq.com> Date: Fri, 10 Jul 2026 15:27:19 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20content=20=E6=A8=A1=E5=BC=8F=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=20file=5Fname=20=E6=94=B9=E7=94=A8=20UUID=20=E9=98=B2?= =?UTF-8?q?=E5=B9=B6=E5=8F=91=E8=A6=86=E7=9B=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/server/app.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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: