mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2026-07-11 23:07:01 +08:00
fix: 修复AI学习数据加载失败问题
问题描述: - AILearning组件直接使用硬编码的localhost:8080地址 - 绕过了Vite代理配置,导致加载失败 - 在生产环境无法正常工作 修复内容: 1. api.ts: 添加统一的getPerformance()方法 2. AILearning.tsx: 移除硬编码URL,使用统一API 3. 删除多余的fetcher函数 技术改进: - 使用Vite代理配置,避免CORS问题 - 统一API管理,提高可维护性 - 支持开发和生产环境 影响范围: - web/src/lib/api.ts: +11行 (新增getPerformance方法) - web/src/components/AILearning.tsx: -4行, +2行 (重构API调用) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -100,4 +100,14 @@ export const api = {
|
||||
if (!res.ok) throw new Error('获取历史数据失败');
|
||||
return res.json();
|
||||
},
|
||||
|
||||
// 获取AI学习表现分析(支持trader_id)
|
||||
async getPerformance(traderId?: string): Promise<any> {
|
||||
const url = traderId
|
||||
? `${API_BASE}/performance?trader_id=${traderId}`
|
||||
: `${API_BASE}/performance`;
|
||||
const res = await fetch(url);
|
||||
if (!res.ok) throw new Error('获取AI学习数据失败');
|
||||
return res.json();
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user