feat: conversational onboarding — setup exchange & AI via chat

Users no longer need Web UI to configure NOFXi. The agent guides them
through setup via natural language:

1. First message → agent detects no traders → shows welcome
2. User says '开始配置' or 'setup'
3. Agent asks: which exchange? (1-7, name, or Chinese name)
4. Agent asks: API Key → API Secret → Passphrase (if needed)
5. Agent asks: which AI model? (DeepSeek/Qwen/GPT/Claude/Skip)
6. Agent asks: AI API Key
7. Agent creates Exchange + AIModel + Trader in NOFX store
8. Done. User can immediately start using /analyze, /positions, etc.

Features:
- Full Chinese/English bilingual flow
- Cancel anytime with '取消' or 'cancel'
- State persisted in SystemConfig (survives restarts)
- Supports all 7 exchanges + 4 AI providers
- OKX/Bitget/KuCoin auto-asks for Passphrase
- API keys stored encrypted via NOFX crypto service
This commit is contained in:
shinchan-zhai
2026-03-23 00:16:50 +08:00
parent fb456a3537
commit 0f086e5ebc
2 changed files with 432 additions and 0 deletions

View File

@@ -152,6 +152,11 @@ func (a *Agent) HandleMessage(ctx context.Context, userID int64, text string) (s
a.logger.Info("agent message", "user_id", userID, "text", text)
// Setup flow — if no traders configured, guide user through setup
if resp, handled := a.handleSetupFlow(userID, text, lang); handled {
return resp, nil
}
intent := a.router.Route(text)
switch intent.Type {