From 255d9012709b3664e6da671da99df69b301d8dc5 Mon Sep 17 00:00:00 2001 From: xxm Date: Tue, 18 Aug 2026 01:59:35 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=A0=94=E7=A9=B6Tab=E5=8A=A0=E5=AD=90?= =?UTF-8?q?Tab(=F0=9F=93=8B=E7=AD=96=E7=95=A5/=F0=9F=93=88=E7=AD=96?= =?UTF-8?q?=E7=95=A5=E8=BF=9B=E5=8C=96)=E2=80=94=E2=80=94=E8=BF=9B?= =?UTF-8?q?=E5=8C=96=E5=AD=90Tab=E8=A1=A8=E6=A0=BC=E5=B1=95=E7=A4=BAAB?= =?UTF-8?q?=E8=B7=AF=E7=BA=BF=E6=AF=8F=E6=97=A5=E7=A0=94=E7=A9=B6=E6=88=90?= =?UTF-8?q?=E6=9E=9C(strategy=5Fresearch=5Flog),=20=E6=96=B0=E5=A2=9E/api/?= =?UTF-8?q?research/log?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server.py | 19 +++++++++++++++++++ static/index.html | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) diff --git a/server.py b/server.py index 9f0f39eb..335ded78 100644 --- a/server.py +++ b/server.py @@ -2237,6 +2237,25 @@ def api_prd(): register_routes(app) +@app.route("/api/research/log") +def api_research_log(): + """AB路线每日研究日志(2026-08-18)""" + try: + _c = sqlite3.connect(str(DATA_DIR / "mofin.db"), timeout=10) + _c.execute("PRAGMA busy_timeout=30000") + rows = _c.execute( + "SELECT log_date, market, weak_regime, finding, experiment, result, " + "produced_strategy, produced_verified FROM strategy_research_log " + "ORDER BY log_date DESC LIMIT 50").fetchall() + _c.close() + log = [{"log_date": r[0], "market": r[1], "weak_regime": r[2], "finding": r[3], + "experiment": r[4], "result": r[5], "produced_strategy": r[6], + "produced_verified": r[7]} for r in rows] + return jsonify({"log": log}) + except Exception as e: + return jsonify({"log": [], "error": str(e)}) + + @app.route("/api/evolution/dashboard") def api_evolution_dashboard(): """进化模块 Dashboard""" diff --git a/static/index.html b/static/index.html index db602fb1..d10182d1 100644 --- a/static/index.html +++ b/static/index.html @@ -2179,6 +2179,11 @@ function renderResearch() { '?§' + '按市场×温区分组 · 每表格=该市该温区所有可用策略 · 🟢=当前市激活 · 温度=当前温区' + '' + + '
' + + '' + + '' + + '策略进化=AB路线每日研究成果记录' + + '
' + '
' + '
🧬 进化模块加载中...
' + '
' + @@ -2191,11 +2196,46 @@ function renderResearch() { '每版策略基于上一版归因分析迭代 · 点击行展开明细
' + '
加载中...
' + '
' + + '
' + + ''; // 首次渲染即加载策略列表(无子Tab切换)。 // 2026-08-15 修复:不能在此直接 loadStrategyList()——此时 btPeriod.value 还是初始默认 '1m', // 与下方恢复 savedPt='2y' 后的调用并发竞态,1m 响应后到会覆盖 2y 渲染(周期错乱+综合分被小样本置信打崩)。 loadEvolutionBox(); + // 2026-08-18 子Tab切换 + 进化日志 + window.switchRsub = function(name) { + const isStr = name === 'strategy'; + document.getElementById('rsub-strategy').classList.toggle('hidden', !isStr); + document.getElementById('rsub-evo').classList.toggle('hidden', isStr); + const bs = document.getElementById('rsubtab-strategy'), be = document.getElementById('rsubtab-evo'); + if (bs) bs.className = 'px-3 py-1 rounded text-sm ' + (isStr ? 'bg-emerald-600/40 border border-emerald-600/60' : 'bg-slate-800 border border-slate-700'); + if (be) be.className = 'px-3 py-1 rounded text-sm ' + (isStr ? 'bg-slate-800 border border-slate-700' : 'bg-emerald-600/40 border border-emerald-600/60'); + if (!isStr) loadEvoLog(); + }; + window.loadEvoLog = function() { + const el = document.getElementById('evo-log-list'); + if (!el) return; + fetch('/api/research/log').then(r => r.json()).then(data => { + const rows = data.log || []; + if (!rows.length) { el.innerHTML = '
暂无研究记录(每日AB研究任务运行后出现)
'; return; } + let html = '' + + '' + + '' + + ''; + rows.forEach(r => { + html += '' + + '' + + '' + + '' + + '' + + ''; + }); + el.innerHTML = html + '
日期市场/温区发现薄弱点尝试结果产出策略
' + (r.log_date||'') + '' + (r.market||'') + '/' + (r.weak_regime||'') + '' + (r.finding||'') + '' + (r.experiment||'') + '' + (r.result||'') + '' + (r.produced_strategy||'') + (r.produced_verified ? ' ' : '') + '
'; + }).catch(e => { el.innerHTML = '
加载失败: ' + e + '
'; }); + }; // 恢复用户上次选择的周期(防自动刷新重置,2026-07-30老爸抓包) const savedPt = window._btPeriodVal || '2y'; const ptSel = document.getElementById('btPeriod');