|
@@ -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"));
|
|
@@ -84,7 +85,14 @@ public class NLPRemoteService {
|
|
|
// log.info("scoreList 返回的数据:{}", responseBody);
|
|
|
JSONObject scoreListResponse = JSONObject.parseObject(responseBody);
|
|
|
if (Objects.nonNull(scoreListResponse)) {
|
|
|
- JSONObject accountScoreList = scoreListResponse.getJSONObject(accountName);
|
|
|
+ Set<String> keySet = scoreListResponse.keySet();
|
|
|
+ JSONObject accountScoreList = null;
|
|
|
+ for (String key : keySet) {
|
|
|
+ if (key.equals(accountName) || key.equals(ghId)) {
|
|
|
+ accountScoreList = scoreListResponse.getJSONObject(key);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
if (Objects.nonNull(accountScoreList)) {
|
|
|
List<Double> scoreList = accountScoreList.getJSONArray("score_list").toJavaList(Double.class);
|
|
|
for (int i = 0; i < contentList.size(); i++) {
|