add: 添加命令ai model list的逻辑

This commit is contained in:
taylor
2024-10-13 20:20:21 +08:00
parent 8e82c01cab
commit 9f9e87eb5c
2 changed files with 14 additions and 10 deletions

View File

@@ -8,6 +8,8 @@ from maubot import Plugin
from mautrix.types import MessageEvent, EncryptedEvent
from mautrix.util.config import BaseProxyConfig
from maubot_llmplus.aibot import AbsAiBotPlugin
"""
AI响应对象
"""
@@ -60,14 +62,14 @@ class Platform:
async def get_context(plugin: Plugin, platform: Platform, evt: MessageEvent) -> deque:
async def get_context(plugin: AbsAiBotPlugin, platform: Platform, evt: MessageEvent) -> deque:
# 创建系统提示词上下文
system_context = deque()
# 生成当前时间
timestamp = datetime.today().strftime('%Y-%m-%d %H:%M:%S')
# 加入系统提示词
system_prompt = {"role": "system",
"content": plugin.config['system_prompt'].format(name=plugin.name, timestamp=timestamp)}
"content": plugin.config['system_prompt'].format(name=plugin.get_bot_name(), timestamp=timestamp)}
if plugin.config['enable_multi_user']:
system_prompt["content"] += """
User messages are in the context of multiperson chatrooms.