feat(backend): 更新 API 支持语义分割和 embedding 配置

- chunks API 添加 embedding 配置字段
- projects API 更新路由和方法

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Developer
2026-03-18 16:08:08 +08:00
parent da2887d913
commit cc2e73c595
2 changed files with 26 additions and 0 deletions

View File

@@ -2,6 +2,8 @@
Projects API Router
"""
import logging
import shutil
from pathlib import Path
from typing import List, Optional
from uuid import UUID
from fastapi import APIRouter, Depends, Query
@@ -107,5 +109,12 @@ async def delete_project(
logger.info(f"Deleting project: id={project_id}")
await project_crud.get_or_raise(db, project_id, "Project")
await project_crud.delete(db, project_id)
# 删除项目对应的本地数据目录
project_data_dir = Path("/data/code/YG-Datasets/data") / str(project_id)
if project_data_dir.exists():
shutil.rmtree(project_data_dir)
logger.info(f"Project data directory deleted: {project_data_dir}")
logger.info(f"Project deleted: id={project_id}")
return ApiResponse.ok(message="Project deleted successfully")