add: 添加ollama调用AI chat逻辑

This commit is contained in:
taylor
2024-10-13 16:46:13 +08:00
parent 2a8054b36a
commit 9199aacc69
4 changed files with 9 additions and 7 deletions

View File

@@ -1,4 +1,5 @@
from aiohttp import ClientSession
from maubot import Plugin
from mautrix.types import MessageEvent
from mautrix.util.config import BaseProxyConfig
@@ -10,7 +11,7 @@ class OpenAi(Platform):
def __init__(self, config: BaseProxyConfig, http: ClientSession) -> None:
super().__init__(config, http)
async def create_chat_completion(self, evt: MessageEvent) -> ChatCompletion:
async def create_chat_completion(self, plugin: Plugin, evt: MessageEvent) -> ChatCompletion:
# 获取系统提示词
# 获取额外的其他角色的提示词: role: user role: system
@@ -25,7 +26,7 @@ class Anthropic(Platform):
def __init__(self, config: BaseProxyConfig, http: ClientSession) -> None:
super().__init__(config, http)
async def create_chat_completion(self, evt: MessageEvent) -> ChatCompletion:
async def create_chat_completion(self, plugin: Plugin, evt: MessageEvent) -> ChatCompletion:
# 获取系统提示词
# 获取额外的其他角色的提示词: role: user role: system