fix wiki placing it into command functions

This commit is contained in:
fram3d 2024-02-06 20:48:08 +01:00
parent 1795a87c4b
commit 544f8052e9
Signed by: fram3d
GPG Key ID: 938920E709EEA32A

View File

@ -4,8 +4,8 @@ import scraper_functions as sf
def processmsg(msg, rcpt): def processmsg(msg, rcpt):
if "youtube.com/watch" in msg: if "youtube.com/watch" in msg:
return msg.replace("youtube.com", "iv.datura.network") return msg.replace("youtube.com", "iv.datura.network")
elif msg.startswith("!wiki"): elif msg.startswith("!"):
return sf.query_external_website("https://en.wikipedia.org/wiki/", msg.split(" ")[1]) return command(msg)
elif "good bot" in msg: elif "good bot" in msg:
return "^_^" return "^_^"
@ -20,4 +20,6 @@ def command(msg, rcpt):
client = ollama.Client(host='https://ollama.krov.dmz.rs') client = ollama.Client(host='https://ollama.krov.dmz.rs')
response = client.chat(model='llama2-uncensored:latest', messages=[{'role':'user','content':f'{msg[4:]}'}]) response = client.chat(model='llama2-uncensored:latest', messages=[{'role':'user','content':f'{msg[4:]}'}])
return(response['message']['content']) return(response['message']['content'])
elif msg.startswith("!wiki"):
return sf.query_external_website("https://en.wikipedia.org/wiki/", msg.split(" ")[1])