Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 76 additions & 11 deletions web/src/components/TraderConfigModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,13 @@ export function TraderConfigModal({
Number(e.target.value)
)
}
onBlur={(e) => {
// Force minimum value on blur
const value = Number(e.target.value)
if (value < 100) {
handleInputChange('initial_balance', 100)
}
}}
className="w-full px-3 py-2 bg-[#0B0E11] border border-[#2B3139] rounded text-[#EAECEF] focus:border-[#F0B90B] focus:outline-none"
min="100"
step="0.01"
Expand Down Expand Up @@ -617,7 +624,7 @@ export function TraderConfigModal({
{/* 系统提示词模板选择 */}
<div>
<label className="text-sm text-[#EAECEF] block mb-2">
系统提示词模板
{t('systemPromptTemplate', language)}
</label>
<select
value={formData.system_prompt_template}
Expand All @@ -626,17 +633,75 @@ export function TraderConfigModal({
}
className="w-full px-3 py-2 bg-[#0B0E11] border border-[#2B3139] rounded text-[#EAECEF] focus:border-[#F0B90B] focus:outline-none"
>
{promptTemplates.map((template) => (
<option key={template.name} value={template.name}>
{template.name === 'default'
? 'Default (默认稳健)'
: template.name === 'aggressive'
? 'Aggressive (激进)'
: template.name.charAt(0).toUpperCase() +
template.name.slice(1)}
</option>
))}
{promptTemplates.map((template) => {
// Template name mapping with i18n
const getTemplateName = (name: string) => {
const keyMap: Record<string, string> = {
default: 'promptTemplateDefault',
adaptive: 'promptTemplateAdaptive',
adaptive_relaxed: 'promptTemplateAdaptiveRelaxed',
Hansen: 'promptTemplateHansen',
nof1: 'promptTemplateNof1',
taro_long_prompts: 'promptTemplateTaroLong',
}
const key = keyMap[name]
return key
? t(key, language)
: name.charAt(0).toUpperCase() + name.slice(1)
}

return (
<option key={template.name} value={template.name}>
{getTemplateName(template.name)}
</option>
)
})}
</select>

{/* 動態描述區域 */}
<div
className="mt-2 p-3 rounded"
style={{
background: 'rgba(240, 185, 11, 0.05)',
border: '1px solid rgba(240, 185, 11, 0.15)',
}}
>
<div
className="text-xs font-semibold mb-1"
style={{ color: '#F0B90B' }}
>
{(() => {
const titleKeyMap: Record<string, string> = {
default: 'promptDescDefault',
adaptive: 'promptDescAdaptive',
adaptive_relaxed: 'promptDescAdaptiveRelaxed',
Hansen: 'promptDescHansen',
nof1: 'promptDescNof1',
taro_long_prompts: 'promptDescTaroLong',
}
const key = titleKeyMap[formData.system_prompt_template]
return key
? t(key, language)
: t('promptDescDefault', language)
})()}
</div>
<div className="text-xs" style={{ color: '#848E9C' }}>
{(() => {
const contentKeyMap: Record<string, string> = {
default: 'promptDescDefaultContent',
adaptive: 'promptDescAdaptiveContent',
adaptive_relaxed: 'promptDescAdaptiveRelaxedContent',
Hansen: 'promptDescHansenContent',
nof1: 'promptDescNof1Content',
taro_long_prompts: 'promptDescTaroLongContent',
}
const key = contentKeyMap[formData.system_prompt_template]
return key
? t(key, language)
: t('promptDescDefaultContent', language)
})()}
</div>
</div>
<p className="text-xs text-[#848E9C] mt-1">
选择预设的交易策略模板(包含交易哲学、风控原则等)
</p>
Expand Down
50 changes: 50 additions & 0 deletions web/src/i18n/translations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,33 @@ export const translations = {
altcoinLeverageValidation: 'Altcoin leverage must be between 1-20x',
invalidSymbolFormat: 'Invalid symbol format: {symbol}, must end with USDT',

// System Prompt Templates
systemPromptTemplate: 'System Prompt Template',
promptTemplateDefault: 'Default Stable',
promptTemplateAdaptive: 'Conservative Strategy',
promptTemplateAdaptiveRelaxed: 'Aggressive Strategy',
promptTemplateHansen: 'Hansen Strategy',
promptTemplateNof1: 'NoF1 English Framework',
promptTemplateTaroLong: 'Taro Long Position',
promptDescDefault: '📊 Default Stable Strategy',
promptDescDefaultContent:
'Maximize Sharpe ratio, balanced risk-reward, suitable for beginners and stable long-term trading',
promptDescAdaptive: '🛡️ Conservative Strategy (v6.0.0)',
promptDescAdaptiveContent:
'Strict risk control, BTC mandatory confirmation, high win rate priority, suitable for conservative traders',
promptDescAdaptiveRelaxed: '⚡ Aggressive Strategy (v6.0.0)',
promptDescAdaptiveRelaxedContent:
'High-frequency trading, BTC optional confirmation, pursue trading opportunities, suitable for volatile markets',
promptDescHansen: '🎯 Hansen Strategy',
promptDescHansenContent:
'Hansen custom strategy, maximize Sharpe ratio, for professional traders',
promptDescNof1: '🌐 NoF1 English Framework',
promptDescNof1Content:
'Hyperliquid exchange specialist, English prompts, maximize risk-adjusted returns',
promptDescTaroLong: '📈 Taro Long Position Strategy',
promptDescTaroLongContent:
'Data-driven decisions, multi-dimensional validation, continuous learning evolution, long position specialist',

// Loading & Error
loading: 'Loading...',
loadingError: '⚠️ Failed to load AI learning data',
Expand Down Expand Up @@ -915,6 +942,29 @@ export const translations = {
altcoinLeverageValidation: '山寨币杠杆必须在1-20倍之间',
invalidSymbolFormat: '无效的币种格式:{symbol},必须以USDT结尾',

// System Prompt Templates
systemPromptTemplate: '系统提示词模板',
promptTemplateDefault: '默认稳健',
promptTemplateAdaptive: '保守策略',
promptTemplateAdaptiveRelaxed: '激进策略',
promptTemplateHansen: 'Hansen 策略',
promptTemplateNof1: 'NoF1 英文框架',
promptTemplateTaroLong: 'Taro 长仓',
promptDescDefault: '📊 默认稳健策略',
promptDescDefaultContent: '最大化夏普比率,平衡风险收益,适合新手和长期稳定交易',
promptDescAdaptive: '🛡️ 保守策略 (v6.0.0)',
promptDescAdaptiveContent: '严格风控,BTC 强制确认,高胜率优先,适合保守型交易者',
promptDescAdaptiveRelaxed: '⚡ 激进策略 (v6.0.0)',
promptDescAdaptiveRelaxedContent:
'高频交易,BTC 可选确认,追求交易机会,适合波动市场',
promptDescHansen: '🎯 Hansen 策略',
promptDescHansenContent: 'Hansen 定制策略,最大化夏普比率,专业交易者专用',
promptDescNof1: '🌐 NoF1 英文框架',
promptDescNof1Content:
'Hyperliquid 交易所专用,英文提示词,风险调整回报最大化',
promptDescTaroLong: '📈 Taro 长仓策略',
promptDescTaroLongContent: '数据驱动决策,多维度验证,持续学习进化,长仓专用',

// Loading & Error
loading: '加载中...',
loadingError: '⚠️ 加载AI学习数据失败',
Expand Down
Loading