fix for review
This commit is contained in:
parent
0fd7a401a2
commit
ee959d5ba0
2 changed files with 14 additions and 3 deletions
|
|
@ -488,9 +488,12 @@ func restartServices(
|
|||
}
|
||||
|
||||
// Wire up voice transcription with new config
|
||||
if transcriber := voice.DetectTranscriber(cfg); transcriber != nil {
|
||||
al.SetTranscriber(transcriber)
|
||||
logger.InfoCF("voice", "Transcription enabled (agent-level)", map[string]any{"provider": transcriber.Name()})
|
||||
transcriber := voice.DetectTranscriber(cfg)
|
||||
al.SetTranscriber(transcriber) // This will set it to nil if disabled
|
||||
if transcriber != nil {
|
||||
logger.InfoCF("voice", "Transcription re-enabled (agent-level)", map[string]any{"provider": transcriber.Name()})
|
||||
} else {
|
||||
logger.InfoCF("voice", "Transcription disabled", nil)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
|
|||
|
|
@ -49,6 +49,8 @@ type AgentLoop struct {
|
|||
cmdRegistry *commands.Registry
|
||||
mcp mcpRuntime
|
||||
mu sync.RWMutex
|
||||
// Track active requests for safe provider cleanup
|
||||
activeRequests sync.WaitGroup
|
||||
}
|
||||
|
||||
// processOptions configures how a message is processed
|
||||
|
|
@ -1059,6 +1061,9 @@ func (al *AgentLoop) runLLMIteration(
|
|||
}
|
||||
|
||||
callLLM := func() (*providers.LLMResponse, error) {
|
||||
al.activeRequests.Add(1)
|
||||
defer al.activeRequests.Done()
|
||||
|
||||
if len(activeCandidates) > 1 && al.fallback != nil {
|
||||
fbResult, fbErr := al.fallback.Execute(
|
||||
ctx,
|
||||
|
|
@ -1716,6 +1721,7 @@ func (al *AgentLoop) retryLLMCall(
|
|||
var err error
|
||||
|
||||
for attempt := 0; attempt < maxRetries; attempt++ {
|
||||
al.activeRequests.Add(1)
|
||||
resp, err = agent.Provider.Chat(
|
||||
ctx,
|
||||
[]providers.Message{{Role: "user", Content: prompt}},
|
||||
|
|
@ -1727,6 +1733,8 @@ func (al *AgentLoop) retryLLMCall(
|
|||
"prompt_cache_key": agent.ID,
|
||||
},
|
||||
)
|
||||
al.activeRequests.Done()
|
||||
|
||||
if err == nil && resp != nil && resp.Content != "" {
|
||||
return resp, nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue