From c1f080f59f66ca39a5101d92b657d34c4c410fba Mon Sep 17 00:00:00 2001 From: Liu Xiang Qian Date: Mon, 3 Nov 2025 22:19:58 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E5=89=8D=E7=AB=AF?= =?UTF-8?q?=E5=AF=B9=20SystemPromptTemplate=20=E6=9B=B4=E6=96=B0=E7=9A=84?= =?UTF-8?q?=E5=AE=8C=E6=95=B4=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 修改内容 ### 后端 (api/server.go) - handleGetTraderConfig 返回中添加 system_prompt_template 字段 ### 前端类型定义 (web/src/types.ts) - TraderConfigData 接口添加 system_prompt_template 字段 ### 前端更新逻辑 (web/src/components/AITradersPage.tsx) - handleSaveEditTrader 的更新请求中添加 system_prompt_template ## 完整数据流 ``` 后端数据库 ↓ handleGetTraderConfig 前端 TraderConfigData (包含 system_prompt_template) ↓ TraderConfigModal (UI 编辑) 前端 UpdateRequest (包含 system_prompt_template) ↓ handleUpdateTrader 后端更新数据库 ``` 现在前后端已完全打通,用户可以在 UI 中编辑系统提示词模板了。 --- api/server.go | 1 + web/src/components/AITradersPage.tsx | 1 + web/src/types.ts | 1 + 3 files changed, 3 insertions(+) diff --git a/api/server.go b/api/server.go index f3b6a543..ee09f721 100644 --- a/api/server.go +++ b/api/server.go @@ -838,6 +838,7 @@ func (s *Server) handleGetTraderConfig(c *gin.Context) { "trading_symbols": traderConfig.TradingSymbols, "custom_prompt": traderConfig.CustomPrompt, "override_base_prompt": traderConfig.OverrideBasePrompt, + "system_prompt_template": traderConfig.SystemPromptTemplate, "is_cross_margin": traderConfig.IsCrossMargin, "use_coin_pool": traderConfig.UseCoinPool, "use_oi_top": traderConfig.UseOITop, diff --git a/web/src/components/AITradersPage.tsx b/web/src/components/AITradersPage.tsx index d534c0b0..9a8864c5 100644 --- a/web/src/components/AITradersPage.tsx +++ b/web/src/components/AITradersPage.tsx @@ -189,6 +189,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 7d115106..90b74e4c 100644 --- a/web/src/types.ts +++ b/web/src/types.ts @@ -195,6 +195,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;