From becdbf189173e12887813b87303bc962fb9bb396 Mon Sep 17 00:00:00 2001 From: shahaibo <1023316923@qq.com> Date: Mon, 2 Jun 2025 16:19:41 +0800 Subject: [PATCH] =?UTF-8?q?TASK:collection=20sort=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ai/da/controller/LLMController.java | 13 + .../java/com/ai/da/service/LLMService.java | 2 + .../ai/da/service/impl/LLMServiceImpl.java | 253 +++++++++++------- .../impl/UserLikeGroupServiceImpl.java | 7 +- 4 files changed, 175 insertions(+), 100 deletions(-) diff --git a/src/main/java/com/ai/da/controller/LLMController.java b/src/main/java/com/ai/da/controller/LLMController.java index 208ca947..eb25540a 100644 --- a/src/main/java/com/ai/da/controller/LLMController.java +++ b/src/main/java/com/ai/da/controller/LLMController.java @@ -64,6 +64,19 @@ public class LLMController { return llmService.stream(prompt, projectId, fileUrl, imageUrlList, token, enableThinking, process); } + @ApiOperation(value = "对话") + @CrossOrigin + @GetMapping(value = "/streamNew", produces = MediaType.TEXT_EVENT_STREAM_VALUE) + public SseEmitter streamNew(@RequestParam String prompt, + @RequestParam(required = false) Long projectId, + @RequestParam(required = false) String fileUrl, + @RequestParam(required = false) List imageUrlList, + @RequestParam(required = false) String process, + @RequestParam String token, + @RequestParam Boolean enableThinking) { + return llmService.streamNew(prompt, projectId, fileUrl, imageUrlList, token, enableThinking, process); + } + @ApiOperation(value = "对话创建项目") @GetMapping(value = "/chatCreateProject") public Response chatCreateProject(@RequestParam String prompt, @RequestParam String process, diff --git a/src/main/java/com/ai/da/service/LLMService.java b/src/main/java/com/ai/da/service/LLMService.java index 5ecbe895..eb844829 100644 --- a/src/main/java/com/ai/da/service/LLMService.java +++ b/src/main/java/com/ai/da/service/LLMService.java @@ -38,4 +38,6 @@ public interface LLMService { List uploadFile(MultipartFile file); PageBaseResponse getChatHistory(ChatHistoryDTO chatHistoryDTO); + + SseEmitter streamNew(String prompt, Long projectId, String fileUrl, List imageUrlList, String token, Boolean enableThinking, String process); } diff --git a/src/main/java/com/ai/da/service/impl/LLMServiceImpl.java b/src/main/java/com/ai/da/service/impl/LLMServiceImpl.java index 5ed22e3b..f7313d63 100644 --- a/src/main/java/com/ai/da/service/impl/LLMServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/LLMServiceImpl.java @@ -188,103 +188,162 @@ public class LLMServiceImpl implements LLMService { systemImage.setAccountId(accountId); chatMessageMapper.insert(systemImage); } -// if (status.equals("[PROJECT_CREATE_SIGNAL]")) { -// JSONObject data = toolsData; -// Project project = projectMapper.selectById(projectId); -// LocalDateTime now = LocalDateTime.now(); -// project.setUpdateTime(now); -// project.setAccountId(accountId); -// project.setName(data.getString("project_name")); -// project.setOriginal(1); -// project.setProcess(process); -// projectMapper.updateById(project); -// -// Workspace workspace = new Workspace(); -// workspace.setAccountId(accountId); -// workspace.setCreateTime(now); -// String ageGroup = data.getString("ageGroup"); -// if (StringUtils.isEmpty(ageGroup)) { -// workspace.setAgeGroup("Adult"); -// }else { -// if (AgeGroup.isValidName(process)) { -// workspace.setAgeGroup(ageGroup); -// }else { -// workspace.setAgeGroup("Adult"); -// } -// } -// String gender = data.getString("gender"); -// if (StringUtils.isEmpty(gender)) { -// workspace.setSex("Female"); -// }else { -// if (Sex.isValidName(gender)) { -// workspace.setSex(gender); -// }else { -// workspace.setSex("Female"); -// } -// } -// String position = data.getString("position"); -// if (process.equals(DesignProcess.SERIES_DESIGN.name())) { -// workspace.setPosition("Overall"); -// }else { -// if (StringUtils.isEmpty(position)) { -// if (workspace.getSex().equals("Female")) { -// workspace.setPosition(Position.BLOUSE.getValue()); -// }else { -// workspace.setPosition(Position.TOPS.getValue()); -// } -// }else { -// if (Position.isValidName(position)) { -// workspace.setPosition(position); -// }else { -// if (workspace.getSex().equals("Female")) { -// workspace.setPosition(Position.BLOUSE.getValue()); -// }else { -// workspace.setPosition(Position.TOPS.getValue()); -// } -// } -// } -// } -// workspace.setSystemDesignerPercentage(30); -// workspace.setProjectId(project.getId()); -// workspace.setAccountId(accountId); -// String style = data.getString("style"); -// String styleName = null; -// if (StringUtils.isEmpty(style)) { -// styleName = StyleEnum.NEW_CHINESE.name(); -// }else { -// if (StyleEnum.isValidName(style)) { -// styleName = style; -// }else { -// styleName = StyleEnum.NEW_CHINESE.name(); -// } -// } -// -// SysFile sysFile = sysFileService.getOneBySex(styleName, workspace.getSex(), workspace.getAgeGroup()); -// -// if (workspace.getSex().equals(Sex.FEMALE.getValue())) { -// workspace.setMannequinFemaleId(sysFile.getId()); -// workspace.setMannequinFemaleType("System"); -// }else { -// workspace.setMannequinMaleId(sysFile.getId()); -// workspace.setMannequinMaleType("System"); -// } -// -// workspaceMapper.insert(workspace); -// -// if (!StringUtils.isEmpty(styleName)) { -// QueryWrapper