From ac60dd23700889fbd2a3fe67fb57c913eaada1b4 Mon Sep 17 00:00:00 2001 From: Dustin Date: Tue, 14 May 2024 13:34:57 -0400 Subject: [PATCH] improved model switching --- ollamarama.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ollamarama.py b/ollamarama.py index 298e47f..f1b8cea 100644 --- a/ollamarama.py +++ b/ollamarama.py @@ -14,7 +14,8 @@ import asyncio class ollamarama: def __init__(self): #load config file - with open("config.json", "r") as f: + self.config_file = "config.json" + with open(self.config_file, "r") as f: config = json.load(f) f.close() @@ -171,7 +172,11 @@ class ollamarama: if sender_display in self.admins: #model switching if message.startswith(".model"): - if message == ".models": + with open(self.config_file, "r") as f: + config = json.load(f) + f.close() + self.models = config[0]['models'] + if message == ".models": current_model = f"Current model: {self.model.removeprefix('ollama/')}\nAvailable models: {', '.join(sorted(list(self.models)))}" await self.send_message(room_id, current_model)