fix invalid cross-device link
This commit is contained in:
parent
70d8a8aa0c
commit
953d521a37
2 changed files with 11 additions and 11 deletions
19
bot.py
19
bot.py
|
@ -10,7 +10,7 @@ from nio import (AsyncClient, AsyncClientConfig, InviteMemberEvent, JoinError,
|
||||||
KeyVerificationCancel, KeyVerificationEvent, DownloadError,
|
KeyVerificationCancel, KeyVerificationEvent, DownloadError,
|
||||||
KeyVerificationKey, KeyVerificationMac, KeyVerificationStart,
|
KeyVerificationKey, KeyVerificationMac, KeyVerificationStart,
|
||||||
LocalProtocolError, LoginResponse, MatrixRoom, MegolmEvent,
|
LocalProtocolError, LoginResponse, MatrixRoom, MegolmEvent,
|
||||||
RoomMessageAudio, RoomEncryptedAudio, ToDeviceError, crypto,
|
RoomMessageAudio, RoomEncryptedAudio, ToDeviceError, crypto,
|
||||||
EncryptionError)
|
EncryptionError)
|
||||||
from nio.store.database import SqliteStore
|
from nio.store.database import SqliteStore
|
||||||
|
|
||||||
|
@ -19,8 +19,6 @@ from faster_whisper import WhisperModel
|
||||||
from log import getlogger
|
from log import getlogger
|
||||||
from send_message import send_room_message
|
from send_message import send_room_message
|
||||||
|
|
||||||
from unsync import unsync
|
|
||||||
|
|
||||||
logger = getlogger()
|
logger = getlogger()
|
||||||
|
|
||||||
|
|
||||||
|
@ -82,9 +80,10 @@ class Bot:
|
||||||
self.num_workers = 1
|
self.num_workers = 1
|
||||||
|
|
||||||
if download_root is None:
|
if download_root is None:
|
||||||
self.download_root = "models"
|
cwd = os.getcwd()
|
||||||
if not os.path.exists("models"):
|
self.download_root = os.path.join(cwd, "models")
|
||||||
os.mkdir("models")
|
if not os.path.exists(self.download_root):
|
||||||
|
os.mkdir(self.download_root)
|
||||||
|
|
||||||
# initialize AsyncClient object
|
# initialize AsyncClient object
|
||||||
self.store_path = os.getcwd()
|
self.store_path = os.getcwd()
|
||||||
|
@ -112,10 +111,11 @@ class Bot:
|
||||||
# intialize whisper model
|
# intialize whisper model
|
||||||
if not os.path.exists(os.path.join(self.download_root, "model.txt")):
|
if not os.path.exists(os.path.join(self.download_root, "model.txt")):
|
||||||
# that means we have not downloaded the model yet
|
# that means we have not downloaded the model yet
|
||||||
logger.info("Model downloading")
|
logger.info("Model downloading......")
|
||||||
self.model_size_or_path = self.model_size
|
self.model_size_or_path = self.model_size
|
||||||
with open(os.path.join(self.download_root, "model.txt"), "w") as f:
|
with open(os.path.join(self.download_root, "model.txt"), "w") as f:
|
||||||
f.write(self.model_size)
|
f.write(self.model_size)
|
||||||
|
f.close()
|
||||||
else:
|
else:
|
||||||
# model exists
|
# model exists
|
||||||
f = open(os.path.join(self.download_root, "model.txt"), "r")
|
f = open(os.path.join(self.download_root, "model.txt"), "r")
|
||||||
|
@ -508,7 +508,8 @@ class Bot:
|
||||||
if isinstance(resp, EncryptionError):
|
if isinstance(resp, EncryptionError):
|
||||||
logger.error(f"import_keys failed with {resp}")
|
logger.error(f"import_keys failed with {resp}")
|
||||||
else:
|
else:
|
||||||
logger.info(f"import_keys success, please remove import_keys configuration!!!")
|
logger.info(
|
||||||
|
f"import_keys success, please remove import_keys configuration!!!")
|
||||||
|
|
||||||
# whisper function
|
# whisper function
|
||||||
def transcribe(self, filename: str) -> str:
|
def transcribe(self, filename: str) -> str:
|
||||||
|
@ -571,7 +572,7 @@ async def main():
|
||||||
if need_import_keys:
|
if need_import_keys:
|
||||||
logger.info("start import_keys process, this may take a while...")
|
logger.info("start import_keys process, this may take a while...")
|
||||||
await bot.import_keys()
|
await bot.import_keys()
|
||||||
|
|
||||||
await bot.sync_forever()
|
await bot.sync_forever()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
@ -20,7 +20,7 @@ future==0.18.3
|
||||||
h11==0.14.0
|
h11==0.14.0
|
||||||
h2==4.1.0
|
h2==4.1.0
|
||||||
hpack==4.0.0
|
hpack==4.0.0
|
||||||
huggingface-hub==0.13.4
|
huggingface-hub @ git+https://github.com/huggingface/huggingface_hub.git@a433410ac37f0efaacb92b09684efa3ae46ed3fd
|
||||||
humanfriendly==10.0
|
humanfriendly==10.0
|
||||||
hyperframe==6.0.1
|
hyperframe==6.0.1
|
||||||
idna==3.4
|
idna==3.4
|
||||||
|
@ -46,6 +46,5 @@ tokenizers==0.13.3
|
||||||
tqdm==4.65.0
|
tqdm==4.65.0
|
||||||
typing_extensions==4.5.0
|
typing_extensions==4.5.0
|
||||||
unpaddedbase64==2.1.0
|
unpaddedbase64==2.1.0
|
||||||
unsync==1.4.0
|
|
||||||
urllib3==1.26.15
|
urllib3==1.26.15
|
||||||
yarl==1.8.2
|
yarl==1.8.2
|
||||||
|
|
Loading…
Reference in a new issue