Skip to content

Commit a9b71ca

Browse files
committed
pass EXA_API_KEY
1 parent 6c5d081 commit a9b71ca

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

packages/opencode/src/tool/websearch.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,11 @@ export const WebSearchTool = Tool.define("websearch", async () => {
100100
"content-type": "application/json",
101101
}
102102

103-
const response = await fetch(`${API_CONFIG.BASE_URL}${API_CONFIG.ENDPOINTS.SEARCH}`, {
103+
const exaKey = process.env.EXA_API_KEY
104+
const searchUrl = exaKey
105+
? `${API_CONFIG.BASE_URL}${API_CONFIG.ENDPOINTS.SEARCH}?exaApiKey=${exaKey}`
106+
: `${API_CONFIG.BASE_URL}${API_CONFIG.ENDPOINTS.SEARCH}`
107+
const response = await fetch(searchUrl, {
104108
method: "POST",
105109
headers,
106110
body: JSON.stringify(searchRequest),

0 commit comments

Comments
 (0)