|
@@ -2,6 +2,7 @@ package com.bosshand.virgo.file.controller;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.bosshand.virgo.core.response.Response;
|
|
import com.bosshand.virgo.core.response.Response;
|
|
|
|
+import com.bosshand.virgo.core.utils.FileUtil;
|
|
import com.bosshand.virgo.exception.BadRequestException;
|
|
import com.bosshand.virgo.exception.BadRequestException;
|
|
import com.bosshand.virgo.exception.Constant;
|
|
import com.bosshand.virgo.exception.Constant;
|
|
import com.bosshand.virgo.file.model.FileNode;
|
|
import com.bosshand.virgo.file.model.FileNode;
|
|
@@ -120,6 +121,24 @@ public class FileNodeController {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @ApiOperation("上传生成的图片")
|
|
|
|
+ @RequestMapping(value = "/filenode/miniMax", method = RequestMethod.POST)
|
|
|
|
+ public Response uploadFromDify(@RequestBody JSONObject jsonObject) {
|
|
|
|
+ InputStream inputStream = null;
|
|
|
|
+ try {
|
|
|
|
+ byte[] imageByte = FileUtil.readFromUrl(jsonObject.getString("url"));
|
|
|
|
+ inputStream = new ByteArrayInputStream(imageByte);
|
|
|
|
+ return Response.ok(fileManagerService.create(inputStream, "miniMax.jpeg", -1));
|
|
|
|
+ } finally {
|
|
|
|
+ if (inputStream != null) {
|
|
|
|
+ try {
|
|
|
|
+ inputStream.close();
|
|
|
|
+ } catch (IOException e) {
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
@RequestMapping(value = "/filenode/{id}", method = RequestMethod.GET)
|
|
@RequestMapping(value = "/filenode/{id}", method = RequestMethod.GET)
|
|
public void getFile(@PathVariable int id, final HttpServletResponse response) throws Exception {
|
|
public void getFile(@PathVariable int id, final HttpServletResponse response) throws Exception {
|
|
|
|
|