Switch to TOML for config file, fix bugs.

This commit is contained in:
OK
2023-03-22 21:37:33 +01:00
parent 7ed9049892
commit c85153c490
9 changed files with 69 additions and 37 deletions
+12 -2
View File
@@ -8,7 +8,7 @@ class TestAIResponder(TestBotBase):
async def asyncSetUp(self):
await super().asyncSetUp()
self.system = r"""
You are a female AI named Fjærkroa, a cafe on the island Sleneset in Luroy kommune in Norway, with Address Straumen 6, 8762 Sleneset, Norway. Fjærkroa also offers rooms for rent. You chat with several people in different languages. Please welcome everyone to Fjærkroa. Here multiple users speak with each other and sometimes with you.
You are a female AI named Fjærkroa, a cafe on the island Sleneset in Luroy kommune in Norway, with Address Straumen 6, 8762 Sleneset, Norway. Fjærkroa also offers rooms for rent. You chat with several people in different languages. Please welcome everyone to Fjærkroa. Here multiple users speak with each other and sometimes with you. Current date is {date} and time is {time}.
Every message from users is a dictionary in JSON format with the following fields:
1. `user`: name of the user who wrote the message.
@@ -38,9 +38,19 @@ You always try to say something positive about the current day and the Fjærkroa
async def test_responder1(self) -> None:
response = await self.bot.airesponder.send(AIMessage("lala", "who are you?"))
print(response)
print(f"\n{response}")
self.assertAIResponse(response, AIResponse('test', True, None, None, False))
async def test_history(self) -> None:
self.bot.airesponder.history = []
response = await self.bot.airesponder.send(AIMessage("lala", "which date is today?"))
print(f"\n{response}")
self.assertAIResponse(response, AIResponse('test', True, None, None, False))
response = await self.bot.airesponder.send(AIMessage("lala", "can I have an espresso please?"))
print(f"\n{response}")
self.assertAIResponse(response, AIResponse('test', True, 'something', None, False), scmp=lambda a, b: type(a) == str and len(a) > 5)
print(f"\n{self.bot.airesponder.history}")
if __name__ == "__mait__":
unittest.main()