Cleanup unused imports. Fixes a few variables
This commit is contained in:
parent
8417442d0f
commit
e200393670
1 changed files with 4 additions and 6 deletions
|
@ -1,7 +1,6 @@
|
||||||
import markdown2
|
import markdown2
|
||||||
import duckdb
|
import duckdb
|
||||||
import tiktoken
|
import tiktoken
|
||||||
import magic
|
|
||||||
import asyncio
|
import asyncio
|
||||||
|
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
@ -27,12 +26,11 @@ from nio import (
|
||||||
RoomLeaveError,
|
RoomLeaveError,
|
||||||
RoomSendError,
|
RoomSendError,
|
||||||
RoomVisibility,
|
RoomVisibility,
|
||||||
RoomCreateResponse,
|
|
||||||
RoomCreateError,
|
RoomCreateError,
|
||||||
)
|
)
|
||||||
from nio.crypto import Olm
|
from nio.crypto import Olm
|
||||||
|
|
||||||
from typing import Optional, List, Dict, Tuple
|
from typing import Optional, List
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
|
@ -174,7 +172,7 @@ class GPTBot:
|
||||||
|
|
||||||
async def _last_n_messages(self, room: str | MatrixRoom, n: Optional[int]):
|
async def _last_n_messages(self, room: str | MatrixRoom, n: Optional[int]):
|
||||||
messages = []
|
messages = []
|
||||||
n = n or bot.max_messages
|
n = n or self.max_messages
|
||||||
room_id = room.room_id if isinstance(room, MatrixRoom) else room
|
room_id = room.room_id if isinstance(room, MatrixRoom) else room
|
||||||
|
|
||||||
self.logger.log(
|
self.logger.log(
|
||||||
|
@ -585,7 +583,7 @@ class GPTBot:
|
||||||
self.logger.log(
|
self.logger.log(
|
||||||
"No database connection set up, using in-memory database. Data will be lost on bot shutdown.")
|
"No database connection set up, using in-memory database. Data will be lost on bot shutdown.")
|
||||||
IN_MEMORY = True
|
IN_MEMORY = True
|
||||||
self.database = DuckDBPyConnection(":memory:")
|
self.database = duckdb.DuckDBPyConnection(":memory:")
|
||||||
|
|
||||||
self.logger.log("Running migrations...")
|
self.logger.log("Running migrations...")
|
||||||
before, after = migrate(self.database)
|
before, after = migrate(self.database)
|
||||||
|
@ -803,7 +801,7 @@ class GPTBot:
|
||||||
else:
|
else:
|
||||||
# Send a notice to the room if there was an error
|
# Send a notice to the room if there was an error
|
||||||
self.logger.log("Didn't get a response from GPT API", "error")
|
self.logger.log("Didn't get a response from GPT API", "error")
|
||||||
await send_message(
|
await self.send_message(
|
||||||
room, "Something went wrong. Please try again.", True)
|
room, "Something went wrong. Please try again.", True)
|
||||||
|
|
||||||
await self.matrix_client.room_typing(room.room_id, False)
|
await self.matrix_client.room_typing(room.room_id, False)
|
||||||
|
|
Loading…
Reference in a new issue