From d3deec72eb572c745410c5022499b76090ada0bd Mon Sep 17 00:00:00 2001 From: xupei Date: Thu, 26 Jun 2025 14:11:42 +0800 Subject: [PATCH] =?UTF-8?q?TASK:=20=E5=88=87=E6=8D=A2chat=20agent=E8=AF=B7?= =?UTF-8?q?=E6=B1=82api=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ai/da/service/impl/DesignServiceImpl.java | 11 ++++++++--- .../java/com/ai/da/service/impl/LLMServiceImpl.java | 7 ++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/ai/da/service/impl/DesignServiceImpl.java b/src/main/java/com/ai/da/service/impl/DesignServiceImpl.java index 819639c3..545e40a8 100644 --- a/src/main/java/com/ai/da/service/impl/DesignServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/DesignServiceImpl.java @@ -2946,12 +2946,17 @@ public class DesignServiceImpl extends ServiceImpl impleme collectionElement.setCreateDate(date); libraryService.processSketchBoards(url, collectionElement.getLevel2Type()); }else if (receiveCollectionElement.getLevel1Type().equals(CollectionLevel1TypeEnum.COLOR_BOARD.getRealName())) { - String color = receiveCollectionElement.getHsv(); + /*String color = receiveCollectionElement.getHsv(); String[] parts = color.split("\\s+"); int h = Math.round(Float.parseFloat(parts[0])); int s = Math.round(Float.parseFloat(parts[1])); // 关键修改 int v = Math.round(Float.parseFloat(parts[2])); - int[] hsv = {h, s, v}; + int[] hsv = {h, s, v};*/ + String rgbStr = receiveCollectionElement.getRgb(); + int[] rgb = Arrays.stream(rgbStr.split("\\s+")) + .mapToInt(Integer::parseInt) + .toArray(); + int[] hsv = PantoneUtils.rgbToHsv(rgb); // int[] hsv = Arrays.stream(color.split("\\s+")).mapToInt(Integer::parseInt).toArray(); int value = (hsv[0] * 101 * 101) + (hsv[1] * 101) + hsv[2]; ColorLookupTable colorLookupTable = colorLoopUpTableService.getByColorValue(value); @@ -2968,7 +2973,7 @@ public class DesignServiceImpl extends ServiceImpl impleme collectionElement.setProjectId(project.getId()); collectionElement.setName(panTone.getPantoneIndex() + "_" + panTone.getName() + "_" + panTone.getTcx()); collectionElement.setHasPin((byte) 0); - collectionElement.setColorRgb(receiveCollectionElement.getRgb()); + collectionElement.setColorRgb(rgbStr); collectionElement.setCreateDate(date); } } 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 94efec5d..534af348 100644 --- a/src/main/java/com/ai/da/service/impl/LLMServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/LLMServiceImpl.java @@ -232,7 +232,7 @@ public class LLMServiceImpl implements LLMService { @Override public SseEmitter streamNew(String prompt, Long projectParamId, String fileUrl, List imageUrlList, String token, Boolean enableThinking, String process) { SseEmitter emitter = new SseEmitter(0L); // 永不超时 - List designTools = Arrays.asList("moodboard", "printboard", "generate_color_code", "sketchboard"); + List designTools = Arrays.asList("moodboard", "printboard", /*"generate_color_code", */"sketchboard", "colorboard"); executor.submit(() -> { try { @@ -241,8 +241,8 @@ public class LLMServiceImpl implements LLMService { if (validate) { AuthPrincipalVo principal = jwtTokenHelper.parserToUser(token); Long accountId = principal.getId(); -// String url = "http://18.167.251.121:10002/chat-stream"; - String url = "http://18.167.251.121:10002/api/chat_stream"; +// String url = "http://18.167.251.121:10002/api/chat_stream"; + String url = "http://18.167.251.121:2011/api/chat_stream"; // String url = "http://10.1.1.240:1013/chat-stream"; HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection(); conn.setRequestMethod("POST"); @@ -251,6 +251,7 @@ public class LLMServiceImpl implements LLMService { Long projectId = null; if (null == projectParamId) { Project project = new Project(); + project.setAccountId(accountId); project.setCreateTime(LocalDateTime.now()); projectMapper.insert(project); projectId = project.getId();