TASK:LLM;

This commit is contained in:
shahaibo
2025-05-20 16:54:20 +08:00
parent a0bd4cfa38
commit 8c597db8a9
4 changed files with 10 additions and 6 deletions

View File

@@ -65,8 +65,10 @@ public class LLMController {
@ApiOperation(value = "对话创建项目")
@GetMapping(value = "/chatCreateProject")
public Response<Long> chatCreateProject(@RequestParam String prompt, @RequestParam String process) {
return Response.success(llmService.chatCreateProject(prompt, process));
public Response<Long> chatCreateProject(@RequestParam String prompt, @RequestParam String process,
@RequestParam(required = false) String fileUrl,
@RequestParam(required = false) List<String> imageUrlList) {
return Response.success(llmService.chatCreateProject(prompt, process, fileUrl, imageUrlList));
}
@ApiOperation(value = "上传文件")

View File

@@ -4383,7 +4383,7 @@ public class PythonService {
throw new BusinessException("poseTransferBatch.interface.exception");
}
public JSONObject getProjectParam(String prompt) {
public JSONObject getProjectParam(String prompt, String fileUrl, List<String> imageUrlList) {
OkHttpClient client = new OkHttpClient().newBuilder()
.connectTimeout(30, TimeUnit.SECONDS)
.pingInterval(5, TimeUnit.SECONDS)//websocket轮训间隔(单位:秒)
@@ -4393,6 +4393,8 @@ public class PythonService {
MediaType mediaType = MediaType.parse("application/json");
Map<String, Object> content = Maps.newHashMap();
content.put("prompt", prompt);
content.put("image_list", !CollectionUtils.isEmpty(imageUrlList) ? imageUrlList : null);
content.put("file_list", !StringUtils.isEmpty(fileUrl) ? Collections.singletonList(fileUrl) : null);
RequestBody body = RequestBody.create(mediaType, JSON.toJSONString(content));
log.info("getProjectParam 请求地址: {}", accessPythonIp + ":" + accessPythonPort + "/api/extraction_project_info");

View File

@@ -33,7 +33,7 @@ public interface LLMService {
SseEmitter stream(String prompt, Long projectId, String fileUrl, List<String> imageUrlList, String token, Boolean enableThinking);
Long chatCreateProject(String prompt, String process);
Long chatCreateProject(String prompt, String process, String fileUrl, List<String> imageUrlList);
List<String> uploadFile(MultipartFile file);

View File

@@ -202,9 +202,9 @@ public class LLMServiceImpl implements LLMService {
}
@Override
public Long chatCreateProject(String prompt, String process) {
public Long chatCreateProject(String prompt, String process, String fileUrl, List<String> imageUrlList) {
AuthPrincipalVo userHolder = UserContext.getUserHolder();
JSONObject jsonObject = pythonService.getProjectParam(prompt);
JSONObject jsonObject = pythonService.getProjectParam(prompt, fileUrl, imageUrlList);
JSONObject data = jsonObject.getJSONObject("data");
Project project = new Project();
LocalDateTime now = LocalDateTime.now();