mirror of
https://github.com/anomalyco/opencode.git
synced 2026-08-17 21:21:18 -04:00
fix(opencode): enable web search for Go (#42630)
Co-authored-by: Aiden Cline <rekram1-node@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
e23586af26
commit
4643e65ad6
@@ -56,7 +56,12 @@ import { PermissionV1 } from "@opencode-ai/core/v1/permission"
|
||||
import { McpCatalog } from "@/mcp/catalog"
|
||||
|
||||
export function webSearchEnabled(providerID: ProviderV2.ID, flags = { exa: false, parallel: false }) {
|
||||
return providerID === ProviderV2.ID.opencode || flags.exa || flags.parallel
|
||||
return (
|
||||
providerID === ProviderV2.ID.opencode ||
|
||||
providerID === ProviderV2.ID.make("opencode-go") ||
|
||||
flags.exa ||
|
||||
flags.parallel
|
||||
)
|
||||
}
|
||||
|
||||
type TaskDef = Tool.InferDef<typeof TaskTool>
|
||||
|
||||
@@ -37,8 +37,9 @@ describe("websearch provider", () => {
|
||||
expect(selectWebSearchProvider(SESSION_ID, { exa: false, parallel: true })).toBe("parallel")
|
||||
})
|
||||
|
||||
test("is only enabled for opencode or explicit websearch provider flags", () => {
|
||||
test("is enabled for OpenCode providers or explicit websearch provider flags", () => {
|
||||
expect(webSearchEnabled(ProviderV2.ID.opencode, { exa: false, parallel: false })).toBe(true)
|
||||
expect(webSearchEnabled(ProviderV2.ID.make("opencode-go"), { exa: false, parallel: false })).toBe(true)
|
||||
expect(webSearchEnabled(ProviderV2.ID.openai, { exa: false, parallel: false })).toBe(false)
|
||||
expect(webSearchEnabled(ProviderV2.ID.openai, { exa: true, parallel: false })).toBe(true)
|
||||
expect(webSearchEnabled(ProviderV2.ID.openai, { exa: false, parallel: true })).toBe(true)
|
||||
|
||||
@@ -257,7 +257,7 @@ Allows the LLM to fetch and read web pages. Useful for looking up documentation
|
||||
Search the web for information.
|
||||
|
||||
:::note
|
||||
This tool is only available when using the OpenCode provider or when the `OPENCODE_ENABLE_EXA` environment variable is set to any truthy value (e.g., `true` or `1`).
|
||||
This tool is only available when using the OpenCode or OpenCode Go provider, or when the `OPENCODE_ENABLE_EXA` environment variable is set to any truthy value (e.g., `true` or `1`).
|
||||
|
||||
To enable when launching OpenCode:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user