Skip to content

Commit c1f080f

Browse files
committed
feat: 添加前端对 SystemPromptTemplate 更新的完整支持
## 修改内容 ### 后端 (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 中编辑系统提示词模板了。
1 parent b0de71b commit c1f080f

File tree

3 files changed

+3
-0
lines changed

3 files changed

+3
-0
lines changed

api/server.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -838,6 +838,7 @@ func (s *Server) handleGetTraderConfig(c *gin.Context) {
838838
"trading_symbols": traderConfig.TradingSymbols,
839839
"custom_prompt": traderConfig.CustomPrompt,
840840
"override_base_prompt": traderConfig.OverrideBasePrompt,
841+
"system_prompt_template": traderConfig.SystemPromptTemplate,
841842
"is_cross_margin": traderConfig.IsCrossMargin,
842843
"use_coin_pool": traderConfig.UseCoinPool,
843844
"use_oi_top": traderConfig.UseOITop,

web/src/components/AITradersPage.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ export function AITradersPage({ onTraderSelect }: AITradersPageProps) {
189189
trading_symbols: data.trading_symbols,
190190
custom_prompt: data.custom_prompt,
191191
override_base_prompt: data.override_base_prompt,
192+
system_prompt_template: data.system_prompt_template,
192193
is_cross_margin: data.is_cross_margin,
193194
use_coin_pool: data.use_coin_pool,
194195
use_oi_top: data.use_oi_top

web/src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ export interface TraderConfigData {
195195
trading_symbols: string;
196196
custom_prompt: string;
197197
override_base_prompt: boolean;
198+
system_prompt_template: string;
198199
is_cross_margin: boolean;
199200
use_coin_pool: boolean;
200201
use_oi_top: boolean;

0 commit comments

Comments
 (0)