From 3947fa222b6a5dfe4641a9d91be02e7f1083eca3 Mon Sep 17 00:00:00 2001 From: Dustin Date: Thu, 21 Dec 2023 22:17:12 -0500 Subject: [PATCH 1/5] added some models --- models.md | 4 ++++ ollamarama.py | 2 ++ 2 files changed, 6 insertions(+) diff --git a/models.md b/models.md index 6d3df89..12cea42 100644 --- a/models.md +++ b/models.md @@ -33,3 +33,7 @@ ollama pull stablelm-zephyr ollama pull neural-chat ollama pull mistral-openorca + +ollama pull deepseek-llm:7b-chat + +ollama pull wizard-vicuna-uncensored \ No newline at end of file diff --git a/ollamarama.py b/ollamarama.py index de624cc..38b8258 100644 --- a/ollamarama.py +++ b/ollamarama.py @@ -49,6 +49,8 @@ class ollamarama: 'stablelm-zephyr': 'ollama/stablelm-zephyr', 'neural-chat': 'ollama/neural-chat', 'mistral-openorca': 'ollama/mistral-openorca', + 'deepseek-llm': 'ollama/deepseek-llm:7b-chat', + 'wizard-vicuna-uncensored': 'ollama/wizard-vicuna-uncensored' } #set model From a4f7eb5279dcdbd413c7b1c2ca3e05b78a125c0f Mon Sep 17 00:00:00 2001 From: Dustin Date: Fri, 22 Dec 2023 16:19:40 -0500 Subject: [PATCH 2/5] various updates --- ollamarama.py | 61 ++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 51 insertions(+), 10 deletions(-) diff --git a/ollamarama.py b/ollamarama.py index 38b8258..5677c09 100644 --- a/ollamarama.py +++ b/ollamarama.py @@ -16,6 +16,7 @@ class ollamarama: self.username = username self.password = password self.channels = channels + self.default_personality = personality self.personality = personality self.client = AsyncClient(server, username) @@ -139,7 +140,7 @@ class ollamarama: except Exception as e: print(e) #Shrink history list for token size management - if len(self.messages[channel][sender]) > 30: + if len(self.messages[channel][sender]) > 24: del self.messages[channel][sender][1:3] #delete the first set of question and answers # change the personality of the bot @@ -217,18 +218,32 @@ Available models: {', '.join(sorted(list(self.models)))}''') nick = message.split(" ", 1)[1].strip() if nick != None: self.admins.remove(nick) - await self.send_message(room_id, f"{nick} removed from admins") + await self.send_message(room_id, f"{nick} removed from admins") + #set new global personality + if message.startswith(".gpersona "): + m = message.split(" ", 1)[1] + if m != None: + if m == 'reset': + self.personality = self.default_personality + else: + self.personality = m.strip() + await self.send_message(room_id, f"Global personality set to {self.personality}") + + #remove personality globally + if message == ".gstock": + pass #i'll figure this out later # main AI response functionality if message.startswith(".ai ") or message.startswith(self.bot_id): - m = message.split(" ", 1) - try: - m = m[1] + " [your response must be one paragraph or less]" - await self.add_history("user", room_id, sender, m) - await self.respond(room_id, sender, self.messages[room_id][sender]) - except: - pass + if message != ".ai reset": + m = message.split(" ", 1) + try: + m = m[1] + " [your response must be one paragraph or less]" + await self.add_history("user", room_id, sender, m) + await self.respond(room_id, sender, self.messages[room_id][sender]) + except: + pass # collaborative functionality if message.startswith(".x "): m = message.split(" ", 2) @@ -265,7 +280,7 @@ Available models: {', '.join(sorted(list(self.models)))}''') await self.respond(room_id, sender, self.messages[room_id][sender]) # reset bot to default personality - if message.startswith(".reset"): + if message.startswith(".reset") or message == ".ai reset": #some users keep forgetting the correct command if room_id in self.messages: if sender in self.messages[room_id]: self.messages[room_id][sender].clear() @@ -313,8 +328,34 @@ f'''{self.bot_id}, an AI chatbot. .stock Remove personality and reset to standard model settings + + +Available at https://github.com/h1ddenpr0cess20/ollamarama-matrix ''') + if sender_display in self.admins: + await self.send_message(room_id, '''Admin commands: + +.admins + List of users authorized to use these commands + +.models + List available models + +.model + Change the model + +.gpersona + Change default global personality (bot owner only) + +.auth + Add an admin (bot owner only) + +.deauth + Remove an admin (bot owner only) + +''') + # main loop async def main(self): From f36c243d68210e3466df7e26801f66848d090808 Mon Sep 17 00:00:00 2001 From: Dustin Date: Fri, 22 Dec 2023 16:23:14 -0500 Subject: [PATCH 3/5] update readme --- README.md | 8 +++++++- ollamarama.py | 5 ++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f54f960..1a7bc8c 100644 --- a/README.md +++ b/README.md @@ -73,4 +73,10 @@ python3 launcher.py Add user to admins (main admin only) **.deauth _user_** - Remove user from admins (main admin only) \ No newline at end of file + Remove user from admins (main admin only) + +**.gpersona _persona_*** + Change global personality + +**.gpersona reset** + Reset global personality \ No newline at end of file diff --git a/ollamarama.py b/ollamarama.py index 5677c09..b076f24 100644 --- a/ollamarama.py +++ b/ollamarama.py @@ -345,9 +345,12 @@ Available at https://github.com/h1ddenpr0cess20/ollamarama-matrix .model Change the model -.gpersona +.gpersona Change default global personality (bot owner only) +.gpersona reset + Reset global personality + .auth Add an admin (bot owner only) From 237927eda9c988c14ebf4f3f7901bbac59e78d3e Mon Sep 17 00:00:00 2001 From: Dustin Date: Fri, 22 Dec 2023 16:26:50 -0500 Subject: [PATCH 4/5] bug fix --- ollamarama.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ollamarama.py b/ollamarama.py index b076f24..b150009 100644 --- a/ollamarama.py +++ b/ollamarama.py @@ -333,8 +333,8 @@ f'''{self.bot_id}, an AI chatbot. Available at https://github.com/h1ddenpr0cess20/ollamarama-matrix ''') - if sender_display in self.admins: - await self.send_message(room_id, '''Admin commands: + if sender_display in self.admins: + await self.send_message(room_id, '''Admin commands: .admins List of users authorized to use these commands From 40e571f4c9d973d7a819fe7fcdd54fc635b19e9b Mon Sep 17 00:00:00 2001 From: Dustin Date: Fri, 22 Dec 2023 16:31:37 -0500 Subject: [PATCH 5/5] update readme --- README.md | 8 ++++---- ollamarama.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 1a7bc8c..079bd58 100644 --- a/README.md +++ b/README.md @@ -70,13 +70,13 @@ python3 launcher.py Resets all bot history and sets default model (admin only) **.auth _user_** - Add user to admins (main admin only) + Add user to admins (bot owner only) **.deauth _user_** - Remove user from admins (main admin only) + Remove user from admins (bot owner only) **.gpersona _persona_*** - Change global personality + Change global personality (bot owner only) **.gpersona reset** - Reset global personality \ No newline at end of file + Reset global personality (bot owner only) \ No newline at end of file diff --git a/ollamarama.py b/ollamarama.py index b150009..d9d6651 100644 --- a/ollamarama.py +++ b/ollamarama.py @@ -349,7 +349,7 @@ Available at https://github.com/h1ddenpr0cess20/ollamarama-matrix Change default global personality (bot owner only) .gpersona reset - Reset global personality + Reset global personality (bot owner only) .auth Add an admin (bot owner only)