Browse Source

score_list 增加ghId参数

wangyunpeng 8 months ago
parent
commit
6f32d755f7

+ 2 - 1
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/remote/NLPRemoteService.java

@@ -50,12 +50,13 @@ public class NLPRemoteService {
     private static final String scoreListUrl = "http://61.48.133.26:6060/score_list";
     private static final String backUrl = "http://47.98.136.48:6060/score_list";
 
-    public Map<String, Double> score(String accountName, List<Content> contentList) {
+    public Map<String, Double> score(String ghId, String accountName, List<Content> contentList) {
         long start = System.currentTimeMillis();
         Map<String, Double> result = new HashMap<>();
         List<String> titleList = contentList.stream().map(Content::getTitle).collect(Collectors.toList());
         String url = scoreListUrl;
         JSONObject bodyParam = new JSONObject();
+        bodyParam.put("gh_id_list", Collections.singletonList(ghId));
         bodyParam.put("account_nickname_list", Collections.singletonList(accountName));
         bodyParam.put("text_list", titleList);
         bodyParam.put("interest_type", accountScoreInterestTypeMap.getOrDefault(accountName, "avg"));

+ 1 - 1
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/score/strategy/SimilarityStrategy.java

@@ -31,7 +31,7 @@ public class SimilarityStrategy implements ScoreStrategy {
         if (CollectionUtils.isEmpty(param.getContents())) {
             return Collections.emptyList();
         }
-        Map<String, Double> scoreMap = nlpRemoteService.score(param.getAccountName(), param.getContents());
+        Map<String, Double> scoreMap = nlpRemoteService.score(param.getGhId(), param.getAccountName(), param.getContents());
 
 //        double min = scoreMap.values().stream()
 //                .min(Double::compareTo)