Resolvedconflicts
This commit is contained in:
commit
70b2c9e322
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
|||||||
config.ini
|
config.ini
|
||||||
|
venv/
|
||||||
__pycache__
|
__pycache__
|
||||||
|
12
functions.py
12
functions.py
@ -1,4 +1,4 @@
|
|||||||
import scraper_functions as sf
|
import ollama
|
||||||
|
|
||||||
def processmsg(msg, rcpt):
|
def processmsg(msg, rcpt):
|
||||||
if "youtube.com/watch" in msg:
|
if "youtube.com/watch" in msg:
|
||||||
@ -8,4 +8,12 @@ def processmsg(msg, rcpt):
|
|||||||
|
|
||||||
def command(msg, rcpt):
|
def command(msg, rcpt):
|
||||||
if msg.startswith("!help"):
|
if msg.startswith("!help"):
|
||||||
return "chatbot commands: \n" + "!help Show this help page"
|
response = "chatbot commands: \n"
|
||||||
|
response += "!help Show this help page"
|
||||||
|
response += "!ai [message] Ask llama2"
|
||||||
|
return response
|
||||||
|
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'])
|
||||||
|
|
||||||
|
@ -1,3 +1,2 @@
|
|||||||
slixmpp
|
slixmpp
|
||||||
requests
|
ollama
|
||||||
beautifulsoup4
|
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
import requests
|
|
||||||
from bs4 import BeautifulSoup
|
|
||||||
|
|
||||||
def query_external_website(base_url, query):
|
|
||||||
page = requests.get(base_url + query)
|
|
||||||
soup = BeautifulSoup(page.content, "html.parser")
|
|
||||||
title = soup.select(".mw-page-title-main")[0]
|
|
||||||
content = soup.find(id="bodyContent").select("p")[2].text
|
|
||||||
return "\nTITLE: " + title.text + "\n\n" + "CONTENT:" + "\n" + content + "\n\n" + "FULL LINK:\n" + base_url + query
|
|
Loading…
Reference in New Issue
Block a user