diff --git a/matrix_gpt/bot/chat_functions.py b/matrix_gpt/bot/chat_functions.py index a9458ae..965b9fa 100644 --- a/matrix_gpt/bot/chat_functions.py +++ b/matrix_gpt/bot/chat_functions.py @@ -191,8 +191,8 @@ async def process_chat( response = await task if response is not None: break - except stopit.utils.TimeoutException: - logger.warning(f'Timed out replying to event {event.event_id}, retrying...') + except Exception as e: # (stopit.utils.TimeoutException, openai.error.APIConnectionError) + logger.warning(f'Got exception when trying to reply to event {event.event_id}, retrying: {e}') await client.room_typing(room.room_id, typing_state=True, timeout=15000) time.sleep(2) continue @@ -225,6 +225,7 @@ async def process_chat( store.add_event_id(event.event_id) if not isinstance(resp, RoomSendResponse): logger.critical(f'Failed to respond to event {event.event_id} in room {room.room_id}:\n{vars(resp)}') + await react_to_event(client, room.room_id, event.event_id, '❌') else: store.add_event_id(resp.event_id)