From 0905cd0fc006561f1f13be7cefa808fd83215244 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BE=84=E6=BD=AD?= Date: Mon, 3 Mar 2025 20:42:15 +0800 Subject: [PATCH] Set the llm-api-key field of the ai-search plugin to optional (#1846) --- plugins/wasm-go/extensions/ai-search/README.md | 2 +- plugins/wasm-go/extensions/ai-search/README_EN.md | 2 +- plugins/wasm-go/extensions/ai-search/main.go | 3 --- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/plugins/wasm-go/extensions/ai-search/README.md b/plugins/wasm-go/extensions/ai-search/README.md index 90a2aa955..0e8157769 100644 --- a/plugins/wasm-go/extensions/ai-search/README.md +++ b/plugins/wasm-go/extensions/ai-search/README.md @@ -39,7 +39,7 @@ description: higress 支持通过集成搜索引擎(Google/Bing/Arxiv/Elastics |------|----------|----------|--------|------| | llmServiceName | string | 必填 | - | LLM服务名称 | | llmServicePort | number | 必填 | - | LLM服务端口 | -| llmApiKey | string | 必填 | - | LLM服务API密钥 | +| llmApiKey | string | 选填 | - | LLM服务API密钥 | | llmUrl | string | 必填 | - | LLM服务API地址 | | llmModelName | string | 必填 | - | LLM模型名称 | | timeoutMillisecond | number | 选填 | 30000 | API调用超时时间(毫秒) | diff --git a/plugins/wasm-go/extensions/ai-search/README_EN.md b/plugins/wasm-go/extensions/ai-search/README_EN.md index c56604a8f..f33dcfbb4 100644 --- a/plugins/wasm-go/extensions/ai-search/README_EN.md +++ b/plugins/wasm-go/extensions/ai-search/README_EN.md @@ -39,7 +39,7 @@ It is strongly recommended to enable this feature when using Arxiv or Elasticsea |------|-----------|-------------|---------------|-------------| | llmServiceName | string | Required | - | LLM service name | | llmServicePort | number | Required | - | LLM service port | -| llmApiKey | string | Required | - | LLM service API key | +| llmApiKey | string | Optional | - | LLM service API key | | llmUrl | string | Required | - | LLM service API URL | | llmModelName | string | Required | - | LLM model name | | timeoutMillisecond | number | Optional | 30000 | API call timeout (milliseconds) | diff --git a/plugins/wasm-go/extensions/ai-search/main.go b/plugins/wasm-go/extensions/ai-search/main.go index 59446d0a3..c9a08ea39 100644 --- a/plugins/wasm-go/extensions/ai-search/main.go +++ b/plugins/wasm-go/extensions/ai-search/main.go @@ -196,9 +196,6 @@ func parseConfig(json gjson.Result, config *Config, log wrapper.Log) error { Port: llmServicePort, }) llmApiKey := searchRewriteJson.Get("llmApiKey").String() - if llmApiKey == "" { - return errors.New("llmApiKey not found") - } searchRewrite.apiKey = llmApiKey llmUrl := searchRewriteJson.Get("llmUrl").String() if llmUrl == "" {