|
|
@@ -44,7 +44,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.domain.dto.DmIntentDto; |
|
|
|
import com.xueyi.nlt.nlt.domain.dto.DmPromptDto; |
|
|
|
//import com.xueyi.nlt.nlt.domain.dto.DmPromptDto; |
|
|
|
import com.xueyi.nlt.nlt.domain.dto.DmSensitiveWordDto; |
|
|
|
import com.xueyi.nlt.nlt.domain.po.DmRegularPo; |
|
|
|
import com.xueyi.nlt.nlt.domain.query.DmIntentQuery; |
|
|
@@ -146,8 +146,8 @@ public class DmIntentController extends BaseController<DmIntentQuery, DmIntentDt |
|
|
|
@Autowired |
|
|
|
private GenerativeKnowledgeTemplate generativeKnowledgeTemplate; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private GenerativeWelcomeTemplate generativeWelcomeTemplate; |
|
|
|
//@Autowired |
|
|
|
//private GenerativeWelcomeTemplate generativeWelcomeTemplate; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private FreeChatTemplate freeChatTemplate; |
|
|
@@ -187,8 +187,8 @@ public class DmIntentController extends BaseController<DmIntentQuery, DmIntentDt |
|
|
|
@Autowired |
|
|
|
private ISysLlmService sysLlmService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private IDmHotspotService dmHotspotService; |
|
|
|
//@Autowired |
|
|
|
//private IDmHotspotService dmHotspotService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
MqttTemplate mqttTemplate; |
|
|
@@ -1135,55 +1135,55 @@ public class DmIntentController extends BaseController<DmIntentQuery, DmIntentDt |
|
|
|
return AjaxResult.error(res); |
|
|
|
} |
|
|
|
|
|
|
|
@PostMapping("/inner/generateContextTask") |
|
|
|
@ResponseBody |
|
|
|
public AjaxResult generateContextTask() { |
|
|
|
LocalDateTime dateTime = LocalDateTime.now(); |
|
|
|
String date = dateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); |
|
|
|
List<JSONObject> contentList = new ArrayList<>(); |
|
|
|
GenerativeWelcomeTemplate.lunar = ""; |
|
|
|
GenerativeWelcomeTemplate.term = null; |
|
|
|
try { |
|
|
|
JSONObject jo = generativeWelcomeTemplate.handle("1", ""); |
|
|
|
JSONArray ja = jo.getJSONArray("data"); |
|
|
|
Long timeStamp = System.currentTimeMillis(); |
|
|
|
JSONObject timeJson = new JSONObject(); |
|
|
|
timeJson.put("timestamp", timeStamp); |
|
|
|
ja.add(timeJson); |
|
|
|
log.info(ja.toJSONString()); |
|
|
|
redisTemplate2.opsForHash().put("group:task" + ":generate", date, AjaxResult.success(ja).toJson().toJSONString()); |
|
|
|
Map<Object, Object> devices = redisTemplate2.opsForHash().entries("group:dgman:device:"); |
|
|
|
for(Object devId:devices.keySet()){ |
|
|
|
mqttTemplate.sendToMqtt("/" + activeProfile + "/" + "digital_man" + "/" + devId.toString() + "/" + "notify" + "/" + "generate-welcome", true, AjaxResult.success(ja).toJson().toJSONString()); |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("生成任务失败:{}",e.getMessage()); |
|
|
|
return AjaxResult.error("生成任务失败"); |
|
|
|
} |
|
|
|
return AjaxResult.success(); |
|
|
|
} |
|
|
|
|
|
|
|
@PostMapping("/syncHotspot") |
|
|
|
@ResponseBody |
|
|
|
public AjaxResult syncHotspot(){ |
|
|
|
Integer result = dmHotspotService.syncHotspot(); |
|
|
|
if(result.equals(0)){ |
|
|
|
return AjaxResult.success("同步成功"); |
|
|
|
}else { |
|
|
|
return AjaxResult.error("同步失败"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@PostMapping("/collectHotspot") |
|
|
|
@ResponseBody |
|
|
|
public AjaxResult collectHotspot(){ |
|
|
|
Integer result = dmHotspotService.collectHotspot(); |
|
|
|
if(result.equals(0)){ |
|
|
|
return AjaxResult.success("热点收集成功"); |
|
|
|
}else { |
|
|
|
return AjaxResult.error("热点收集失败"); |
|
|
|
} |
|
|
|
} |
|
|
|
// @PostMapping("/inner/generateContextTask") |
|
|
|
// @ResponseBody |
|
|
|
// public AjaxResult generateContextTask() { |
|
|
|
// LocalDateTime dateTime = LocalDateTime.now(); |
|
|
|
// String date = dateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); |
|
|
|
// List<JSONObject> contentList = new ArrayList<>(); |
|
|
|
// GenerativeWelcomeTemplate.lunar = ""; |
|
|
|
// GenerativeWelcomeTemplate.term = null; |
|
|
|
// try { |
|
|
|
// JSONObject jo = generativeWelcomeTemplate.handle("1", ""); |
|
|
|
// JSONArray ja = jo.getJSONArray("data"); |
|
|
|
// Long timeStamp = System.currentTimeMillis(); |
|
|
|
// JSONObject timeJson = new JSONObject(); |
|
|
|
// timeJson.put("timestamp", timeStamp); |
|
|
|
// ja.add(timeJson); |
|
|
|
// log.info(ja.toJSONString()); |
|
|
|
// redisTemplate2.opsForHash().put("group:task" + ":generate", date, AjaxResult.success(ja).toJson().toJSONString()); |
|
|
|
// Map<Object, Object> devices = redisTemplate2.opsForHash().entries("group:dgman:device:"); |
|
|
|
// for(Object devId:devices.keySet()){ |
|
|
|
// mqttTemplate.sendToMqtt("/" + activeProfile + "/" + "digital_man" + "/" + devId.toString() + "/" + "notify" + "/" + "generate-welcome", true, AjaxResult.success(ja).toJson().toJSONString()); |
|
|
|
// } |
|
|
|
// } catch (Exception e) { |
|
|
|
// log.error("生成任务失败:{}",e.getMessage()); |
|
|
|
// return AjaxResult.error("生成任务失败"); |
|
|
|
// } |
|
|
|
// return AjaxResult.success(); |
|
|
|
// } |
|
|
|
|
|
|
|
// @PostMapping("/syncHotspot") |
|
|
|
// @ResponseBody |
|
|
|
// public AjaxResult syncHotspot(){ |
|
|
|
// Integer result = dmHotspotService.syncHotspot(); |
|
|
|
// if(result.equals(0)){ |
|
|
|
// return AjaxResult.success("同步成功"); |
|
|
|
// }else { |
|
|
|
// return AjaxResult.error("同步失败"); |
|
|
|
// } |
|
|
|
// } |
|
|
|
|
|
|
|
// @PostMapping("/collectHotspot") |
|
|
|
// @ResponseBody |
|
|
|
// public AjaxResult collectHotspot(){ |
|
|
|
// Integer result = dmHotspotService.collectHotspot(); |
|
|
|
// if(result.equals(0)){ |
|
|
|
// return AjaxResult.success("热点收集成功"); |
|
|
|
// }else { |
|
|
|
// return AjaxResult.error("热点收集失败"); |
|
|
|
// } |
|
|
|
// } |
|
|
|
|
|
|
|
interface Auth { |
|
|
|
/** 系统 - 意图管理 |
|
|
|