Compare commits

...

9 Commits

  1. 7
      ALOps_sys_backend/alops-admin/src/main/java/com/alops/web/controller/LlmKnowledgeController/FileController.java
  2. 5
      ALOps_sys_fe/alops-ui/src/components/ImageUpload/index.vue

@ -7,11 +7,14 @@ import javax.servlet.http.HttpServletResponse;
import com.alops.chat.entity.UploadedFile;
import com.alops.chat.service.UploadedFileService;
import com.alops.common.annotation.Log;
import com.alops.common.config.RuoYiConfig;
import com.alops.common.core.controller.BaseController;
import com.alops.common.enums.BusinessType;
import com.alops.common.utils.file.FileUtils;
import com.alops.common.utils.file.FileTypeUtils;
import com.alops.common.utils.StringUtils;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -46,6 +49,8 @@ public class FileController extends BaseController {
*/
@PreAuthorize("@ss.hasPermi('QandA:knowledge:filedownload')")
@GetMapping("/download/{fileId}")
@Log(title = "下载文件", businessType = BusinessType.EXPORT)
@ApiOperation("下载文件")
public void download(@PathVariable Long fileId, HttpServletResponse response, HttpServletRequest request) {
try {
UploadedFile uploadedFile = uploadedFileService.findById(fileId);
@ -107,6 +112,8 @@ public class FileController extends BaseController {
*/
@PreAuthorize("@ss.hasPermi('QandA:knowledge:filepreview')")
@GetMapping("/preview/{fileId}")
@ApiOperation("预览文件")
@Log(title = "预览文件", businessType = BusinessType.SELECT)
public void preview(@PathVariable Long fileId, HttpServletResponse response, HttpServletRequest request) {
try {
UploadedFile uploadedFile = uploadedFileService.findById(fileId);

@ -137,6 +137,7 @@ export default {
this.fileList = list.map(item => {
if (typeof item === "string") {
if (item.indexOf(this.baseUrl) === -1 && !isExternal(item)) {
item = { name: this.baseUrl + item, url: this.baseUrl + item }
} else {
item = { name: item, url: item }
@ -204,7 +205,7 @@ export default {
console.log("%c 🍍: handleUploadSuccess -> res ", "font-size:16px;background-color:#dca159;color:white;", res)
if (res.code === 200) {
// URLbaseUrl
let url = res.url
let url = res.fileName
if (url && url.indexOf(this.baseUrl) === -1 && !isExternal(url)) {
url = this.baseUrl + url
}
@ -246,6 +247,7 @@ export default {
},
//
handlePictureCardPreview(file) {
this.dialogImageUrl = file.url
this.dialogVisible = true
},
@ -256,6 +258,7 @@ export default {
for (let i in list) {
if (list[i].url) {
strs += list[i].url.replace(this.baseUrl, "") + separator
}
}
return strs != '' ? strs.substr(0, strs.length - 1) : ''

Loading…
Cancel
Save