|
|
@@ -258,12 +258,10 @@ async def import_project_dataset(
|
|
|
upload_dir = settings.uploads_dir
|
|
|
upload_dir.mkdir(parents=True, exist_ok=True)
|
|
|
|
|
|
- safe_name = f"{project_name or project_id}_{file_name}" if project_name else file_name
|
|
|
- # 清理文件名中的非法字符
|
|
|
- safe_name = "".join(c if c.isalnum() or c in "._-" else "_" for c in safe_name)
|
|
|
- file_path = upload_dir / safe_name
|
|
|
+ safe_name = "".join(c if c.isalnum() or c in "._-" else "_" for c in (project_name or project_id))
|
|
|
+ file_path = upload_dir / f"{safe_name}.jsonl"
|
|
|
if file_path.exists():
|
|
|
- file_path = upload_dir / f"{uuid.uuid4().hex[:8]}_{safe_name}"
|
|
|
+ file_path = upload_dir / f"{uuid.uuid4().hex[:8]}_{safe_name}.jsonl"
|
|
|
|
|
|
file_path.write_bytes(file_content)
|
|
|
|
|
|
@@ -275,7 +273,7 @@ async def import_project_dataset(
|
|
|
record_id = str(uuid.uuid4())
|
|
|
record = DatasetRecord(
|
|
|
id=record_id,
|
|
|
- name=jsonl_path.name,
|
|
|
+ name=project_name or project_id,
|
|
|
format="jsonl",
|
|
|
record_count=record_count,
|
|
|
file_path=str(jsonl_path),
|