feat: 暴露fuyao SDK全部A股接口 + AI分析轮次上限提至30
This commit is contained in:
@@ -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"]
|
||||
|
||||
Reference in New Issue
Block a user