add: 添加ollama调用AI chat逻辑

This commit is contained in:
taylor
2024-10-13 16:23:26 +08:00
parent 2adb82d6c0
commit 6786394b79

View File

@@ -8,8 +8,6 @@ from maubot import Plugin
from mautrix.types import MessageEvent, EncryptedEvent
from mautrix.util.config import BaseProxyConfig
import maubot_llmplus.aibot
"""
AI响应对象
"""
@@ -59,7 +57,7 @@ class Platform:
async def get_context(plugin: maubot_llmplus.aibot.AiBotPlugin, evt: MessageEvent) -> deque:
async def get_context(plugin: Plugin, evt: MessageEvent) -> deque:
# 创建系统提示词上下文
system_context = deque()
# 生成当前时间
@@ -122,7 +120,7 @@ async def get_context(plugin: maubot_llmplus.aibot.AiBotPlugin, evt: MessageEven
async def generate_context_messages(plugin: maubot_llmplus.aibot.AiBotPlugin, evt: MessageEvent) -> Generator[MessageEvent, None, None]:
async def generate_context_messages(plugin: Plugin, evt: MessageEvent) -> Generator[MessageEvent, None, None]:
yield evt
if plugin.config['reply_in_thread']:
while evt.content.relates_to.in_reply_to: