From 479c4f56a2dd9c9c19dc030022a20b74cb46d3f2 Mon Sep 17 00:00:00 2001 From: Liuyang <2746366019@qq.com> Date: Mon, 24 Mar 2025 13:34:47 +0800 Subject: [PATCH] =?UTF-8?q?refactor(module-llm):=E4=BC=98=E5=8C=96=20Datas?= =?UTF-8?q?etController=20=E4=B8=AD=E7=9A=84=E6=96=87=E4=BB=B6=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 更新导入语句,增加必要的异常处理 - 修改 downloadExampleFile 方法,优化代码格式 - 调整 getFileInfo 方法,统一代码风格 --- .../llm/controller/admin/dataset/DatasetController.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/controller/admin/dataset/DatasetController.java b/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/controller/admin/dataset/DatasetController.java index 27b9068cf..cd4dc1bf4 100644 --- a/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/controller/admin/dataset/DatasetController.java +++ b/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/controller/admin/dataset/DatasetController.java @@ -23,7 +23,9 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; -import java.io.*; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; import java.net.URLEncoder; import java.util.List; @@ -102,7 +104,7 @@ public class DatasetController { @GetMapping("/download-example") @Operation(summary = "下载示例文件") - public ResponseEntity downloadExampleFile(@RequestParam("type") int type, HttpServletResponse response) throws IOException { + public ResponseEntity downloadExampleFile (@RequestParam("type") int type, HttpServletResponse response) throws IOException { FileInfoVO fileInfo = getFileInfo(type); // 从 resources/file/dataset_example 目录加载文件 @@ -121,7 +123,7 @@ public class DatasetController { .body(new InputStreamResource(inputStream)); } - private FileInfoVO getFileInfo(int type) { + private FileInfoVO getFileInfo (int type) { switch (type) { case 1: return new FileInfoVO("dataset_example_txt.txt", "text/plain");