Commit 0b9bffaf authored by alex yao's avatar alex yao

fix: 推荐问

parent cb8fa764
......@@ -14,12 +14,12 @@ public class RecommendQuestionScheduler {
private AgentApplicationExposeService agentApplicationExposeService;
/**
* 每日凌晨
* 每10分钟生成
*
* @throws Exception
*/
@Scheduled(cron = "0 0 0 * * ?")
public void knowledgeInfoStatusUpdateScheduler() throws Exception {
@Scheduled(cron = "0 10 * * * ?")
public void knowledgeInfoStatusUpdateScheduler() {
agentApplicationExposeService.createRecommendQuestion();
}
}
......@@ -82,7 +82,7 @@ public interface AiDialoguesService {
*
* @param type 对话类型
*/
List<String> guessYouAsk(String type) throws Exception;
List<String> guessYouAsk(String type);
/**
* 对话
......
......@@ -31,6 +31,7 @@ import cn.com.poc.common.utils.Assert;
import cn.com.poc.common.utils.JsonUtils;
import cn.com.poc.common.utils.SSEUtil;
import cn.com.poc.common.utils.StringUtils;
import cn.com.poc.expose.aggregate.AgentApplicationExposeService;
import cn.com.poc.expose.dto.DialoguesContextDto;
import cn.com.poc.thirdparty.resource.demand.ai.constants.LLMRoleEnum;
import cn.com.poc.thirdparty.resource.demand.ai.entity.dialogue.Message;
......@@ -277,17 +278,20 @@ public class AiDialoguesServiceImpl implements AiDialoguesService {
}
}
@Resource
private AgentApplicationExposeService agentApplicationExposeService;
@Override
public List<String> guessYouAsk(String type) throws Exception {
public List<String> guessYouAsk(String type) {
//
String redisKey = "AGENT_APPLICATION_RECOMMEND_QUESTIONS:" + XLangConstant.ZH_CN;
long size = redisService.lGetListSize(redisKey);
if (size < 8) {
redisService.del(redisKey);
return Collections.emptyList();
if (!redisService.hasKey(redisKey) || redisService.lGetListSize(redisKey) < 8) {
agentApplicationExposeService.createRecommendQuestion();
}
long size = redisService.lGetListSize(redisKey);
List<Object> lastRecomendIdSet = null;
Set<Long> indexSet = new HashSet<>(8);
SecureRandom secureRandom = new SecureRandom();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment