From b330fbb3e518d08df4ab93e41267533b1346d8af Mon Sep 17 00:00:00 2001 From: freedakgmail Date: Sun, 19 Jul 2026 20:29:19 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=94=BF=E7=AD=96=E9=9D=A2LLM=E5=88=86?= =?UTF-8?q?=E6=9E=90=E8=A6=86=E7=9B=96score=E5=90=8Esummary=E4=B8=8D?= =?UTF-8?q?=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- stock-html/services/news_analyzer.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/stock-html/services/news_analyzer.py b/stock-html/services/news_analyzer.py index ff89fb6..f4b015f 100644 --- a/stock-html/services/news_analyzer.py +++ b/stock-html/services/news_analyzer.py @@ -456,6 +456,7 @@ def analyze_policy_impact(policy_news): affected[category] = impact # 尝试用LLM深度分析重大政策 + llm_summary = None major_policies = [n for n in policy_news if n['category'] in ['行业扶持', '行业监管', '货币政策']] if major_policies and len(major_policies) <= 5: try: @@ -463,14 +464,17 @@ def analyze_policy_impact(policy_news): if llm_result: score = llm_result.get('score', score) reasons = llm_result.get('reasons', reasons) + llm_summary = llm_result.get('summary') except Exception as e: logger.warning(f"LLM政策分析失败: {e}") score = max(-10, min(10, score)) - if positive_count > negative_count: + if llm_summary: + summary = llm_summary + elif score > 0: summary = f'近期{len(policy_news)}条政策消息,偏利好({positive_count}条利好/{negative_count}条利空)' - elif negative_count > positive_count: + elif score < 0: summary = f'近期{len(policy_news)}条政策消息,偏利空({negative_count}条利空/{positive_count}条利好)' else: summary = f'近期{len(policy_news)}条政策消息,影响中性'