罗俊辉 пре 11 месеци
родитељ
комит
fc046b3002
1 измењених фајлова са 22 додато и 23 уклоњено
  1. 22 23
      routes/accountServer.py

+ 22 - 23
routes/accountServer.py

@@ -41,7 +41,6 @@ class AccountServer(object):
         async with aiohttp.ClientSession() as session:
             async with session.post(url, headers=headers, json=body) as response:
                 response_text = await response.text()
-                print("结果:\t", response_text)
                 if response_text:
                     return await response.json()
                 else:
@@ -109,28 +108,28 @@ class AccountServer(object):
         获取和单个账号的相关性分数
         :return:
         """
-        # try:
-        account_interest, account_weight = await self.getAccountInterest(
-            account_name=account_name,
-            method=self.interest_type,
-            rate=self.rate
-        )
-        sim_key = "score_list_mean" if self.sim_type == "mean" else "score_list_avg"
-        response = await self.request_for_nlp(
-            title_list=self.title_list,
-            account_interest=account_interest,
-            account_weight=account_weight
-        )
-        return {
-            "score_list": response[sim_key],
-            "text_list_max": response["text_list_max"],
-        }
-        # except Exception as e:
-        #     print(e)
-        #     return {
-        #         "score_list": [0] * len(self.title_list),
-        #         "text_list_max": self.title_list,
-        #     }
+        try:
+            account_interest, account_weight = await self.getAccountInterest(
+                account_name=account_name,
+                method=self.interest_type,
+                rate=self.rate
+            )
+            sim_key = "score_list_mean" if self.sim_type == "mean" else "score_list_avg"
+            response = await self.request_for_nlp(
+                title_list=self.title_list,
+                account_interest=account_interest,
+                account_weight=account_weight
+            )
+            return {
+                "score_list": response[sim_key],
+                "text_list_max": response["text_list_max"],
+            }
+        except Exception as e:
+            print(e)
+            return {
+                "score_list": [0] * len(self.title_list),
+                "text_list_max": self.title_list,
+            }
 
     async def getAccountListScoreList(self):
         """