fix: 政策面LLM分析覆盖score后summary不一致
This commit is contained in:
@@ -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)}条政策消息,影响中性'
|
||||
|
||||
Reference in New Issue
Block a user