From 3fb79a12aded24efa67ae408841770d9ab10f1ee Mon Sep 17 00:00:00 2001 From: taylor Date: Sun, 13 Oct 2024 16:36:54 +0800 Subject: [PATCH] =?UTF-8?q?add:=20=E6=B7=BB=E5=8A=A0ollama=E8=B0=83?= =?UTF-8?q?=E7=94=A8AI=20chat=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- maubot_llmplus/local_paltform.py | 5 +++-- maubot_llmplus/thrid_platform.py | 9 +++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/maubot_llmplus/local_paltform.py b/maubot_llmplus/local_paltform.py index dbfbe97..264c26c 100644 --- a/maubot_llmplus/local_paltform.py +++ b/maubot_llmplus/local_paltform.py @@ -1,5 +1,6 @@ import json +from aiohttp import ClientSession from mautrix.types import MessageEvent from mautrix.util.config import BaseProxyConfig @@ -11,8 +12,8 @@ from maubot_llmplus.platforms import Platform, ChatCompletion class Ollama(Platform): chat_api: str - def __init__(self, config: BaseProxyConfig) -> None: - super().__init__(config) + def __init__(self, config: BaseProxyConfig, http: ClientSession) -> None: + super().__init__(config, http) self.chat_api = '/api/chat' async def create_chat_completion(self, evt: MessageEvent) -> ChatCompletion: diff --git a/maubot_llmplus/thrid_platform.py b/maubot_llmplus/thrid_platform.py index 33d58d4..5b7c39e 100644 --- a/maubot_llmplus/thrid_platform.py +++ b/maubot_llmplus/thrid_platform.py @@ -1,3 +1,4 @@ +from aiohttp import ClientSession from mautrix.types import MessageEvent from mautrix.util.config import BaseProxyConfig @@ -6,8 +7,8 @@ from maubot_llmplus.platforms import Platform, ChatCompletion class OpenAi(Platform): - def __init__(self, config: BaseProxyConfig) -> None: - super().__init__(config) + def __init__(self, config: BaseProxyConfig, http: ClientSession) -> None: + super().__init__(config, http) async def create_chat_completion(self, evt: MessageEvent) -> ChatCompletion: # 获取系统提示词 @@ -21,8 +22,8 @@ class OpenAi(Platform): class Anthropic(Platform): - def __init__(self, config: BaseProxyConfig) -> None: - super().__init__(config) + def __init__(self, config: BaseProxyConfig, http: ClientSession) -> None: + super().__init__(config, http) async def create_chat_completion(self, evt: MessageEvent) -> ChatCompletion: # 获取系统提示词