Merge branch 'dev' of github.com:Icyoung/nofx

# Conflicts:
#	manager/trader_manager.go
#	web/src/components/AITradersPage.tsx
This commit is contained in:
icy
2025-11-01 02:23:05 +08:00
3 changed files with 34 additions and 13 deletions

View File

@@ -67,17 +67,12 @@ export function AITradersPage({ onTraderSelect }: AITradersPageProps) {
useEffect(() => {
const loadConfigs = async () => {
try {
console.log('🔄 开始加载模型和交易所配置...');
const [modelConfigs, exchangeConfigs, supportedModels, supportedExchanges] = await Promise.all([
api.getModelConfigs(),
api.getExchangeConfigs(),
api.getSupportedModels(),
api.getSupportedExchanges()
]);
console.log('✅ 用户模型配置加载成功:', modelConfigs);
console.log('✅ 用户交易所配置加载成功:', exchangeConfigs);
console.log('✅ 支持的模型加载成功:', supportedModels);
console.log('✅ 支持的交易所加载成功:', supportedExchanges);
setAllModels(modelConfigs);
setAllExchanges(exchangeConfigs);
setSupportedModels(supportedModels);
@@ -94,7 +89,7 @@ export function AITradersPage({ onTraderSelect }: AITradersPageProps) {
console.log('📡 用户信号源配置暂未设置');
}
} catch (error) {
console.error('❌ 加载配置失败:', error);
console.error('Failed to load configs:', error);
}
};
loadConfigs();
@@ -107,11 +102,20 @@ export function AITradersPage({ onTraderSelect }: AITradersPageProps) {
// 只在创建交易员时使用已启用且配置完整的
const enabledModels = allModels?.filter(m => m.enabled && m.apiKey) || [];
const enabledExchanges = allExchanges?.filter(e => {
if (!e.enabled || !e.apiKey) return false;
if (!e.enabled) return false;
// Aster 交易所需要特殊字段
if (e.id === 'aster') {
return e.asterUser && e.asterSigner && e.asterPrivateKey;
}
// Hyperliquid 只需要私钥作为apiKey不需要secretKey
if (e.id === 'hyperliquid') return true;
// 其他交易所需要secretKey
return e.secretKey && e.secretKey.trim() !== '';
if (e.id === 'hyperliquid') {
return e.apiKey && e.hyperliquidWalletAddr;
}
// Binance 等其他交易所需要 apiKey 和 secretKey
return e.apiKey && e.apiKey.trim() !== '' && e.secretKey && e.secretKey.trim() !== '';
}) || [];
// 检查模型是否正在被运行中的交易员使用