feat: 暴露fuyao SDK全部A股接口 + AI分析轮次上限提至30

This commit is contained in:
Sakurasan
2026-09-01 17:04:38 +08:00
parent 8b43b57bb2
commit 86429f43c2
3 changed files with 145 additions and 4 deletions
+2 -3
View File
@@ -122,8 +122,9 @@ async def collect_ai_analysis(trade_date: str) -> dict:
total_tokens = 0
final_content = ""
was_truncated = False
max_rounds = 30 # 安全上限,正常分析约 3-8 轮
for i in range(8):
for i in range(max_rounds):
response = await call_llm(messages, tools=TOOLS)
total_tokens += response.get("usage", {}).get("total_tokens", 0)
@@ -138,11 +139,9 @@ async def collect_ai_analysis(trade_date: str) -> dict:
break
if finish_reason == "length":
# 响应被截断,保存已生成的内容
was_truncated = True
final_content = message.get("content") or ""
if not final_content:
# 如果当前消息没有内容,尝试从之前的消息中提取
for msg in reversed(messages):
if msg.get("role") == "assistant" and msg.get("content"):
final_content = msg["content"]