feat: unit test
perf: func call improvement
This commit is contained in:
@@ -210,6 +210,9 @@ class AIOCQHTTP(Platform):
|
||||
if isinstance(segment, Image):
|
||||
image_idx.append(idx)
|
||||
ret.append(d)
|
||||
if os.environ.get('TEST_MODE', 'off') == 'on':
|
||||
logger.info(f"回复消息: {ret}")
|
||||
return
|
||||
try:
|
||||
if isinstance(message, AstrBotMessage):
|
||||
await self.bot.send(message.raw_message, ret)
|
||||
|
||||
@@ -52,7 +52,7 @@ class botClient(Client):
|
||||
|
||||
class QQOfficial(Platform):
|
||||
|
||||
def __init__(self, context: Context, message_handler: MessageHandler, test_mode = False) -> None:
|
||||
def __init__(self, context: Context, message_handler: MessageHandler) -> None:
|
||||
super().__init__("qqofficial", context)
|
||||
self.loop = asyncio.new_event_loop()
|
||||
asyncio.set_event_loop(self.loop)
|
||||
@@ -87,7 +87,7 @@ class QQOfficial(Platform):
|
||||
|
||||
self.client.set_platform(self)
|
||||
|
||||
self.test_mode = test_mode
|
||||
self.test_mode = os.environ.get('TEST_MODE', 'off') == 'on'
|
||||
|
||||
async def _parse_to_qqofficial(self, message: List[BaseMessageComponent], is_group: bool = False):
|
||||
plain_text = ""
|
||||
|
||||
@@ -296,6 +296,9 @@ class ProviderOpenAIOfficial(Provider):
|
||||
extra_conf: Dict = None,
|
||||
**kwargs
|
||||
) -> str:
|
||||
if os.environ.get("TEST_LLM", "off") == "on":
|
||||
return "这是一个测试消息。"
|
||||
|
||||
super().accu_model_stat()
|
||||
if not session_id:
|
||||
session_id = "unknown"
|
||||
|
||||
Reference in New Issue
Block a user