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:
@@ -55,7 +55,6 @@ Here is the knowledge I have gathered from ` + fmt.Sprint(len(sources)) + ` sour
|
||||
|
||||
res, err := a.WithSystemPrompt(systemPrompt).
|
||||
WithSystemPromptSuffix(``).
|
||||
WithToolbox(nil).
|
||||
CallAndExecute(ctx)
|
||||
if err != nil {
|
||||
return "", err
|
||||
@@ -102,7 +101,6 @@ The moon is 4.5 billion years old [1,2], 238,855 miles away from the Earth [3],
|
||||
|
||||
res, err = a.WithSystemPrompt(systemPrompt).
|
||||
WithSystemPromptSuffix(``).
|
||||
WithToolbox(nil).
|
||||
CallAndExecute(ctx, gollm.Message{Role: gollm.RoleSystem, Text: providedIntel}, summarizedData)
|
||||
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user