Kaynağa Gözat

Fix hot_topic_toolkit

StrayWarrior 21 saat önce
ebeveyn
işleme
8548c98c53
1 değiştirilmiş dosya ile 5 ekleme ve 5 silme
  1. 5 5
      pqai_agent/toolkit/hot_topic_toolkit.py

+ 5 - 5
pqai_agent/toolkit/hot_topic_toolkit.py

@@ -9,7 +9,6 @@ from pqai_agent.toolkit.tool_registry import register_toolkit
 
 @register_toolkit
 class HotTopicToolkit(BaseToolkit):
-    @staticmethod
     def get_hot_topics(self) -> List[Dict[str, Any]]:
         """
         获取热点内容列表
@@ -24,10 +23,11 @@ class HotTopicToolkit(BaseToolkit):
             if data.get("code") == 0 and data.get("success"):
                 result = []
                 for item in data.get("data", []):
-                    result.append({
-                        "title": item.get("标题"),
-                        "url": item.get("链接")
-                    })
+                    if item.get("title") and item.get("url"):
+                        result.append({
+                            "title": item.get("title"),
+                            "url": item.get("url")
+                        })
                 return result
             else:
                 logger.error(f"Failed to fetch hot topics: {data.get('msg', 'Unknown error')}")