From 5506fb83bbbcef244635a912f69db83966e0738c Mon Sep 17 00:00:00 2001 From: taylor <=> Date: Mon, 14 Oct 2024 17:38:46 +0800 Subject: [PATCH] =?UTF-8?q?update:=20=E4=BF=AE=E6=94=B9anthropic=E8=AF=B7?= =?UTF-8?q?=E6=B1=82=E4=BD=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- maubot_llmplus/platforms.py | 4 ++-- maubot_llmplus/thrid_platform.py | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/maubot_llmplus/platforms.py b/maubot_llmplus/platforms.py index e1d2ef0..0cfe375 100644 --- a/maubot_llmplus/platforms.py +++ b/maubot_llmplus/platforms.py @@ -133,8 +133,8 @@ async def get_chat_context(system_context: deque, plugin: AbsExtraConfigPlugin, 获取总消息上下文 """ async def get_context(plugin: AbsExtraConfigPlugin, platform: Platform, evt: MessageEvent) -> deque: - system_context = get_system_context(plugin, platform, evt) - chat_context = get_chat_context(system_context, plugin, platform, evt) + system_context = await get_system_context(plugin, platform, evt) + chat_context = await get_chat_context(system_context, plugin, platform, evt) return system_context + chat_context async def generate_context_messages(plugin: Plugin, platform: Platform, evt: MessageEvent) -> Generator[MessageEvent, None, None]: diff --git a/maubot_llmplus/thrid_platform.py b/maubot_llmplus/thrid_platform.py index 1170658..3239ecb 100644 --- a/maubot_llmplus/thrid_platform.py +++ b/maubot_llmplus/thrid_platform.py @@ -83,11 +83,10 @@ class Anthropic(Platform): async def create_chat_completion(self, plugin: AbsExtraConfigPlugin, evt: MessageEvent) -> ChatCompletion: full_chat_context = [] - chat_context = await maubot_llmplus.platforms.get_chat_context(plugin, self, evt) - full_chat_context.extend(list(chat_context)) - - full_system_context = [] system_context = await maubot_llmplus.platforms.get_system_context(plugin, self, evt) + full_system_context = [] + chat_context = await maubot_llmplus.platforms.get_chat_context(system_context, plugin, self, evt) + full_chat_context.extend(list(chat_context)) full_system_context.extend(list(system_context)) endpoint = f"{self.url}/v1/messages"