add ollama command

This commit is contained in:
fram3d 2024-02-06 02:00:41 +01:00
parent a8b9850be5
commit c2286ae0a6
Signed by: fram3d
GPG Key ID: 938920E709EEA32A
3 changed files with 9 additions and 0 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
config.ini
venv/
__pycache__

View File

@ -1,3 +1,5 @@
import ollama
def processmsg(msg, rcpt):
if msg.startswith("!"):
return command(msg, rcpt)
@ -7,3 +9,8 @@ def processmsg(msg, rcpt):
def command(msg, rcpt):
if msg.startswith("!help"):
return "chatbot commands: \n" + "!help Show this help page"
elif msg.startswith("!ai"):
client = ollama.Client(host='https://ollama.krov.dmz.rs')
response = client.chat(model='llama2-uncensored:latest', messages=[{'role':'user','content':f'{msg[4:]}'}])
return(response['message']['content'])

View File

@ -1 +1,2 @@
slixmpp
ollama