From 5c0ba37eda80d39e6ceca59bb1d5f4942f858995 Mon Sep 17 00:00:00 2001 From: "Somhairle H. Marisol" Date: Thu, 17 Sep 2026 14:32:37 +0800 Subject: chore: establish Strategy Lab source baseline (development, not release) --- frontend/src/pages/ProjectStrategyTab.svelte | 420 +++++++++++++++++++++++++++ 1 file changed, 420 insertions(+) create mode 100644 frontend/src/pages/ProjectStrategyTab.svelte (limited to 'frontend/src/pages/ProjectStrategyTab.svelte') diff --git a/frontend/src/pages/ProjectStrategyTab.svelte b/frontend/src/pages/ProjectStrategyTab.svelte new file mode 100644 index 0000000..5f2e242 --- /dev/null +++ b/frontend/src/pages/ProjectStrategyTab.svelte @@ -0,0 +1,420 @@ + + +
+ + + {#if !initBusy && !initErr} +
+
+

策略代码(Backtrader Python)

+ + {saveStatus === 'saved' && `已保存${saveMsg ? ` · ${saveMsg}` : ''}`} + {#if saveStatus === 'dirty'}有未保存修改{/if} + {#if saveStatus === 'saving'}保存中…{/if} + {#if saveStatus === 'conflict'}冲突{/if} + +
+

+ 编辑器修改会自动保存(约 0.8 秒停顿后提交)。草稿代 {baseGeneration} · 回测与获取 AI 建议使用当前草稿快照 +

+ +
+ { + if (ev.key === 'Enter') void snapshot(); + }} + /> + + +
+ + + {#if conflictServer} + + +
+ + +
+ {/if} +
+ +
+

AI 助手

+
+ + +
+ +
+ {#if aiErr} + + {/if} + + {#if aiResult} +
+
+

建议解释 {aiResult.model}

+ + tokens {aiResult.usage?.input_tokens ?? '—'} 入 / {aiResult.usage?.output_tokens ?? '—'} 出 + +
+

{aiResult.explanation}

+

完整建议源码

+ {}} readOnly={true} label="AI 返回代码(只读)" height={280} /> +

与当前草稿的差异

+ +
+ + + {#if aiResult.base_generation !== baseGeneration} + + {/if} + {#if aiAcceptErr} + + {/if} +
+
+ {/if} + {#if aiNote} + + {/if} +
+
+ +
+

版本历史

+ + {#if !versionsBusy && versions.length === 0} + + {/if} + {#if !versionsBusy && versions.length > 0} +
+ + + + + + + + + + + + {#each versions as v, i (v.id)} + + + + + + + + {/each} + +
时间摘要哈希来源操作
{fmtDateTime(v.created_at)} + {v.message?.trim() || '(无说明)'} + 版本代 {v.hash?.slice(0, 8) || '—'} + {v.hash?.slice(0, 12)}{versionSourceLabel[v.source]} +
+ + {#if i + 1 < versions.length} + + {/if} + +
+
+
+ {/if} +

版本为不可变记录,恢复均创建新草稿,从不改写历史。获取到最新草稿修改内容请刷新页面查看。

+
+ + {#if comparing} + (comparing = null)}> + + + {/if} + {/if} +
-- cgit v1.2.3