|
@@ -1,6 +1,7 @@
|
|
|
package com.tzld.longarticle.recommend.server.remote;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.ctrip.framework.apollo.spring.annotation.ApolloJsonValue;
|
|
|
import com.tzld.longarticle.recommend.server.common.HttpPoolFactory;
|
|
|
import com.tzld.longarticle.recommend.server.model.dto.Content;
|
|
|
import com.tzld.longarticle.recommend.server.util.MapBuilder;
|
|
@@ -34,6 +35,12 @@ public class NLPRemoteService {
|
|
|
|
|
|
@Value("${nlp.chat.id}")
|
|
|
private String chatId;
|
|
|
+ @ApolloJsonValue("${score.interest.type:{}}")
|
|
|
+ private Map<String, String> accountScoreInterestTypeMap;
|
|
|
+ @ApolloJsonValue("${score.viewCount.filter:{}}")
|
|
|
+ private Map<String, String> accountScoreViewCountFilterMap;
|
|
|
+ @ApolloJsonValue("${score.min.time:{}}")
|
|
|
+ private Map<String, String> accountScoreMinTimeMap;
|
|
|
|
|
|
private static CloseableHttpClient client = HttpPoolFactory.nlpPool();
|
|
|
private static final String scoreListUrl = "http://61.48.133.26:6060/score_list";
|
|
@@ -47,9 +54,15 @@ public class NLPRemoteService {
|
|
|
JSONObject bodyParam = new JSONObject();
|
|
|
bodyParam.put("account_nickname_list", Collections.singletonList(accountName));
|
|
|
bodyParam.put("text_list", titleList);
|
|
|
- bodyParam.put("interest_type", "avg");
|
|
|
+ bodyParam.put("interest_type", accountScoreInterestTypeMap.getOrDefault(accountName, "avg"));
|
|
|
bodyParam.put("sim_type", "mean");
|
|
|
bodyParam.put("rate", 0.1);
|
|
|
+ if (accountScoreViewCountFilterMap.containsKey(accountName)) {
|
|
|
+ bodyParam.put("view_count_filter", accountScoreViewCountFilterMap.get(accountName));
|
|
|
+ }
|
|
|
+ if (accountScoreMinTimeMap.containsKey(accountName)) {
|
|
|
+ bodyParam.put("min_time", accountScoreMinTimeMap.get(accountName));
|
|
|
+ }
|
|
|
int retry = 0;
|
|
|
while (retry < 3) {
|
|
|
retry++;
|