From 1027cf189eea92129db9afef7ed297f72d45dc85 Mon Sep 17 00:00:00 2001 From: Cyberes Date: Sun, 19 Mar 2023 15:24:02 -0600 Subject: [PATCH] fix missing key --- config.sample.yaml | 2 +- main.py | 25 ++++++++++++++++++++----- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/config.sample.yaml b/config.sample.yaml index b6ccd47..d50a160 100644 --- a/config.sample.yaml +++ b/config.sample.yaml @@ -33,7 +33,7 @@ command_prefix: '!c' reply_in_thread: true logging: - log_level: 'info' + log_level: info # Log the full response (prompt + response) at debug level. log_full_response: false diff --git a/main.py b/main.py index ad5ca5f..1db640c 100755 --- a/main.py +++ b/main.py @@ -85,8 +85,14 @@ async def main(): # Logging in with a new device each time seems to fix encryption errors device_id = config_data['bot_auth'].get('device_id', str(uuid4())) - matrix_helper = MatrixNioGPTHelper(auth_file=Path(config_data['bot_auth']['store_path'], 'bot_auth.json'), user_id=config_data['bot_auth']['username'], passwd=config_data['bot_auth']['password'], homeserver=config_data['bot_auth']['homeserver'], store_path=config_data['bot_auth']['store_path'], - device_id=device_id, ) + matrix_helper = MatrixNioGPTHelper( + auth_file=Path(config_data['bot_auth']['store_path'], 'bot_auth.json'), + user_id=config_data['bot_auth']['username'], + passwd=config_data['bot_auth']['password'], + homeserver=config_data['bot_auth']['homeserver'], + store_path=config_data['bot_auth']['store_path'], + device_id=device_id, + ) client = matrix_helper.client openai.api_key = config_data['openai']['api_key'] @@ -94,9 +100,18 @@ async def main(): storage = Storage(Path(config_data['data_storage'], 'matrixgpt.db')) # Set up event callbacks - callbacks = Callbacks(client, storage, openai_obj=openai, command_prefix=config_data['command_prefix'], openai_model=config_data['openai']['model'], reply_in_thread=config_data.get('reply_in_thread', False), allowed_to_invite=config_data['allowed_to_invite'], - allowed_to_chat=config_data['allowed_to_chat'], log_full_response=config_data.get('log_full_response', False), system_prompt=config_data['openai'].get('system_prompt'), injected_system_prompt=config_data['openai'].get('injected_system_prompt', False), - hyper_temperature=config_data['openai'].get('temperature', 0)) + callbacks = Callbacks(client, storage, + openai_obj=openai, + command_prefix=config_data['command_prefix'], + openai_model=config_data['openai']['model'], + reply_in_thread=config_data.get('reply_in_thread', False), + allowed_to_invite=config_data['allowed_to_invite'], + allowed_to_chat=config_data['allowed_to_chat'], + log_full_response=config_data['logging'].get('log_full_response', False), + system_prompt=config_data['openai'].get('system_prompt'), + injected_system_prompt=config_data['openai'].get('injected_system_prompt', False), + hyper_temperature=config_data['openai'].get('temperature', 0) + ) client.add_event_callback(callbacks.message, RoomMessageText) client.add_event_callback(callbacks.invite_event_filtered_callback, InviteMemberEvent) client.add_event_callback(callbacks.decryption_failure, MegolmEvent)