From aeae3410a08cecbd09c953d9ad1d441d09f23084 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E5=BB=BA=E6=AD=A6?= Date: Wed, 14 May 2025 15:28:57 +0800 Subject: [PATCH] =?UTF-8?q?feat(db):=20=E6=B7=BB=E5=8A=A0=20Ollama?= =?UTF-8?q?=E6=9C=AC=E5=9C=B0=E7=A6=BB=E7=BA=BF=E6=A8=A1=E5=9E=8B=E6=94=AF?= =?UTF-8?q?=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 builtin_providers.json 中添加 Ollama 提供商配置 - 修改 OpenAI_compatible_provider.py,优化与 Ollama 的兼容性 --- backend/app/db/builtin_providers.json | 8 ++++++++ backend/app/gpt/provider/OpenAI_compatible_provider.py | 1 - 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/backend/app/db/builtin_providers.json b/backend/app/db/builtin_providers.json index 3b09aa8..40d6654 100644 --- a/backend/app/db/builtin_providers.json +++ b/backend/app/db/builtin_providers.json @@ -46,5 +46,13 @@ "logo": "Groq", "api_key": "", "base_url": "https://api.groq.com/openai/v1" + }, + { + "id": "ollama", + "name": "ollama", + "type": "built-in", + "logo": "Ollama", + "api_key": "", + "base_url": "http://127.0.0.1:11434/v1" } ] diff --git a/backend/app/gpt/provider/OpenAI_compatible_provider.py b/backend/app/gpt/provider/OpenAI_compatible_provider.py index f78984a..6719456 100644 --- a/backend/app/gpt/provider/OpenAI_compatible_provider.py +++ b/backend/app/gpt/provider/OpenAI_compatible_provider.py @@ -16,7 +16,6 @@ class OpenAICompatibleProvider: print(api_key) try: client = OpenAI(api_key=api_key, base_url=base_url) - client.models.list() return True except Exception as e: