θΏ™ζ˜―indexlocζδΎ›ηš„ζœεŠ‘οΌŒδΈθ¦θΎ“ε…₯任何密码
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"royalblue",
"SearchApi",
"searxng",
"SerpApi",
"Serper",
"Serply",
"streamable",
Expand Down
4 changes: 4 additions & 0 deletions docker/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,10 @@ GID='1000'
# AGENT_SEARCHAPI_API_KEY=
# AGENT_SEARCHAPI_ENGINE=google

#------ SerpApi ----------- https://serpapi.com/
# AGENT_SERPAPI_API_KEY=
# AGENT_SERPAPI_ENGINE=google

#------ Serper.dev ----------- https://serper.dev/
# AGENT_SERPER_DEV_KEY=

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,80 @@ export function GoogleSearchOptions({ settings }) {
);
}

const SerpApiEngines = [
{ name: "Google Search", value: "google" },
{ name: "Google Images", value: "google_images_light" },
{ name: "Google Jobs", value: "google_jobs" },
{ name: "Google Maps", value: "google_maps" },
{ name: "Google News", value: "google_news_light" },
{ name: "Google Patents", value: "google_patents" },
{ name: "Google Scholar", value: "google_scholar" },
{ name: "Google Shopping", value: "google_shopping_light" },
{ name: "Amazon", value: "amazon" },
{ name: "Baidu", value: "baidu" },
];
export function SerpApiOptions({ settings }) {
return (
<>
<p className="text-sm text-white/60 my-2">
Get a free API key{" "}
<a
href="https://serpapi.com/"
target="_blank"
rel="noreferrer"
className="text-blue-300 underline"
>
from SerpApi.
</a>
</p>
<div className="flex gap-x-4">
<div className="flex flex-col w-60">
<label className="text-white text-sm font-semibold block mb-3">
API Key
</label>
<input
type="password"
name="env::AgentSerpApiKey"
className="border-none bg-theme-settings-input-bg text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5"
placeholder="SerpApi API Key"
defaultValue={settings?.AgentSerpApiKey ? "*".repeat(20) : ""}
required={true}
autoComplete="off"
spellCheck={false}
/>
</div>
<div className="flex flex-col w-60">
<label className="text-white text-sm font-semibold block mb-3">
Engine
</label>
<select
name="env::AgentSerpApiEngine"
required={true}
className="border-none bg-theme-settings-input-bg text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5"
defaultValue={settings?.AgentSerpApiEngine || "google"}
>
{SerpApiEngines.map(({ name, value }) => (
<option key={name} value={value}>
{name}
</option>
))}
</select>
{/* <input
type="text"
name="env::AgentSerpApiEngine"
className="border-none bg-theme-settings-input-bg text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5"
placeholder="SerpApi engine (Google, Amazon...)"
defaultValue={settings?.AgentSerpApiEngine || "google"}
required={true}
autoComplete="off"
spellCheck={false}
/> */}
</div>
</div>
</>
);
}

const SearchApiEngines = [
{ name: "Google Search", value: "google" },
{ name: "Google Maps", value: "google_maps" },
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions frontend/src/pages/Admin/Agents/WebSearchSelection/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { useEffect, useRef, useState } from "react";
import Admin from "@/models/admin";
import AnythingLLMIcon from "@/media/logo/anything-llm-icon.png";
import GoogleSearchIcon from "./icons/google.png";
import SerpApiIcon from "./icons/serpapi.png";
import SearchApiIcon from "./icons/searchapi.png";
import SerperDotDevIcon from "./icons/serper.png";
import BingSearchIcon from "./icons/bing.png";
Expand All @@ -19,6 +20,7 @@ import {
import SearchProviderItem from "./SearchProviderItem";
import WebSearchImage from "@/media/agents/scrape-websites.png";
import {
SerpApiOptions,
SearchApiOptions,
SerperDotDevOptions,
GoogleSearchOptions,
Expand Down Expand Up @@ -54,6 +56,14 @@ const SEARCH_PROVIDERS = [
description:
"Web search powered by a custom Google Search Engine. Free for 100 queries per day.",
},
{
name: "SerpApi",
value: "serpapi",
logo: SerpApiIcon,
options: (settings) => <SerpApiOptions settings={settings} />,
description:
"Scrape Google and several other search engines with SerpApi. 250 free searches every month, and then paid.",
},
{
name: "SearchApi",
value: "searchapi",
Expand Down
4 changes: 4 additions & 0 deletions server/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,10 @@ TTS_PROVIDER="native"
# AGENT_GSE_KEY=
# AGENT_GSE_CTX=

#------ SerpApi ----------- https://serpapi.com/
# AGENT_SERPAPI_API_KEY=
# AGENT_SERPAPI_ENGINE=google

#------ SearchApi.io ----------- https://www.searchapi.io/
# AGENT_SEARCHAPI_API_KEY=
# AGENT_SEARCHAPI_ENGINE=google
Expand Down
3 changes: 3 additions & 0 deletions server/models/systemSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ const SystemSettings = {
if (
![
"google-search-engine",
"serpapi",
"searchapi",
"serper-dot-dev",
"bing-search",
Expand Down Expand Up @@ -276,6 +277,8 @@ const SystemSettings = {
// --------------------------------------------------------
AgentGoogleSearchEngineId: process.env.AGENT_GSE_CTX || null,
AgentGoogleSearchEngineKey: !!process.env.AGENT_GSE_KEY || null,
AgentSerpApiKey: !!process.env.AGENT_SERPAPI_API_KEY || null,
AgentSerpApiEngine: process.env.AGENT_SERPAPI_ENGINE || "google",
AgentSearchApiKey: !!process.env.AGENT_SEARCHAPI_API_KEY || null,
AgentSearchApiEngine: process.env.AGENT_SEARCHAPI_ENGINE || "google",
AgentSerperApiKey: !!process.env.AGENT_SERPER_DEV_KEY || null,
Expand Down
Loading