package org.jeecg.modules.ai.controller;
|
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiOperation;
|
import lombok.extern.slf4j.Slf4j;
|
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.aspect.annotation.AutoLog;
|
import org.jeecg.common.system.base.controller.JeecgController;
|
import org.jeecg.modules.ai.entity.FileImgInfo;
|
import org.jeecg.modules.ai.entity.FilePdfInfo;
|
import org.jeecg.modules.ai.service.IFilePdfInfoService;
|
import org.jeecg.modules.ai.vo.FilePdfSelectVo;
|
import org.springframework.web.bind.annotation.*;
|
|
import java.util.List;
|
|
/**
|
* @author clown
|
* * @date 2024/8/7
|
*/
|
@Slf4j
|
@Api(tags = "PDF文件管理")
|
@RestController
|
@RequestMapping("/ai/filePdf")
|
public class FilePdfInfoController extends JeecgController<FilePdfInfo, IFilePdfInfoService> {
|
|
@AutoLog(value = "PDF文件管理-检索查询")
|
@ApiOperation(value = "PDF文件管理-检索查询", notes = "PDF文件管理-检索查询")
|
@PutMapping(value = "/findImgList")
|
public Result<?> findImgPathList(@RequestBody FilePdfSelectVo vo) {
|
List<FileImgInfo> infos = service.findImgPathList(vo);
|
/*Thread.sleep();*/
|
return Result.OK(infos);
|
}
|
|
/* @AutoLog(value = "aiTest")
|
@ApiOperation(value = "aiTest", notes = "aiTest")*/
|
@GetMapping(value = "/aiTest")
|
public Result<?> aiTest(String nameList) {
|
/* String name = "{\"id\":\"683a65fd-8feb-4446-ad32-714c4785f667\",\"messages\":[{\"role\":\"user\",\"content\":\"给我讲个故事?\"}],\"stream\":true,\"max_tokens\":500}"; // JSON数据
|
String url = "https://836u458t54.vicp.fun/chat/test_chat";
|
String aiPost = AiTestUils.sendJsonToHttpsPost(url, name);*/
|
|
String s = "\"data\": {\"id\": \"683a65fd-8feb-4446-ad32-714c4785f667\", \"created\": 1723105518, \"model\": \"YxCareer0.7\", \"choices\": [{\"index\": 0, \"delta\": {\"role\": \"assistant\", \"content\": \"\"}, \"finish_reason\": null}]}";
|
System.out.println(s.replace("data:" ,""));
|
return Result.OK("");
|
}
|
|
|
@AutoLog(value = "PDF文件列表")
|
@ApiOperation(value = "PDF文件列表", notes = "PDF文件列表")
|
@GetMapping(value = "/filePdfList")
|
public Result<?> aiFindFiles() {
|
List<FilePdfInfo> infos = service.list();
|
return Result.OK(infos);
|
}
|
|
|
}
|