Fix browser closure timing in search agent

Move defer statement to ensure browser closure occurs only after assigning the browser to the context. This prevents potential issues of premature resource release.
This commit is contained in:
2025-04-12 02:22:10 -04:00
parent 7a77d74624
commit 1be5cc047c
6 changed files with 51 additions and 20 deletions

View File

@@ -92,7 +92,7 @@ func (a Agent) SearchAndUseTools(ctx context.Context, searchQuery string, questi
var lock sync.Mutex
var analyzed []int
var converted []*gollm.Function
var converted []gollm.Function
for _, t := range tools {
fn := gollm.NewFunction(t.Name, t.Description,