Skip to content

Commit

Permalink
bug fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
fatwang2 committed Apr 24, 2024
1 parent 0b3290b commit f61a8d0
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 87 deletions.
4 changes: 3 additions & 1 deletion search2gemini.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,20 @@ addEventListener('fetch', event => {

switch (SEARCH_SERVICE) {
case "search1api":
response = await fetch("https://search.search2ai.one", {
const search1apiResponse = await fetch("https://search.search2ai.one/search", {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: typeof SEARCH1API_KEY !== "undefined" ? `Bearer ${SEARCH1API_KEY}` : "",
},
body: JSON.stringify({
query,
search_service: "google",
max_results: typeof MAX_RESULTS !== "undefined" ? MAX_RESULTS : "5",
crawl_results: typeof CRAWL_RESULTS !== "undefined" ? MAX_RESULTS : "0",
}),
});
results = await search1apiResponse.json();
break;

case "google":
Expand Down
6 changes: 3 additions & 3 deletions search2groq.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

159 changes: 80 additions & 79 deletions search2openai.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions units/news.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ async function news(query) {
crawl_results: process.env.CRAWL_RESULTS || "0"
})
});
const search1apiData = await search1apiResponse.json();
results = search1apiData.results;
results = await search1apiResponse.json();
break;

case "google":
Expand Down
3 changes: 1 addition & 2 deletions units/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ async function search(query) {
crawl_results: process.env.CRAWL_RESULTS || "0"
})
});
const search1apiData = await search1apiResponse.json();
results = search1apiData.results;
results = await search1apiResponse.json();
break;

case "google":
Expand Down

0 comments on commit f61a8d0

Please sign in to comment.