mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2026-07-11 06:46:59 +08:00
fix: NOFXi Agent real AI integration + quality improvements
Critical fixes: 1. Agent now uses NOFX's MCP client for AI calls (real models, not placeholder) - Gets AI client from first configured trader's MCP config - Added AutoTrader.GetMCPClient() export 2. /analyze uses REAL market data (market.Get → EMA/MACD/RSI/BB/OI/funding) then sends to AI — no more hallucinated prices 3. AI chat enriches prompts with live market data when user mentions a coin 4. Fallback: if AI unavailable, shows raw formatted market data (still useful) Router improvements: - Better natural language detection for Chinese - '该不该买' '走势' '趋势' '行情' → analyze intent - '多少钱' '赚了' '亏了' → query intent - Fewer messages falling through to generic chat Web UI: - Endpoints updated to /api/agent/* namespace - nofxi.html served at agent root (localhost:8900) Result: AI analysis now shows real BTC price, real RSI, real EMA — not fiction.
This commit is contained in:
10
main.go
10
main.go
@@ -145,6 +145,16 @@ func main() {
|
||||
|
||||
// Start NOFXi Agent (proactive intelligence layer)
|
||||
nofxiAgent := nofxiagent.New(traderManager, st, nil, slog.Default())
|
||||
|
||||
// Try to get an AI client from existing trader configs
|
||||
for _, t := range traderManager.GetAllTraders() {
|
||||
if mcpClient := t.GetMCPClient(); mcpClient != nil {
|
||||
nofxiAgent.SetAIClient(mcpClient)
|
||||
logger.Info("🧠 NOFXi Agent using AI model from trader", "trader", t.GetName())
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
nofxiAgent.Start()
|
||||
defer nofxiAgent.Stop()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user