mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2026-07-11 14:56:57 +08:00
fix: Agent answers questions first, setup only when asked
Core behavior change: - Agent NO LONGER auto-prompts setup on first message - Setup only triggers on explicit: '开始配置' / 'setup' / '绑定交易所' - Normal questions answered normally, even without trader configured - AI analysis works without AI model (shows raw data + guidance) - Stock analysis shows 'coming soon' instead of error Intent routing improved: - '你能分析拓维信息吗' → correctly routes to analyze - Chinese suffixes cleaned (吗/呢/这只股票) - More natural language patterns matched Philosophy: Agent should be helpful from minute one. Configuration is optional, not a gate.
This commit is contained in:
@@ -142,24 +142,14 @@ func (a *Agent) handleSetupFlow(userID int64, text string, L string) (string, bo
|
||||
return a.finishSetup(userID, state, L)
|
||||
}
|
||||
|
||||
// Not in setup flow — check if setup is needed and user seems to want to start
|
||||
if a.needsSetup() {
|
||||
// Any message triggers setup prompt when no trader exists
|
||||
if lower == "/help" || lower == "/status" || lower == "help" {
|
||||
return a.setupMsg(L, "welcome"), true
|
||||
}
|
||||
// Check if user is trying to set up
|
||||
if containsAny(lower, []string{"connect", "setup", "配置", "连接", "设置", "开始", "start", "初始化"}) {
|
||||
state.Step = "await_exchange"
|
||||
a.saveSetupState(userID, state)
|
||||
return a.setupMsg(L, "ask_exchange"), true
|
||||
}
|
||||
// First time — show welcome
|
||||
if state.Step == "" {
|
||||
return a.setupMsg(L, "welcome"), true
|
||||
}
|
||||
// Not in setup flow — only enter setup when user EXPLICITLY asks
|
||||
if containsAny(lower, []string{"connect", "setup", "配置", "连接", "设置", "初始化", "绑定交易所", "添加交易所"}) {
|
||||
state.Step = "await_exchange"
|
||||
a.saveSetupState(userID, state)
|
||||
return a.setupMsg(L, "ask_exchange"), true
|
||||
}
|
||||
|
||||
// Everything else — let normal routing handle it
|
||||
return "", false
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user