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 036d30f0e..82f0f4188 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 @@ -104,9 +104,9 @@ public class DatasetController { BeanUtils.toBean(list, DatasetRespVO.class)); } - @GetMapping("/download-example-excel") + @GetMapping("/download-example") @Operation(summary = "下载示例文件") - public ResponseEntity downloadExampleExcelFile (@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 目录加载文件 @@ -125,26 +125,26 @@ public class DatasetController { .body(new InputStreamResource(inputStream)); } - @GetMapping("/download-example") - @Operation(summary = "下载示例文件") - public CommonResult downloadExampleFile (@RequestParam("type") int type) throws IOException { - FileInfoVO fileInfo = getFileInfo(type); - ClassPathResource resource = new ClassPathResource("file/dataset_example/" + fileInfo.getFileName()); - if (!resource.exists()) { - throw new FileNotFoundException("文件未找到: " + fileInfo.getFileName()); - } - - try (InputStream inputStream = resource.getInputStream(); - ByteArrayOutputStream byteStream = new ByteArrayOutputStream()) { - byte[] buffer = new byte[1024]; - int bytesRead; - while ((bytesRead = inputStream.read(buffer)) != -1) { - byteStream.write(buffer, 0, bytesRead); - } - String base64 = Base64.getEncoder().encodeToString(byteStream.toByteArray()); - return CommonResult.success(base64); - } - } +// @GetMapping("/download-example") +// @Operation(summary = "下载示例文件") +// public CommonResult downloadExampleFile (@RequestParam("type") int type) throws IOException { +// FileInfoVO fileInfo = getFileInfo(type); +// ClassPathResource resource = new ClassPathResource("file/dataset_example/" + fileInfo.getFileName()); +// if (!resource.exists()) { +// throw new FileNotFoundException("文件未找到: " + fileInfo.getFileName()); +// } +// +// try (InputStream inputStream = resource.getInputStream(); +// ByteArrayOutputStream byteStream = new ByteArrayOutputStream()) { +// byte[] buffer = new byte[1024]; +// int bytesRead; +// while ((bytesRead = inputStream.read(buffer)) != -1) { +// byteStream.write(buffer, 0, bytesRead); +// } +// String base64 = Base64.getEncoder().encodeToString(byteStream.toByteArray()); +// return CommonResult.success(base64); +// } +// } private FileInfoVO getFileInfo (int type) { switch (type) {