package com.supervision.rasa.controller; import com.supervision.rasa.service.RasaFileService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import jdk.internal.org.objectweb.asm.tree.FieldInsnNode; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import java.io.IOException; @Api(tags = "rasa文件保存") @RestController @RequestMapping("rasaFile") @RequiredArgsConstructor public class RasaFileController { private final RasaFileService rasaFileService; @ApiOperation("接受并保存rasa文件") @PostMapping("/saveRasaFile") public String saveRasaFile(@RequestParam("file") MultipartFile file) throws IOException { if (file == null || file.isEmpty()) { return "file is empty"; } rasaFileService.saveRasaFile(file); return "ok"; } }