|
|
@@ -11,6 +11,11 @@ import io.swagger.v3.oas.annotations.Parameter;
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+
|
|
|
+import org.springaicommunity.mcp.annotation.McpTool;
|
|
|
+import org.springaicommunity.mcp.annotation.McpToolParam;
|
|
|
+import org.springframework.ai.tool.annotation.Tool;
|
|
|
+import org.springframework.ai.tool.annotation.ToolParam;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
@@ -32,15 +37,20 @@ public class OssFileController {
|
|
|
/**
|
|
|
* 上传文件
|
|
|
*/
|
|
|
+ @McpTool(name = "upload-file", description = "上传文件到OSS并记录")
|
|
|
@Operation(summary = "上传文件", description = "上传文件到OSS并记录")
|
|
|
@PostMapping("/upload")
|
|
|
public Result<OssFile> uploadFile(
|
|
|
+ @McpToolParam(description = "文件", required = true)
|
|
|
@Parameter(description = "文件", required = true)
|
|
|
@RequestParam("file") MultipartFile file,
|
|
|
+ @McpToolParam(description = "存储文件夹路径,如:images/、videos/")
|
|
|
@Parameter(description = "存储文件夹路径,如:images/、videos/")
|
|
|
@RequestParam(value = "folder", required = false, defaultValue = "") String folder,
|
|
|
+ @McpToolParam(description = "文件类型,如:image、video、document")
|
|
|
@Parameter(description = "文件类型,如:image、video、document")
|
|
|
@RequestParam(value = "fileType", required = false, defaultValue = "document") String fileType,
|
|
|
+ @ToolParam(description = "业务分类(1:创意 2:品牌形象)")
|
|
|
@Parameter(description = "业务分类(1:创意 2:品牌形象)")
|
|
|
@RequestParam(value = "businessType", required = false) Integer businessType,
|
|
|
@AuthUser SysUser sysUser) {
|
|
|
@@ -68,14 +78,21 @@ public class OssFileController {
|
|
|
/**
|
|
|
* 分页查询文件列表
|
|
|
*/
|
|
|
+ @McpTool(name = "list-files", description = "分页查询文件列表")
|
|
|
@Operation(summary = "分页查询文件列表", description = "根据条件分页查询文件列表")
|
|
|
@GetMapping("/list")
|
|
|
public Result<Page<OssFile>> listFiles(
|
|
|
+ @McpToolParam(description = "页码")
|
|
|
@Parameter(description = "页码") @RequestParam(defaultValue = "1") Long page,
|
|
|
+ @McpToolParam(description = "每页数量")
|
|
|
@Parameter(description = "每页数量") @RequestParam(defaultValue = "10") Long size,
|
|
|
+ @McpToolParam(description = "文件类型", required = false)
|
|
|
@Parameter(description = "文件类型") @RequestParam(required = false) String fileType,
|
|
|
+ @McpToolParam(description = "业务分类(1:创意 2:品牌形象)", required = false)
|
|
|
@Parameter(description = "业务分类(1:创意 2:品牌形象)") @RequestParam(required = false) Integer businessType,
|
|
|
+ @McpToolParam(description = "文件名(模糊查询)", required = false)
|
|
|
@Parameter(description = "文件名(模糊查询)") @RequestParam(required = false) String fileName,
|
|
|
+ @McpToolParam(description = "创建人id", required = false)
|
|
|
@Parameter(description = "创建人id") @RequestParam(required = false) Long userId) {
|
|
|
try {
|
|
|
Page<OssFile> result = ossFileService.listFiles(page, size, fileType, businessType, fileName, userId);
|