Implement possibility to answer to a different channel

This commit is contained in:
OK
2023-04-12 17:56:31 +02:00
parent defe598651
commit b1ece64874
6 changed files with 74 additions and 58 deletions
+9 -7
View File
@@ -21,7 +21,7 @@ class TestBotBase(unittest.IsolatedAsyncioTestCase):
]
self.config_data = {
"openai-token": os.environ.get('OPENAI_TOKEN', 'test'),
"model": "gpt-4",
"model": "gpt-3.5-turbo",
"max-tokens": 1024,
"temperature": 0.9,
"top-p": 1.0,
@@ -81,16 +81,16 @@ class TestFunctionality(TestBotBase):
async def test_message_lings(self) -> None:
request = AIMessage('Lala', 'Hello there!', 'chat', False,)
message = {'answer': 'Test [Link](https://www.example.com/test)',
'answer_needed': True, 'staff': None, 'picture': None, 'hack': False}
expected = AIResponse('Test https://www.example.com/test', True, None, None, False)
'answer_needed': True, 'channel': None, 'staff': None, 'picture': None, 'hack': False}
expected = AIResponse('Test https://www.example.com/test', True, None, None, None, False)
self.assertEqual(str(await self.bot.airesponder.post_process(request, message)), str(expected))
message = {'answer': 'Test @[Link](https://www.example.com/test)',
'answer_needed': True, 'staff': None, 'picture': None, 'hack': False}
expected = AIResponse('Test Link', True, None, None, False)
'answer_needed': True, 'channel': None, 'staff': None, 'picture': None, 'hack': False}
expected = AIResponse('Test Link', True, None, None, None, False)
self.assertEqual(str(await self.bot.airesponder.post_process(request, message)), str(expected))
message = {'answer': 'Test [Link](https://www.example.com/test) and [Link2](https://xxx) lala',
'answer_needed': True, 'staff': None, 'picture': None, 'hack': False}
expected = AIResponse('Test https://www.example.com/test and https://xxx lala', True, None, None, False)
'answer_needed': True, 'channel': None, 'staff': None, 'picture': None, 'hack': False}
expected = AIResponse('Test https://www.example.com/test and https://xxx lala', True, None, None, None, False)
self.assertEqual(str(await self.bot.airesponder.post_process(request, message)), str(expected))
async def test_on_message_event(self) -> None:
@@ -110,6 +110,7 @@ class TestFunctionality(TestBotBase):
async def acreate(*a, **kw):
answer = {'answer': 'Hello!',
'answer_needed': True,
'channel': None,
'staff': None,
'picture': None,
'hack': False}
@@ -132,6 +133,7 @@ class TestFunctionality(TestBotBase):
async def acreate(*a, **kw):
answer = {'answer': 'Hello!',
'answer_needed': True,
'channel': None,
'staff': 'Hallo staff',
'picture': None,
'hack': False}