mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2026-07-14 00:07:01 +08:00
feat(agent): make the agentic loop the primary brain path
thinkAndAct/thinkAndActStream now try the native function-calling loop first for fresh conversations; in-flight legacy flows (skill sessions, workflows, execution states, pending proposals) stay on the legacy stack until they finish. NOFX_AGENT_V2=off restores the old routing entirely.
This commit is contained in:
@@ -821,6 +821,12 @@ func (a *Agent) thinkAndAct(ctx context.Context, storeUserID string, userID int6
|
||||
lock := a.flowLock(userID)
|
||||
lock.Lock()
|
||||
defer lock.Unlock()
|
||||
if a.shouldUseAgenticTurn(userID) {
|
||||
if answer, ok, err := a.runAgenticTurn(ctx, storeUserID, userID, lang, text, nil); ok || err != nil {
|
||||
return a.maybeAppendResumePrompt(userID, lang, text, answer), err
|
||||
}
|
||||
// Not handled — fall through to the legacy routing stack.
|
||||
}
|
||||
if a.aiClient != nil {
|
||||
if answer, ok, err := a.tryLLMIntentRoute(ctx, storeUserID, userID, lang, text, nil); ok || err != nil {
|
||||
return a.maybeAppendResumePrompt(userID, lang, text, answer), err
|
||||
@@ -852,6 +858,12 @@ func (a *Agent) thinkAndActStream(ctx context.Context, storeUserID string, userI
|
||||
lock := a.flowLock(userID)
|
||||
lock.Lock()
|
||||
defer lock.Unlock()
|
||||
if a.shouldUseAgenticTurn(userID) {
|
||||
if answer, ok, err := a.runAgenticTurn(ctx, storeUserID, userID, lang, text, onEvent); ok || err != nil {
|
||||
return a.maybeAppendResumePrompt(userID, lang, text, answer), err
|
||||
}
|
||||
// Not handled — fall through to the legacy routing stack.
|
||||
}
|
||||
if a.aiClient != nil {
|
||||
if answer, ok, err := a.tryLLMIntentRoute(ctx, storeUserID, userID, lang, text, onEvent); ok || err != nil {
|
||||
answer = a.maybeAppendResumePrompt(userID, lang, text, answer)
|
||||
|
||||
Reference in New Issue
Block a user