|
8 | 8 |
|
9 | 9 | import pandas as pd |
10 | 10 | from fastapi import APIRouter, File, UploadFile, Query |
11 | | -from fastapi.responses import StreamingResponse, FileResponse |
| 11 | +from fastapi.responses import StreamingResponse |
12 | 12 |
|
13 | 13 | from apps.chat.models.chat_model import AxisObj |
14 | 14 | from apps.data_training.curd.data_training import page_data_training, create_training, update_training, delete_training, \ |
15 | 15 | enable_training, get_all_data_training, batch_create_training |
16 | 16 | from apps.data_training.models.data_training_model import DataTrainingInfo |
17 | 17 | from common.core.config import settings |
18 | 18 | from common.core.deps import SessionDep, CurrentUser, Trans |
19 | | -from common.core.file import FileRequest |
20 | 19 | from common.utils.data_format import DataFormat |
21 | 20 |
|
22 | 21 | router = APIRouter(tags=["DataTraining"], prefix="/system/data-training") |
@@ -213,30 +212,3 @@ def inner(): |
213 | 212 | } |
214 | 213 |
|
215 | 214 | return await asyncio.to_thread(inner) |
216 | | - |
217 | | - |
218 | | -@router.post("/download-fail-info") |
219 | | -async def download_excel(req: FileRequest): |
220 | | - """ |
221 | | - 根据文件路径下载 Excel 文件 |
222 | | - """ |
223 | | - filename = req.file |
224 | | - file_path = os.path.join(path, filename) |
225 | | - |
226 | | - # 检查文件是否存在 |
227 | | - if not os.path.exists(file_path): |
228 | | - raise HTTPException(404, "File Not Exists") |
229 | | - |
230 | | - # 检查文件是否是 Excel 文件 |
231 | | - if not filename.endswith('_error.xlsx'): |
232 | | - raise HTTPException(400, "Only support _error.xlsx") |
233 | | - |
234 | | - # 获取文件名 |
235 | | - filename = os.path.basename(file_path) |
236 | | - |
237 | | - # 返回文件 |
238 | | - return FileResponse( |
239 | | - path=file_path, |
240 | | - filename=filename, |
241 | | - media_type='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' |
242 | | - ) |
0 commit comments