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

fix: 推荐问

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