fix: 处理插件 import mirai 时的兼容性问题

This commit is contained in:
RockChinQ 2024-09-26 14:38:18 +08:00
parent 3469515e04
commit c53ffaca6c
No known key found for this signature in database
GPG Key ID: 8AC0BEFE1743A015
2 changed files with 6 additions and 1 deletions

View File

@ -110,7 +110,7 @@ class Session(pydantic.BaseModel):
using_conversation: typing.Optional[Conversation] = None
conversations: typing.Optional[list[Conversation]] = []
conversations: typing.Optional[list[Conversation]] = pydantic.Field(default_factory=list)
create_time: typing.Optional[datetime.datetime] = pydantic.Field(default_factory=datetime.datetime.now)

View File

@ -2,6 +2,7 @@ from __future__ import annotations
import json
import os
import sys
import logging
import asyncio
import traceback
@ -15,6 +16,10 @@ from .types import message as platform_message
from .types import events as platform_events
from .types import entities as platform_entities
# 处理 3.4 移除了 YiriMirai 之后,插件的兼容性问题
from . import types as mirai
sys.modules['mirai'] = mirai
# 控制QQ消息输入输出的类
class PlatformManager: