diff --git a/pom.xml b/pom.xml index 04df717d..5bde26ec 100644 --- a/pom.xml +++ b/pom.xml @@ -48,6 +48,7 @@ Digimeta@2023 2.0.1 8.3.3 + 1.5.1 diff --git a/xueyi-api/xueyi-api-nlt/src/main/java/com/xueyi/nlt/api/nlt/domain/vo/response/DmIntentResponse.java b/xueyi-api/xueyi-api-nlt/src/main/java/com/xueyi/nlt/api/nlt/domain/vo/response/DmIntentResponse.java index 9b8baa13..004a21fc 100644 --- a/xueyi-api/xueyi-api-nlt/src/main/java/com/xueyi/nlt/api/nlt/domain/vo/response/DmIntentResponse.java +++ b/xueyi-api/xueyi-api-nlt/src/main/java/com/xueyi/nlt/api/nlt/domain/vo/response/DmIntentResponse.java @@ -24,6 +24,10 @@ public class DmIntentResponse implements Serializable { private String motion; + private String type; + + private String hit; + public void clear() { this.msg = null; this.skillCode = null; diff --git a/xueyi-common/xueyi-common-log/pom.xml b/xueyi-common/xueyi-common-log/pom.xml index 2573ef8b..f8f8707e 100644 --- a/xueyi-common/xueyi-common-log/pom.xml +++ b/xueyi-common/xueyi-common-log/pom.xml @@ -22,6 +22,12 @@ com.xueyi xueyi-common-security + + + com.yomahub + tlog-all-spring-boot-starter + ${tlog.version} + \ No newline at end of file diff --git a/xueyi-modules/xueyi-nlt/src/main/java/com/xueyi/nlt/netty/client/WebSocketClientManager.java b/xueyi-modules/xueyi-nlt/src/main/java/com/xueyi/nlt/netty/client/WebSocketClientManager.java index d9fa9b13..b2def2fd 100644 --- a/xueyi-modules/xueyi-nlt/src/main/java/com/xueyi/nlt/netty/client/WebSocketClientManager.java +++ b/xueyi-modules/xueyi-nlt/src/main/java/com/xueyi/nlt/netty/client/WebSocketClientManager.java @@ -3,6 +3,7 @@ package com.xueyi.nlt.netty.client; import com.xueyi.nlt.netty.client.listener.LlmWebSocketListener; import com.xueyi.nlt.nlt.domain.LlmContext; import com.xueyi.nlt.nlt.domain.LlmParam; +import com.yomahub.tlog.okhttp.TLogOkHttpInterceptor; import okhttp3.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -47,7 +48,7 @@ public class WebSocketClientManager { @PostConstruct public void init() { ConnectionPool okHttpConnectionPool = new ConnectionPool(MAX_CONCURRENT_CONNECTIONS, KEEP_ALIVE_TIME, TimeUnit.SECONDS); - client = new OkHttpClient.Builder().connectionPool(okHttpConnectionPool).build(); + client = new OkHttpClient.Builder().connectionPool(okHttpConnectionPool).addInterceptor(new TLogOkHttpInterceptor()).build(); connectionPool = new ThreadPoolExecutor(CORE_POOL_SIZE, MAX_POOL_SIZE, KEEP_ALIVE_TIME, TimeUnit.SECONDS, new LinkedBlockingQueue<>()); } diff --git a/xueyi-modules/xueyi-nlt/src/main/java/com/xueyi/nlt/netty/client/listener/LlmWebSocketListener.java b/xueyi-modules/xueyi-nlt/src/main/java/com/xueyi/nlt/netty/client/listener/LlmWebSocketListener.java index 81f7c07e..277e1513 100644 --- a/xueyi-modules/xueyi-nlt/src/main/java/com/xueyi/nlt/netty/client/listener/LlmWebSocketListener.java +++ b/xueyi-modules/xueyi-nlt/src/main/java/com/xueyi/nlt/netty/client/listener/LlmWebSocketListener.java @@ -12,6 +12,7 @@ import com.xueyi.nlt.netty.server.config.ServerConfig; import com.xueyi.nlt.nlt.domain.LlmContent; import com.xueyi.nlt.nlt.domain.LlmContext; import com.xueyi.nlt.nlt.domain.LlmParam; +import com.yomahub.tlog.core.annotation.TLogAspect; import io.netty.channel.Channel; import io.netty.handler.codec.http.websocketx.TextWebSocketFrame; import okhttp3.Response; @@ -118,6 +119,7 @@ public class LlmWebSocketListener extends WebSocketListener { ).start(); } + @TLogAspect(str = "DGMAN-NLT") @Override public void onMessage(WebSocket webSocket, String text) { super.onMessage(webSocket, text); diff --git a/xueyi-modules/xueyi-nlt/src/main/java/com/xueyi/nlt/nlt/controller/DmIntentController.java b/xueyi-modules/xueyi-nlt/src/main/java/com/xueyi/nlt/nlt/controller/DmIntentController.java index 5e121527..b148b793 100644 --- a/xueyi-modules/xueyi-nlt/src/main/java/com/xueyi/nlt/nlt/controller/DmIntentController.java +++ b/xueyi-modules/xueyi-nlt/src/main/java/com/xueyi/nlt/nlt/controller/DmIntentController.java @@ -67,6 +67,7 @@ import com.xueyi.system.api.model.LoginUser; import com.xueyi.system.api.model.Source; import com.xueyi.system.api.organize.domain.dto.SysEnterpriseDto; import com.xueyi.system.api.organize.feign.RemoteEnterpriseService; +import com.yomahub.tlog.core.annotation.TLogAspect; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -87,8 +88,13 @@ import org.springframework.web.bind.annotation.RestController; import java.io.Serializable; import java.text.DateFormat; import java.text.SimpleDateFormat; -import java.time.format.DateTimeFormatter; +import java.util.Arrays; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.time.LocalDateTime; import java.util.*; +import java.time.format.DateTimeFormatter; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; @@ -223,6 +229,7 @@ public class DmIntentController extends BaseController manDeviceDtoR = manDeviceService.manDeviceInfoInner(intent.getDevId()); if (manDeviceDtoR.isFail()) { @@ -376,8 +392,8 @@ public class DmIntentController extends BaseController conversationInner(@RequestBody DmIntentVo intent) { DmIntentResponse response = new DmIntentResponse(); + // 记录 + // 定义标注日志对象 + MarkRecordVo recordVo = new MarkRecordVo(); + recordVo.setDevId(intent.getDevId()); + recordVo.setId(IdUtil.getSnowflakeNextId()); + recordVo.setCreateTime(LocalDateTime.now()); + recordVo.setQuestion(intent.getContent()); + recordVo.setHit(1); String enterpriseId = (String)SecurityContextHolder.getLocalMap().get("enterprise_id"); String enterpriseName = ""; @@ -595,6 +647,11 @@ public class DmIntentController extends BaseController answers; diff --git a/xueyi-modules/xueyi-nlt/src/main/resources/logback.xml b/xueyi-modules/xueyi-nlt/src/main/resources/logback.xml index 25ceb21f..4b1dac0b 100644 --- a/xueyi-modules/xueyi-nlt/src/main/resources/logback.xml +++ b/xueyi-modules/xueyi-nlt/src/main/resources/logback.xml @@ -22,7 +22,7 @@ 60 - + ${log.pattern} @@ -44,7 +44,7 @@ 60 - + ${log.pattern}