From d68714ed83f176a944ddc432d613f3c82eee3db0 Mon Sep 17 00:00:00 2001 From: 0xYYBB | ZYY | Bobo <128128010+the-dev-z@users.noreply.github.com> Date: Wed, 12 Nov 2025 10:00:42 +0800 Subject: [PATCH] fix(web): restore missing system_prompt_template field in trader edit request (#922) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(web): restore missing system_prompt_template in handleSaveEditTrader 修復編輯交易員時策略模板無法保存的問題。 Issue: - 用戶編輯交易員時,選擇的策略模板(system_prompt_template)沒有被保存 - 重新打開編輯窗口,總是顯示默認值 - 用戶困惑為什麼策略模板無法持久化 Root Cause: - PR #872 在 UI 重構時遺漏了 system_prompt_template 字段 - handleSaveEditTrader 的 request 對象缺少 system_prompt_template - 導致更新請求不包含策略模板信息 Fix: - 在 handleSaveEditTrader 的 request 對象中添加 system_prompt_template 字段 - 位置:override_base_prompt 之後,is_cross_margin 之前 - 與後端 API 和 TraderConfigModal 保持一致 Result: - 編輯交易員時,策略模板正確保存 - 重新打開編輯窗口,顯示正確的已保存值 - 用戶可以成功切換和保存不同的策略模板 Technical Details: - web/src/types.ts TraderConfigData 接口已有 system_prompt_template ✓ - Backend handleUpdateTrader 接收並保存 SystemPromptTemplate ✓ - Frontend TraderConfigModal 表單提交包含 system_prompt_template ✓ - Frontend handleSaveEditTrader request 缺失此字段 ✗ → ✓ (已修復) Related: - PR #872: UI 重構時遺漏 - commit c1f080f5: 原始添加 system_prompt_template 支持 - commit e58fc3c2: 修復 types.ts 缺失字段 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: tinkle-community * fix(types): add missing system_prompt_template field to TraderConfigData 補充完整修復:確保 TypeScript 類型定義與 API 使用一致。 Issue: - AITradersPage.tsx 提交時包含 system_prompt_template 字段 - 但 TraderConfigData 接口缺少此字段定義 - TypeScript 類型不匹配 Fix: - 在 TraderConfigData 接口添加 system_prompt_template: string - 位置:override_base_prompt 之後,is_cross_margin 之前 - 與 CreateTraderRequest 保持一致 Result: - TypeScript 類型完整 - 編輯交易員時正確加載和保存策略模板 - 無類型錯誤 Technical: - web/src/types.ts Line 200 - 與後端 SystemPromptTemplate 字段對應 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: tinkle-community --------- Co-authored-by: the-dev-z Co-authored-by: tinkle-community --- web/src/components/AITradersPage.tsx | 1 + web/src/types.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/web/src/components/AITradersPage.tsx b/web/src/components/AITradersPage.tsx index 13b463ae..cf1e1db1 100644 --- a/web/src/components/AITradersPage.tsx +++ b/web/src/components/AITradersPage.tsx @@ -286,6 +286,7 @@ export function AITradersPage({ onTraderSelect }: AITradersPageProps) { trading_symbols: data.trading_symbols, custom_prompt: data.custom_prompt, override_base_prompt: data.override_base_prompt, + system_prompt_template: data.system_prompt_template, is_cross_margin: data.is_cross_margin, use_coin_pool: data.use_coin_pool, use_oi_top: data.use_oi_top, diff --git a/web/src/types.ts b/web/src/types.ts index d1368c01..60ce44ed 100644 --- a/web/src/types.ts +++ b/web/src/types.ts @@ -197,6 +197,7 @@ export interface TraderConfigData { trading_symbols: string custom_prompt: string override_base_prompt: boolean + system_prompt_template: string is_cross_margin: boolean use_coin_pool: boolean use_oi_top: boolean