From c5b8566d83f503e06a8082645d2cc55986cada8b Mon Sep 17 00:00:00 2001 From: taylor Date: Sun, 13 Oct 2024 19:52:35 +0800 Subject: [PATCH] =?UTF-8?q?add:=20=E6=B7=BB=E5=8A=A0=E5=91=BD=E4=BB=A4ai?= =?UTF-8?q?=20model=20list=E7=9A=84=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- maubot_llmplus/aibot.py | 8 ++++---- maubot_llmplus/local_paltform.py | 8 ++++---- maubot_llmplus/platforms.py | 4 +--- maubot_llmplus/thrid_platform.py | 8 ++++---- 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/maubot_llmplus/aibot.py b/maubot_llmplus/aibot.py index d044228..8acca0b 100644 --- a/maubot_llmplus/aibot.py +++ b/maubot_llmplus/aibot.py @@ -141,15 +141,15 @@ class AiBotPlugin(Plugin): if use_platform == 'local_ai': type = self.config['platforms']['local_ai']['type'] if type == 'ollama': - return Ollama(self.config, self.name, self.http) + return Ollama(self.config, self.http) elif type == 'lmstudio': - return LmStudio(self.config, self.name, self.http) + return LmStudio(self.config, self.http) else: raise ValueError(f"not found platform type: {type}") if use_platform == 'openai': - return OpenAi(self.config, self.name, self.http) + return OpenAi(self.config, self.http) if use_platform == 'anthropic': - return Anthropic(self.config, self.name, self.http) + return Anthropic(self.config, self.http) raise ValueError(f"unknown backend type {use_platform}") """ diff --git a/maubot_llmplus/local_paltform.py b/maubot_llmplus/local_paltform.py index 7cee119..fb14e21 100644 --- a/maubot_llmplus/local_paltform.py +++ b/maubot_llmplus/local_paltform.py @@ -14,8 +14,8 @@ from maubot_llmplus.platforms import Platform, ChatCompletion class Ollama(Platform): chat_api: str - def __init__(self, config: BaseProxyConfig, name: str, http: ClientSession) -> None: - super().__init__(config, name, http) + def __init__(self, config: BaseProxyConfig, http: ClientSession) -> None: + super().__init__(config, http) self.chat_api = '/api/chat' async def create_chat_completion(self, plugin: Plugin, evt: MessageEvent) -> ChatCompletion: @@ -55,8 +55,8 @@ class Ollama(Platform): class LmStudio(Platform): - def __init__(self, config: BaseProxyConfig, name: str, http: ClientSession) -> None: - super().__init__(config, name, http) + def __init__(self, config: BaseProxyConfig, http: ClientSession) -> None: + super().__init__(config, http) pass async def create_chat_completion(self, plugin: Plugin, evt: MessageEvent) -> ChatCompletion: diff --git a/maubot_llmplus/platforms.py b/maubot_llmplus/platforms.py index 9e4b2df..a118909 100644 --- a/maubot_llmplus/platforms.py +++ b/maubot_llmplus/platforms.py @@ -33,9 +33,8 @@ class Platform: additional_prompt: List[dict] system_prompt: str max_context_messages: int - name: str - def __init__(self, config: BaseProxyConfig, name: str, http: ClientSession) -> None: + def __init__(self, config: BaseProxyConfig, http: ClientSession) -> None: self.http = http self.config = config['platforms'][self.get_type()] self.url = self.config['url'] @@ -45,7 +44,6 @@ class Platform: self.max_context_messages = self.config['max_context_messages'] self.additional_prompt = config['additional_prompt'] self.system_prompt = config['system_prompt'] - self.name = name """a 调用AI对话接口, 响应结果 diff --git a/maubot_llmplus/thrid_platform.py b/maubot_llmplus/thrid_platform.py index d7691e9..8dd03cb 100644 --- a/maubot_llmplus/thrid_platform.py +++ b/maubot_llmplus/thrid_platform.py @@ -8,8 +8,8 @@ from maubot_llmplus.platforms import Platform, ChatCompletion class OpenAi(Platform): - def __init__(self, config: BaseProxyConfig, name: str, http: ClientSession) -> None: - super().__init__(config, name, http) + def __init__(self, config: BaseProxyConfig, http: ClientSession) -> None: + super().__init__(config, http) async def create_chat_completion(self, plugin: Plugin, evt: MessageEvent) -> ChatCompletion: # 获取系统提示词 @@ -23,8 +23,8 @@ class OpenAi(Platform): class Anthropic(Platform): - def __init__(self, config: BaseProxyConfig, name: str, http: ClientSession) -> None: - super().__init__(config, name, http) + def __init__(self, config: BaseProxyConfig, http: ClientSession) -> None: + super().__init__(config, http) async def create_chat_completion(self, plugin: Plugin, evt: MessageEvent) -> ChatCompletion: # 获取系统提示词