faster logging
This commit is contained in:
parent
7bfc02ebbd
commit
9139edcb60
3
main.py
3
main.py
|
@ -110,7 +110,8 @@ async def main():
|
|||
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),
|
||||
openai_temperature=config_data['openai'].get('temperature', 0)
|
||||
openai_temperature=config_data['openai'].get('temperature', 0),
|
||||
log_level=log_level
|
||||
)
|
||||
client.add_event_callback(callbacks.message, RoomMessageText)
|
||||
client.add_event_callback(callbacks.invite_event_filtered_callback, InviteMemberEvent)
|
||||
|
|
|
@ -28,7 +28,8 @@ class Callbacks:
|
|||
system_prompt: str = None,
|
||||
log_full_response: bool = False,
|
||||
injected_system_prompt: str = False,
|
||||
openai_temperature: float = 0
|
||||
openai_temperature: float = 0,
|
||||
log_level=logging.INFO
|
||||
):
|
||||
"""
|
||||
Args:
|
||||
|
@ -52,6 +53,7 @@ class Callbacks:
|
|||
self.injected_system_prompt = injected_system_prompt
|
||||
self.openai_obj = openai_obj
|
||||
self.openai_temperature = openai_temperature
|
||||
self.log_level = log_level
|
||||
|
||||
async def message(self, room: MatrixRoom, event: RoomMessageText) -> None:
|
||||
"""Callback for when a message event is received
|
||||
|
@ -150,6 +152,8 @@ class Callbacks:
|
|||
)
|
||||
await command.process()
|
||||
else:
|
||||
if self.log_level == logging.DEBUG:
|
||||
# This may be a little slow
|
||||
debug = {
|
||||
'command_prefix': msg.startswith(f'{self.command_prefix} '),
|
||||
'is_dm': room.member_count == 2,
|
||||
|
|
Loading…
Reference in New Issue