feat: AI分析第三档——海外期货章节、报告分卡片渲染、红绿着色、期号;LLM改流式+分段生成绕开网关120s超时
This commit is contained in:
@@ -43,8 +43,11 @@ def _can_trigger(trade_date: str) -> tuple[bool, str]:
|
||||
async def get_latest_report():
|
||||
conn = get_connection()
|
||||
try:
|
||||
# issue_number:按报告日期序数作为总期号
|
||||
row = conn.execute(
|
||||
"SELECT * FROM ai_reports ORDER BY trade_date DESC, id DESC LIMIT 1"
|
||||
"""SELECT r.*,
|
||||
(SELECT COUNT(*) FROM ai_reports WHERE trade_date <= r.trade_date) AS issue_number
|
||||
FROM ai_reports r ORDER BY r.trade_date DESC, r.id DESC LIMIT 1"""
|
||||
).fetchone()
|
||||
if not row:
|
||||
raise HTTPException(status_code=404, detail="暂无分析报告")
|
||||
|
||||
@@ -165,6 +165,7 @@ async def _build_dashboard() -> dict:
|
||||
skyrocket_data,
|
||||
sector_flow_data,
|
||||
margin_data,
|
||||
global_markets_data,
|
||||
) = await asyncio.gather(
|
||||
fuyao_client.hot_stock_list("day"),
|
||||
fuyao_client.dragon_tiger_list("all"),
|
||||
@@ -173,6 +174,7 @@ async def _build_dashboard() -> dict:
|
||||
fuyao_client.skyrocket_list("day"),
|
||||
market_extra.fetch_sector_fund_flow(),
|
||||
market_extra.fetch_margin_summary(),
|
||||
market_extra.fetch_global_markets(),
|
||||
return_exceptions=True,
|
||||
)
|
||||
except Exception:
|
||||
@@ -183,6 +185,7 @@ async def _build_dashboard() -> dict:
|
||||
skyrocket_data = {}
|
||||
sector_flow_data = None
|
||||
margin_data = None
|
||||
global_markets_data = None
|
||||
|
||||
# ── 解析指数 ──
|
||||
indices = []
|
||||
@@ -565,6 +568,7 @@ async def _build_dashboard() -> dict:
|
||||
"sectorStrength": sector_strength[:31],
|
||||
"conceptStrength": concept_strength[:10],
|
||||
"sectorFundFlow": sector_flow_data if isinstance(sector_flow_data, dict) else None,
|
||||
"globalMarkets": global_markets_data if isinstance(global_markets_data, dict) else None,
|
||||
"events": events,
|
||||
"limitLadder": limit_ladder,
|
||||
"updateTime": datetime.now(BJT).strftime("%Y-%m-%d %H:%M:%S"),
|
||||
|
||||
Reference in New Issue
Block a user