commit
19dfd7cb39
10
README.md
10
README.md
@ -70,7 +70,13 @@ python3 launcher.py
|
|||||||
Resets all bot history and sets default model (admin only)
|
Resets all bot history and sets default model (admin only)
|
||||||
|
|
||||||
**.auth _user_**
|
**.auth _user_**
|
||||||
Add user to admins (main admin only)
|
Add user to admins (bot owner only)
|
||||||
|
|
||||||
**.deauth _user_**
|
**.deauth _user_**
|
||||||
Remove user from admins (main admin only)
|
Remove user from admins (bot owner only)
|
||||||
|
|
||||||
|
**.gpersona _persona_***
|
||||||
|
Change global personality (bot owner only)
|
||||||
|
|
||||||
|
**.gpersona reset**
|
||||||
|
Reset global personality (bot owner only)
|
@ -33,3 +33,7 @@ ollama pull stablelm-zephyr
|
|||||||
ollama pull neural-chat
|
ollama pull neural-chat
|
||||||
|
|
||||||
ollama pull mistral-openorca
|
ollama pull mistral-openorca
|
||||||
|
|
||||||
|
ollama pull deepseek-llm:7b-chat
|
||||||
|
|
||||||
|
ollama pull wizard-vicuna-uncensored
|
@ -16,6 +16,7 @@ class ollamarama:
|
|||||||
self.username = username
|
self.username = username
|
||||||
self.password = password
|
self.password = password
|
||||||
self.channels = channels
|
self.channels = channels
|
||||||
|
self.default_personality = personality
|
||||||
self.personality = personality
|
self.personality = personality
|
||||||
|
|
||||||
self.client = AsyncClient(server, username)
|
self.client = AsyncClient(server, username)
|
||||||
@ -49,6 +50,8 @@ class ollamarama:
|
|||||||
'stablelm-zephyr': 'ollama/stablelm-zephyr',
|
'stablelm-zephyr': 'ollama/stablelm-zephyr',
|
||||||
'neural-chat': 'ollama/neural-chat',
|
'neural-chat': 'ollama/neural-chat',
|
||||||
'mistral-openorca': 'ollama/mistral-openorca',
|
'mistral-openorca': 'ollama/mistral-openorca',
|
||||||
|
'deepseek-llm': 'ollama/deepseek-llm:7b-chat',
|
||||||
|
'wizard-vicuna-uncensored': 'ollama/wizard-vicuna-uncensored'
|
||||||
|
|
||||||
}
|
}
|
||||||
#set model
|
#set model
|
||||||
@ -137,7 +140,7 @@ class ollamarama:
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
#Shrink history list for token size management
|
#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
|
del self.messages[channel][sender][1:3] #delete the first set of question and answers
|
||||||
|
|
||||||
# change the personality of the bot
|
# change the personality of the bot
|
||||||
@ -215,18 +218,32 @@ Available models: {', '.join(sorted(list(self.models)))}''')
|
|||||||
nick = message.split(" ", 1)[1].strip()
|
nick = message.split(" ", 1)[1].strip()
|
||||||
if nick != None:
|
if nick != None:
|
||||||
self.admins.remove(nick)
|
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
|
# main AI response functionality
|
||||||
if message.startswith(".ai ") or message.startswith(self.bot_id):
|
if message.startswith(".ai ") or message.startswith(self.bot_id):
|
||||||
m = message.split(" ", 1)
|
if message != ".ai reset":
|
||||||
try:
|
m = message.split(" ", 1)
|
||||||
m = m[1] + " [your response must be one paragraph or less]"
|
try:
|
||||||
await self.add_history("user", room_id, sender, m)
|
m = m[1] + " [your response must be one paragraph or less]"
|
||||||
await self.respond(room_id, sender, self.messages[room_id][sender])
|
await self.add_history("user", room_id, sender, m)
|
||||||
except:
|
await self.respond(room_id, sender, self.messages[room_id][sender])
|
||||||
pass
|
except:
|
||||||
|
pass
|
||||||
# collaborative functionality
|
# collaborative functionality
|
||||||
if message.startswith(".x "):
|
if message.startswith(".x "):
|
||||||
m = message.split(" ", 2)
|
m = message.split(" ", 2)
|
||||||
@ -263,7 +280,7 @@ Available models: {', '.join(sorted(list(self.models)))}''')
|
|||||||
await self.respond(room_id, sender, self.messages[room_id][sender])
|
await self.respond(room_id, sender, self.messages[room_id][sender])
|
||||||
|
|
||||||
# reset bot to default personality
|
# 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 room_id in self.messages:
|
||||||
if sender in self.messages[room_id]:
|
if sender in self.messages[room_id]:
|
||||||
self.messages[room_id][sender].clear()
|
self.messages[room_id][sender].clear()
|
||||||
@ -311,8 +328,37 @@ f'''{self.bot_id}, an AI chatbot.
|
|||||||
|
|
||||||
.stock
|
.stock
|
||||||
Remove personality and reset to standard model settings
|
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 <model>
|
||||||
|
Change the model
|
||||||
|
|
||||||
|
.gpersona <personality>
|
||||||
|
Change default global personality (bot owner only)
|
||||||
|
|
||||||
|
.gpersona reset
|
||||||
|
Reset global personality (bot owner only)
|
||||||
|
|
||||||
|
.auth
|
||||||
|
Add an admin (bot owner only)
|
||||||
|
|
||||||
|
.deauth
|
||||||
|
Remove an admin (bot owner only)
|
||||||
|
|
||||||
|
''')
|
||||||
|
|
||||||
|
|
||||||
# main loop
|
# main loop
|
||||||
async def main(self):
|
async def main(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user