| @@ -48,6 +48,7 @@ | |||
| <sonar.password>Digimeta@2023</sonar.password> | |||
| <jakarta-json.version>2.0.1</jakarta-json.version> | |||
| <elasticsearch.version>8.3.3</elasticsearch.version> | |||
| <tlog.version>1.5.1</tlog.version> | |||
| </properties> | |||
| <!-- 依赖声明 --> | |||
| @@ -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; | |||
| @@ -20,7 +20,7 @@ public class RemoteQAFallbackFactory implements FallbackFactory<RemoteQAService> | |||
| @Override | |||
| public RemoteQAService create(Throwable throwable) { | |||
| log.error("短信服务调用失败:{}", throwable.getMessage()); | |||
| log.error("知识库服务调用失败:{}", throwable.getMessage()); | |||
| return new RemoteQAService() { | |||
| @Override | |||
| public AjaxResult query(String manCode, String question, Long tenantId) { | |||
| @@ -22,6 +22,12 @@ | |||
| <groupId>com.xueyi</groupId> | |||
| <artifactId>xueyi-common-security</artifactId> | |||
| </dependency> | |||
| <dependency> | |||
| <groupId>com.yomahub</groupId> | |||
| <artifactId>tlog-all-spring-boot-starter</artifactId> | |||
| <version>${tlog.version}</version> | |||
| </dependency> | |||
| </dependencies> | |||
| </project> | |||
| @@ -7,7 +7,7 @@ | |||
| <!-- 控制台输出 --> | |||
| <appender name="console" class="ch.qos.logback.core.ConsoleAppender"> | |||
| <encoder> | |||
| <encoder class="com.yomahub.tlog.core.enhance.logback.AspectLogbackEncoder"> | |||
| <pattern>${log.pattern}</pattern> | |||
| </encoder> | |||
| </appender> | |||
| @@ -22,7 +22,7 @@ | |||
| <!-- 日志最大的历史 60天 --> | |||
| <maxHistory>60</maxHistory> | |||
| </rollingPolicy> | |||
| <encoder> | |||
| <encoder class="com.yomahub.tlog.core.enhance.logback.AspectLogbackEncoder"> | |||
| <pattern>${log.pattern}</pattern> | |||
| </encoder> | |||
| <filter class="ch.qos.logback.classic.filter.LevelFilter"> | |||
| @@ -44,7 +44,7 @@ | |||
| <!-- 日志最大的历史 60天 --> | |||
| <maxHistory>60</maxHistory> | |||
| </rollingPolicy> | |||
| <encoder> | |||
| <encoder class="com.yomahub.tlog.core.enhance.logback.AspectLogbackEncoder"> | |||
| <pattern>${log.pattern}</pattern> | |||
| </encoder> | |||
| <filter class="ch.qos.logback.classic.filter.LevelFilter"> | |||
| @@ -22,7 +22,7 @@ | |||
| <!-- 日志最大的历史 60天 --> | |||
| <maxHistory>60</maxHistory> | |||
| </rollingPolicy> | |||
| <encoder> | |||
| <encoder class="com.yomahub.tlog.core.enhance.logback.AspectLogbackEncoder"> | |||
| <pattern>${log.pattern}</pattern> | |||
| </encoder> | |||
| <filter class="ch.qos.logback.classic.filter.LevelFilter"> | |||
| @@ -44,7 +44,7 @@ | |||
| <!-- 日志最大的历史 60天 --> | |||
| <maxHistory>60</maxHistory> | |||
| </rollingPolicy> | |||
| <encoder> | |||
| <encoder class="com.yomahub.tlog.core.enhance.logback.AspectLogbackEncoder"> | |||
| <pattern>${log.pattern}</pattern> | |||
| </encoder> | |||
| <filter class="ch.qos.logback.classic.filter.LevelFilter"> | |||
| @@ -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<>()); | |||
| } | |||
| @@ -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; | |||
| @@ -117,6 +118,7 @@ public class LlmWebSocketListener extends WebSocketListener { | |||
| ).start(); | |||
| } | |||
| @TLogAspect(str = "DGMAN-NLT") | |||
| @Override | |||
| public void onMessage(WebSocket webSocket, String text) { | |||
| super.onMessage(webSocket, text); | |||
| @@ -5,6 +5,10 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils; | |||
| import com.xueyi.nlt.netty.server.config.ServerConfig; | |||
| import com.xueyi.nlt.nlt.template.FreeChatTemplate; | |||
| import com.xueyi.nlt.nlt.template.MovieChatTemplate; | |||
| import com.yomahub.tlog.core.annotation.TLogAspect; | |||
| import com.yomahub.tlog.core.rpc.TLogLabelBean; | |||
| import com.yomahub.tlog.core.rpc.TLogRPCHandler; | |||
| import com.yomahub.tlog.spring.TLogSpringAware; | |||
| import io.netty.channel.Channel; | |||
| import io.netty.channel.ChannelHandlerContext; | |||
| import io.netty.channel.SimpleChannelInboundHandler; | |||
| @@ -16,9 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Component; | |||
| import javax.annotation.PostConstruct; | |||
| import java.net.InetAddress; | |||
| import java.net.InetSocketAddress; | |||
| import java.time.LocalDateTime; | |||
| @Component | |||
| public class ChatServerHandler extends SimpleChannelInboundHandler<TextWebSocketFrame> { | |||
| @@ -33,6 +35,8 @@ public class ChatServerHandler extends SimpleChannelInboundHandler<TextWebSocket | |||
| @Autowired | |||
| private MovieChatTemplate movieChatTemplate; | |||
| private final TLogRPCHandler tLogRPCHandler = new TLogRPCHandler(); | |||
| @PostConstruct | |||
| public void init() { | |||
| INSTANCE = this; | |||
| @@ -41,6 +45,10 @@ public class ChatServerHandler extends SimpleChannelInboundHandler<TextWebSocket | |||
| } | |||
| @Override | |||
| protected void channelRead0(ChannelHandlerContext channelHandlerContext, TextWebSocketFrame textWebSocketFrame) throws Exception { | |||
| tLogRPCHandler.processProviderSide(new TLogLabelBean()); | |||
| Channel channel = channelHandlerContext.channel(); | |||
| // 判断textWebSocketFrame.text()是否为空,如果为空,则直接返回 | |||
| if (StringUtils.isEmpty(textWebSocketFrame.text()) || StringUtils.isEmpty(textWebSocketFrame.text().trim()) ) { | |||
| @@ -129,7 +137,9 @@ public class ChatServerHandler extends SimpleChannelInboundHandler<TextWebSocket | |||
| * @param msg | |||
| * @param userId | |||
| */ | |||
| @TLogAspect(str = "DGMAN-NLT") | |||
| private void sendMsg(String userId, Object msg ) { | |||
| String appName = TLogSpringAware.getProperty("spring.application.name"); | |||
| log.info("设备:{},收到消息:{}", userId,msg); | |||
| Channel channel1 = ServerConfig.sessionMap.get(userId); | |||
| if (channel1 != null) { | |||
| @@ -42,6 +42,7 @@ import com.xueyi.nlt.nlt.domain.po.DmRegularPo; | |||
| import com.xueyi.nlt.nlt.domain.query.DmIntentQuery; | |||
| import com.xueyi.nlt.nlt.domain.vo.IntentTemplateVo; | |||
| import com.xueyi.nlt.nlt.domain.vo.MarkRecordVo; | |||
| import com.xueyi.nlt.nlt.domain.vo.NLPLogVo; | |||
| import com.xueyi.nlt.nlt.mapper.DmRegularMapper; | |||
| import com.xueyi.nlt.nlt.service.IDmIntentService; | |||
| import com.xueyi.nlt.nlt.service.ISysLlmService; | |||
| @@ -56,6 +57,7 @@ import com.xueyi.system.api.digitalmans.feign.RemoteSkillService; | |||
| 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; | |||
| @@ -78,6 +80,8 @@ 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.util.regex.Matcher; | |||
| import java.util.regex.Pattern; | |||
| import java.util.stream.Collectors; | |||
| @@ -199,6 +203,7 @@ public class DmIntentController extends BaseController<DmIntentQuery, DmIntentDt | |||
| return AjaxResult.success(jsonObjectR.getData()); | |||
| } | |||
| @TLogAspect(str="DGMAN-NLT") | |||
| @PostMapping("/api/skill-intent") | |||
| @ResponseBody | |||
| public AjaxResult skillIntentApi(@RequestBody DmIntentVo intent) { | |||
| @@ -327,10 +332,19 @@ public class DmIntentController extends BaseController<DmIntentQuery, DmIntentDt | |||
| /** | |||
| * 联动北方大模型请求 | |||
| */ | |||
| @TLogAspect(str="DGMAN-NLT") | |||
| @PostMapping("/api/searchQuestionAnswer") | |||
| @ResponseBody | |||
| public AjaxResult searchQuestionAnswer(@RequestBody DmIntentVo intent) { | |||
| log.info("交互对象:{}",intent.toString()); | |||
| // 定义标注日志对象 | |||
| MarkRecordVo recordVo = new MarkRecordVo(); | |||
| recordVo.setDevId(intent.getDevId()); | |||
| recordVo.setId(IdUtil.getSnowflakeNextId()); | |||
| recordVo.setCreateTime(LocalDateTime.now()); | |||
| recordVo.setQuestion(intent.getContent()); | |||
| recordVo.setHit(1); | |||
| redisTemplate.opsForValue().increment("dashboard:server", 1); | |||
| R<DmManDeviceDto> manDeviceDtoR = manDeviceService.manDeviceInfoInner(intent.getDevId()); | |||
| if (manDeviceDtoR.isFail()) { | |||
| @@ -342,8 +356,8 @@ public class DmIntentController extends BaseController<DmIntentQuery, DmIntentDt | |||
| if (enterpriseDtoR.isOk()) { | |||
| enterpriseName = enterpriseDtoR.getData().getName(); | |||
| } | |||
| recordVo.setTenantId(Long.valueOf(manDeviceDtoR.getData().getTId())); | |||
| DmIntentResponse response = new DmIntentResponse(); | |||
| //先调用意图 | |||
| //根据技能调用知识库或大模型 | |||
| CoversationSessionVo sessionObject = (CoversationSessionVo) redisTemplate2.opsForValue().get("group:device" + ":" + intent.getDevId() + ":" +"session"); | |||
| @@ -351,6 +365,13 @@ public class DmIntentController extends BaseController<DmIntentQuery, DmIntentDt | |||
| response.setMsg(""); | |||
| response.setSkillCode("34"); | |||
| response.setH5(flightMessageTemplate.handle(intent.getDevId(),intent.getContent())); | |||
| recordVo.setType(2); | |||
| recordVo.setSkillCode("34"); // 航班查询 | |||
| List answers = new ArrayList(); | |||
| answers.add(response.getH5().toJSONString()); | |||
| recordVo.setAnswers(answers); | |||
| // 记录log | |||
| log.info(recordVo.toString()); | |||
| return AjaxResult.success(response); | |||
| } | |||
| @@ -360,6 +381,12 @@ public class DmIntentController extends BaseController<DmIntentQuery, DmIntentDt | |||
| redisTemplate.opsForValue().increment("dashboard:flight", 1); | |||
| pushIntoDashboardRedis(enterpriseName, "查询航班信息", "skill"); | |||
| response.setH5(flightMessageTemplate.handle(intent.getDevId(), intent.getContent())); | |||
| recordVo.setType(2); | |||
| recordVo.setSkillCode("34"); // 航班查询 | |||
| List answers = new ArrayList(); | |||
| answers.add(response.getH5().toJSONString()); | |||
| recordVo.setAnswers(answers); | |||
| log.info(recordVo.toString()); | |||
| return AjaxResult.success(response); | |||
| } | |||
| } | |||
| @@ -376,6 +403,12 @@ public class DmIntentController extends BaseController<DmIntentQuery, DmIntentDt | |||
| content = qaAjax.getResult().get(0).getKnowledgeLib(); | |||
| pushIntoDashboardRedis(enterpriseName,content,"knowledge"); | |||
| response.setH5(JSONObject.from(qaAjax)); | |||
| recordVo.setType(0); | |||
| recordVo.setSkillCode("34"); // 航班查询 | |||
| List answers = new ArrayList(); | |||
| answers.add(response.getH5().getJSONArray("result").getJSONObject(0).getString("answer")); | |||
| recordVo.setAnswers(answers); | |||
| log.info(recordVo.toString()); | |||
| return AjaxResult.success(response); | |||
| } | |||
| } | |||
| @@ -429,6 +462,14 @@ public class DmIntentController extends BaseController<DmIntentQuery, DmIntentDt | |||
| joImage.put("msg","抱歉,您的问题我无法解答。"); | |||
| response.setH5(joImage); | |||
| } | |||
| // 记录日志 | |||
| recordVo.setType(1); | |||
| recordVo.setSkillCode("30"); // 航班查询 | |||
| recordVo.setLlm("lagi"); | |||
| List answers = new ArrayList(); | |||
| answers.add(response.getH5().getString("msg")); | |||
| recordVo.setAnswers(answers); | |||
| log.info(recordVo.toString()); | |||
| return AjaxResult.success(response); | |||
| } | |||
| @@ -449,11 +490,20 @@ public class DmIntentController extends BaseController<DmIntentQuery, DmIntentDt | |||
| /** | |||
| * 意图请求列表 | |||
| */ | |||
| @TLogAspect(str="DGMAN-NLT") | |||
| @PostMapping("/inner/conversation") | |||
| @ResponseBody | |||
| public R<DmIntentResponse> 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 = ""; | |||
| @@ -472,6 +522,11 @@ public class DmIntentController extends BaseController<DmIntentQuery, DmIntentDt | |||
| if (response == null || StringUtils.isEmpty(response.getSkillCode())) { | |||
| // 做场景1、2处理 | |||
| if (!StringUtils.isEmpty(response.getMsg())) { | |||
| // 记录log | |||
| recordVo.setType(2); | |||
| List answers = new ArrayList(); | |||
| answers.add(response.getMsg()); | |||
| recordVo.setAnswers(answers); // 航班查询 | |||
| return R.ok(response); | |||
| } | |||
| else { | |||
| @@ -486,6 +541,11 @@ public class DmIntentController extends BaseController<DmIntentQuery, DmIntentDt | |||
| content = qaAjax.getResult().get(0).getKnowledgeLib(); | |||
| pushIntoDashboardRedis(enterpriseName,content,"knowledge"); | |||
| response.setH5(JSONObject.from(qaAjax)); | |||
| // 记录log | |||
| recordVo.setType(2); | |||
| List answers = new ArrayList(); | |||
| answers.add(response.getMsg()); | |||
| recordVo.setAnswers(answers); // 航班查询 | |||
| return R.ok(response); | |||
| } | |||
| else { | |||
| @@ -716,6 +776,9 @@ public class DmIntentController extends BaseController<DmIntentQuery, DmIntentDt | |||
| return AjaxResult.success(); | |||
| } | |||
| private Integer uploadLog(NLPLogVo vo) { | |||
| return 0; | |||
| } | |||
| /** | |||
| * 查询意图管理 | |||
| 列表 | |||
| @@ -1,5 +1,6 @@ | |||
| package com.xueyi.nlt.nlt.domain.vo; | |||
| import com.alibaba.fastjson2.JSONObject; | |||
| import com.fasterxml.jackson.annotation.JsonFormat; | |||
| import com.fasterxml.jackson.databind.annotation.JsonDeserialize; | |||
| import com.fasterxml.jackson.databind.annotation.JsonSerialize; | |||
| @@ -17,7 +18,7 @@ public class MarkRecordVo implements Serializable { | |||
| @Serial | |||
| private static final long serialVersionUID = 1L; | |||
| // 唯一id | |||
| protected Long id; | |||
| protected String devId; | |||
| /** 标注来源 | |||
| @@ -48,6 +49,11 @@ public class MarkRecordVo implements Serializable { | |||
| /** 问题 */ | |||
| protected String question; | |||
| /** 是否命中 */ | |||
| protected Integer hit; | |||
| /** 命中的技能 */ | |||
| protected String skillCode; | |||
| /** 答案 */ | |||
| protected List<String> answers; | |||
| @@ -0,0 +1,191 @@ | |||
| package com.xueyi.nlt.nlt.domain.vo; | |||
| import com.alibaba.fastjson2.JSONObject; | |||
| import com.fasterxml.jackson.annotation.JsonFormat; | |||
| import com.fasterxml.jackson.databind.annotation.JsonDeserialize; | |||
| import com.fasterxml.jackson.databind.annotation.JsonSerialize; | |||
| import com.xueyi.common.core.utils.time.LocalDateTimeSerializer; | |||
| import com.xueyi.common.core.utils.time.LocalDatetimeDeserializer; | |||
| import lombok.Data; | |||
| import java.io.Serial; | |||
| import java.io.Serializable; | |||
| import java.time.LocalDateTime; | |||
| import java.util.List; | |||
| @Data | |||
| public class NLPLogVo implements Serializable { | |||
| @Serial | |||
| private static final long serialVersionUID = 1L; | |||
| protected Long id; | |||
| /** 租户号 */ | |||
| protected Long tenantId; | |||
| @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | |||
| @JsonDeserialize(using = LocalDatetimeDeserializer.class) // 反序列化 | |||
| @JsonSerialize(using = LocalDateTimeSerializer.class) | |||
| protected LocalDateTime createTime; | |||
| /** | |||
| * 设备信息 | |||
| */ | |||
| protected Device device; | |||
| /** | |||
| * 图片集合 | |||
| */ | |||
| protected List<Image> images; | |||
| /** | |||
| * NLP相关日志 | |||
| */ | |||
| protected NLP nlp; | |||
| /** | |||
| * 设备信息 | |||
| */ | |||
| @Data | |||
| class Device { | |||
| // 设备id | |||
| String devId; | |||
| // 麦阵方案 | |||
| String micOption; | |||
| } | |||
| /** | |||
| * 图片信息 | |||
| */ | |||
| @Data | |||
| class Image { | |||
| // 图片id | |||
| String id; | |||
| // 时间戳 | |||
| Long timestamp; | |||
| // 图像识别方案 | |||
| String faceDetectOption; | |||
| // 人脸结果图片集 | |||
| List<FaceResult> faces; | |||
| /** | |||
| * 人脸结果 | |||
| */ | |||
| @Data | |||
| class FaceResult { | |||
| /** 文件名 */ | |||
| String filename; | |||
| /** 人脸结果参数 */ | |||
| Face face; | |||
| } | |||
| /** | |||
| * 人脸识别信息 | |||
| */ | |||
| @Data | |||
| class Face { | |||
| Integer trackID; | |||
| Integer index; | |||
| Float confidence; | |||
| Float pitch; | |||
| Float yaw; | |||
| Float roll; | |||
| Integer leftEyeType; | |||
| Integer rightEyeType; | |||
| Integer mouthType; | |||
| Float minority; | |||
| Float blurness; | |||
| Float age; | |||
| Float female; | |||
| Float male; | |||
| Rect rect; | |||
| GazeResult gazeResult; | |||
| } | |||
| /** | |||
| * 矩形框 | |||
| */ | |||
| @Data | |||
| class Rect { | |||
| Float x; | |||
| Float y; | |||
| Float width; | |||
| Float height; | |||
| } | |||
| /** | |||
| * 视线结果 | |||
| */ | |||
| @Data | |||
| class GazeResult { | |||
| GazeInfo leftEyeGaze; | |||
| GazeInfo rightEyeGaze; | |||
| } | |||
| /** | |||
| * 视线信息 | |||
| */ | |||
| @Data | |||
| class GazeInfo { | |||
| Float centerX; | |||
| Float centerY; | |||
| Float vectorX; | |||
| Float vectorY; | |||
| Float vectorZ; | |||
| Float roll; | |||
| Float pitch; | |||
| Float yaw; | |||
| } | |||
| } | |||
| /** | |||
| * ASR相关日志 | |||
| */ | |||
| @Data | |||
| class ASR { | |||
| // VAD 开始时间 | |||
| Long vadStartTime; | |||
| // VAD 结束时间 | |||
| Long vadEndTime; | |||
| // ASR 方案 | |||
| String asrOption; | |||
| // 文件名 | |||
| String filename; | |||
| // 识别结果 | |||
| String result; | |||
| } | |||
| /** | |||
| * NLP相关日志 | |||
| */ | |||
| @Data | |||
| class NLP { | |||
| // 问题 | |||
| String question; | |||
| /** 答案 */ | |||
| String answer; | |||
| /** 选项 */ | |||
| List<String> options; | |||
| /** 匹配的的模型 | |||
| * -1: 未匹配模型 | |||
| * 0: 正则表达式 | |||
| * 1: 星火大模型 | |||
| * 2: 文心一言 | |||
| * 3: ChatGPT | |||
| * 4:智普AI | |||
| * 5:联动北方Lagi | |||
| */ | |||
| Integer model; | |||
| /** 响应时间 */ | |||
| Long responseTime; | |||
| // 用户选择的答案 | |||
| Integer choose; | |||
| } | |||
| public String toJSONString() { | |||
| return JSONObject.toJSONString(this); | |||
| } | |||
| } | |||
| @@ -9,6 +9,7 @@ import com.xueyi.nlt.nlt.domain.LlmContext; | |||
| import com.xueyi.nlt.nlt.domain.LlmParam; | |||
| import com.xueyi.nlt.nlt.domain.LlmResponse; | |||
| import com.xueyi.nlt.nlt.service.ISysLlmService; | |||
| import com.yomahub.tlog.core.annotation.TLogAspect; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| @@ -85,6 +86,7 @@ public class FreeChatTemplate implements BaseTemplate{ | |||
| return resultJson; | |||
| } | |||
| @TLogAspect(str = "DGMAN-NLT") | |||
| public JSONObject handle(String dev, String content, boolean stream) { | |||
| Long operatorId = TerminalSecurityContextHolder.getOperatorId(); | |||
| String redisKey = "group:nlp:" + SecurityContextHolder.getLocalMap().get("enterprise_id") + ":" + operatorId; | |||
| @@ -117,6 +119,7 @@ public class FreeChatTemplate implements BaseTemplate{ | |||
| llmContext.setDevId(dev); | |||
| LlmParam param = new LlmParam(); | |||
| LlmResponse response = sysLlmService.stream(llmContext,param); | |||
| log.info("llmContext:{}",llmContext); | |||
| JSONObject resultJson = new JSONObject(); | |||
| resultJson.put("tts","让我想一想。"); | |||
| @@ -7,7 +7,7 @@ | |||
| <!-- 控制台输出 --> | |||
| <appender name="console" class="ch.qos.logback.core.ConsoleAppender"> | |||
| <encoder> | |||
| <encoder class="com.yomahub.tlog.core.enhance.logback.AspectLogbackEncoder"> | |||
| <pattern>${log.pattern}</pattern> | |||
| </encoder> | |||
| </appender> | |||
| @@ -22,7 +22,7 @@ | |||
| <!-- 日志最大的历史 60天 --> | |||
| <maxHistory>60</maxHistory> | |||
| </rollingPolicy> | |||
| <encoder> | |||
| <encoder class="com.yomahub.tlog.core.enhance.logback.AspectLogbackEncoder"> | |||
| <pattern>${log.pattern}</pattern> | |||
| </encoder> | |||
| <filter class="ch.qos.logback.classic.filter.LevelFilter"> | |||
| @@ -44,7 +44,7 @@ | |||
| <!-- 日志最大的历史 60天 --> | |||
| <maxHistory>60</maxHistory> | |||
| </rollingPolicy> | |||
| <encoder> | |||
| <encoder class="com.yomahub.tlog.core.enhance.logback.AspectLogbackEncoder"> | |||
| <pattern>${log.pattern}</pattern> | |||
| </encoder> | |||
| <filter class="ch.qos.logback.classic.filter.LevelFilter"> | |||
| @@ -135,11 +135,10 @@ public class DmManDeviceController extends BaseController<DmManDeviceQuery, DmMa | |||
| /** 根据设备id获取数字人信息 */ | |||
| @GetMapping("/inner/info/{devId}") | |||
| R<DmManDeviceDto> manDeviceInfoInner(@RequestParam(value = "devId") String devId) { | |||
| System.out.println("manDeviceInfoInner:" + devId); | |||
| DmManDeviceDto dto = super.baseService.manDeviceInfoInner(devId); | |||
| System.out.println("manDeviceInfoInner:dto:" + dto.getTId()); | |||
| SysEnterpriseDto enterpriseDto = enterpriseService.selectById(dto.getTId()); | |||
| dto.setStrategyId(enterpriseDto.getStrategyId()); | |||
| log.info("获取租户信息:" + dto); | |||
| return R.ok(dto); | |||
| } | |||
| @@ -7,7 +7,7 @@ | |||
| <!-- 控制台输出 --> | |||
| <appender name="console" class="ch.qos.logback.core.ConsoleAppender"> | |||
| <encoder> | |||
| <encoder class="com.yomahub.tlog.core.enhance.logback.AspectLogbackEncoder"> | |||
| <pattern>${log.pattern}</pattern> | |||
| </encoder> | |||
| </appender> | |||
| @@ -22,7 +22,7 @@ | |||
| <!-- 日志最大的历史 60天 --> | |||
| <maxHistory>60</maxHistory> | |||
| </rollingPolicy> | |||
| <encoder> | |||
| <encoder class="com.yomahub.tlog.core.enhance.logback.AspectLogbackEncoder"> | |||
| <pattern>${log.pattern}</pattern> | |||
| </encoder> | |||
| <filter class="ch.qos.logback.classic.filter.LevelFilter"> | |||
| @@ -44,7 +44,7 @@ | |||
| <!-- 日志最大的历史 60天 --> | |||
| <maxHistory>60</maxHistory> | |||
| </rollingPolicy> | |||
| <encoder> | |||
| <encoder class="com.yomahub.tlog.core.enhance.logback.AspectLogbackEncoder"> | |||
| <pattern>${log.pattern}</pattern> | |||
| </encoder> | |||
| <filter class="ch.qos.logback.classic.filter.LevelFilter"> | |||
| @@ -7,7 +7,7 @@ | |||
| <!-- 控制台输出 --> | |||
| <appender name="console" class="ch.qos.logback.core.ConsoleAppender"> | |||
| <encoder> | |||
| <encoder class="com.yomahub.tlog.core.enhance.logback.AspectLogbackEncoder"> | |||
| <pattern>${log.pattern}</pattern> | |||
| </encoder> | |||
| </appender> | |||
| @@ -22,7 +22,7 @@ | |||
| <!-- 日志最大的历史 60天 --> | |||
| <maxHistory>60</maxHistory> | |||
| </rollingPolicy> | |||
| <encoder> | |||
| <encoder class="com.yomahub.tlog.core.enhance.logback.AspectLogbackEncoder"> | |||
| <pattern>${log.pattern}</pattern> | |||
| </encoder> | |||
| <filter class="ch.qos.logback.classic.filter.LevelFilter"> | |||
| @@ -44,7 +44,7 @@ | |||
| <!-- 日志最大的历史 60天 --> | |||
| <maxHistory>60</maxHistory> | |||
| </rollingPolicy> | |||
| <encoder> | |||
| <encoder class="com.yomahub.tlog.core.enhance.logback.AspectLogbackEncoder"> | |||
| <pattern>${log.pattern}</pattern> | |||
| </encoder> | |||
| <filter class="ch.qos.logback.classic.filter.LevelFilter"> | |||