更新 README.md、manifest.json、openapi.json 和 plugin.json 文件,重构为 Google Custom Search 插件,添加设置步骤、认证方式和限制信息,更新 API 相关参数和描述。

This commit is contained in:
foryoung365 2025-04-28 18:38:21 +08:00
parent 6e187fd927
commit 00a04bc016
4 changed files with 99 additions and 33 deletions

View File

@ -1,6 +1,41 @@
Formatting [Serper](https://serper.dev/) search API with OpenAPI format. # LobeChat Google Custom Search 插件
Designed for [LobeChat](https://github.com/lobehub/lobe-chat). 使用 [Google Custom Search API](https://developers.google.com/custom-search) 的LobeChat搜索插件。
See this plugin [on their plugin store page](https://lobechat.com/discover/plugin/search-engine-serper).
`(Not affliated with any entities above.)` ## 设置步骤
1. 创建 Google Custom Search Engine
- 访问 [Google Programmable Search Engine](https://programmablesearch.google.com/create)
- 创建一个自定义搜索引擎
- 获取您的搜索引擎ID (cx参数)
2. 获取 Google API 密钥
- 访问 [Google Cloud Console](https://console.cloud.google.com/)
- 创建一个项目
- 启用 "Custom Search API"
- 创建API密钥 (key参数)
3. 在LobeChat中配置插件
- 将此插件添加到LobeChat
- 在配置页面中提供您的API密钥和搜索引擎ID
- 这些凭据会作为安全参数自动添加到每个请求中
## 认证方式
此插件使用以下两个安全参数:
- `key`: 您的Google API密钥
- `cx`: 您的自定义搜索引擎ID
这两个参数会作为查询参数添加到API请求中。
## 限制
- Google Custom Search API 免费版每天限制100次查询
- 付费版可获得更多配额
## 隐私
- 您的搜索查询将发送到Google
- 此插件不会收集或存储您的个人数据
`(与上述任何实体无关联)`

View File

@ -1,18 +1,18 @@
{ {
"api": { "api": {
"type": "openapi", "type": "openapi",
"url": "https://raw.githubusercontent.com/GithuBarry/chat-plugin-search-engine/main/public/openapi.json", "url": "https://raw.githubusercontent.com/foryoung365/lobechat-plugin-google/main/public/openapi.json",
"is_user_authenticated": false "is_user_authenticated": false
}, },
"auth": { "auth": {
"type": "none" "type": "none"
}, },
"contact_email": "33831597+GithuBarry@users.noreply.github.com", "contact_email": "1758359+foryoung365@users.noreply.github.com",
"description_for_human": "Google search engine via Serper.dev free API (2500x🆓/month)", "description_for_human": "Google custom search engine API (100🆓/day)",
"description_for_model": "Plugin for performing web searches using the Serper.dev API to access Google search results.", "description_for_model": "Plugin for performing web searches using the Google custom search engine API.",
"legal_info_url": "https://serper.dev/terms", "legal_info_url": "https://developers.google.com/custom-search/v1/introduction",
"logo_url": "https://serper.dev/favicon.ico", "logo_url": "https://www.google.com/favicon.ico",
"name_for_human": "Search Google via Serper", "name_for_human": "Search Google via Google Custom Search",
"name_for_model": "search-engine-serper", "name_for_model": "search-engine-google-custom-search",
"schema_version": "v1" "schema_version": "v1"
} }

View File

@ -1,10 +1,17 @@
{ {
"components": { "components": {
"securitySchemes": { "securitySchemes": {
"apiAuth": { "googleApiKey": {
"type": "apiKey", "type": "apiKey",
"name": "X-API-KEY", "name": "key",
"in": "header" "in": "query",
"description": "API key for Google Custom Search API"
},
"customSearchId": {
"type": "apiKey",
"name": "cx",
"in": "query",
"description": "The custom search engine ID to use for this request"
} }
} }
}, },
@ -14,9 +21,9 @@
}, },
"openapi": "3.0.0", "openapi": "3.0.0",
"paths": { "paths": {
"/search": { "/customsearch/v1": {
"post": { "get": {
"summary": "Search Google and return top 10 results", "summary": "Search Google using Custom Search API",
"operationId": "searchGoogle", "operationId": "searchGoogle",
"parameters": [ "parameters": [
{ {
@ -28,6 +35,16 @@
"required": true, "required": true,
"description": "Search query string" "description": "Search query string"
}, },
{
"in": "query",
"name": "num",
"schema": {
"type": "integer",
"default": 10
},
"required": false,
"description": "Number of search results to return (1-10)"
},
{ {
"in": "query", "in": "query",
"name": "gl", "name": "gl",
@ -35,7 +52,7 @@
"type": "string" "type": "string"
}, },
"required": false, "required": false,
"description": "Google Geo location parameter" "description": "Geolocation of end user (country code)"
}, },
{ {
"in": "query", "in": "query",
@ -44,7 +61,7 @@
"type": "string" "type": "string"
}, },
"required": false, "required": false,
"description": "Google Geo locale parameter" "description": "Interface language"
} }
], ],
"responses": { "responses": {
@ -54,14 +71,26 @@
"application/json": { "application/json": {
"schema": { "schema": {
"type": "object", "type": "object",
"required": [
"result"
],
"properties": { "properties": {
"result": { "items": {
"type": "array",
"items": {
"type": "object",
"properties": {
"title": {
"type": "string", "type": "string",
"description": "Top 10 search results", "description": "The title of the search result"
"example": "\"title\": \"周末游推荐\",\n\"link\": \"https://www.example.com/destinations-for-weekends\",\n\"snippet\": \"周末去哪玩?周末旅游频道,精心推荐数百个周末游经典线路\",\n\"position\": 1" },
"link": {
"type": "string",
"description": "The URL of the search result"
},
"snippet": {
"type": "string",
"description": "A snippet of text from the search result"
}
}
}
} }
} }
} }
@ -71,7 +100,8 @@
}, },
"security": [ "security": [
{ {
"apiAuth": [] "googleApiKey": [],
"customSearchId": []
} }
] ]
} }
@ -79,12 +109,13 @@
}, },
"security": [ "security": [
{ {
"apiAuth": [] "googleApiKey": [],
"customSearchId": []
} }
], ],
"servers": [ "servers": [
{ {
"url": "https://google.serper.dev" "url": "https://www.googleapis.com"
} }
] ]
} }

View File

@ -1,13 +1,13 @@
{ {
"author": "Barry", "author": "Barry",
"homepage": "https://github.com/GithuBarry/chat-plugin-search-engine", "homepage": "https://github.com/GithuBarry/chat-plugin-search-engine",
"identifier": "search-engine-serper", "identifier": "search-engine-google-custom",
"manifest": "https://raw.githubusercontent.com/GithuBarry/chat-plugin-search-engine/main/public/manifest.json", "manifest": "https://raw.githubusercontent.com/GithuBarry/chat-plugin-search-engine/main/public/manifest.json",
"meta": { "meta": {
"avatar": "🔍", "avatar": "🔍",
"description": "Google search engine via Serper.dev free API (2500x🆓/month)", "description": "Google search engine via Google Custom Search API (100🆓/day)",
"tags": ["web", "search"], "tags": ["web", "search"],
"title": "Search Google via Serper" "title": "Search Google via Custom Search"
}, },
"schemaVersion": 1 "schemaVersion": 1
} }