Files
nofx/start.sh
shinchan-zhai d69dad5c1a fix: smart routing + auto AI client from store
1. Complex natural language → AI chat (not regex analyze)
   '拓维信息这个股怎么样帮我写策略' now goes to AI, not broken regex

2. Agent auto-loads AI client from store on startup
   - Scans AIModel configs, creates MCP client from first available
   - No manual injection needed

3. Added start.sh for one-command startup (backend + frontend)

Routing logic:
- /analyze BTC (simple, ≤3 words) → structured analyze
- Complex sentences → AI chat with full context
- This is the key insight: regex can't parse natural language, AI can
2026-03-25 01:05:54 +08:00

35 lines
1008 B
Bash
Executable File

#!/bin/bash
# NOFXi startup script
cd "$(dirname "$0")"
# Load env
export RSA_PRIVATE_KEY=$(grep "^RSA_PRIVATE_KEY=" .env | sed 's/^RSA_PRIVATE_KEY=//' | sed 's/\\n/\n/g')
export DATA_ENCRYPTION_KEY=$(grep "^DATA_ENCRYPTION_KEY=" .env | sed 's/^DATA_ENCRYPTION_KEY=//')
export JWT_SECRET=$(grep "^JWT_SECRET=" .env | sed 's/^JWT_SECRET=//')
# Kill old processes
pkill -f "./nofx" 2>/dev/null
pkill -f "vite" 2>/dev/null
sleep 1
# Build
echo "🔨 Building NOFXi..."
go build -o nofx . || exit 1
# Start backend
echo "🚀 Starting backend (:8080)..."
./nofx > nofxi.log 2>&1 &
sleep 3
# Start frontend
echo "🎨 Starting frontend (:3000)..."
cd web && npx vite > /tmp/nofxi-web.log 2>&1 &
sleep 2
# Verify
echo ""
curl -s http://localhost:8080/api/agent/health > /dev/null && echo "✅ Backend: http://localhost:8080" || echo "❌ Backend failed"
curl -s http://localhost:3000/ > /dev/null && echo "✅ Frontend: http://localhost:3000" || echo "❌ Frontend failed"
echo ""
echo "NOFXi is ready 🧠"