fix missing key

This commit is contained in:
Cyberes 2023-03-19 15:24:02 -06:00
parent fe4cb78e8a
commit 1027cf189e
2 changed files with 21 additions and 6 deletions

View File

@ -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

25
main.py
View File

@ -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)