Compare commits

..

No commits in common. "834934fccd09dc27d5dfbe5aaa8ed3b029755fb2" and "e89201cb4bbef69aa1927ef69327fe6fa3444cba" have entirely different histories.

4 changed files with 4 additions and 15 deletions

1
.gitignore vendored
View File

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

View File

@ -1,4 +1,3 @@
import ollama
import scraper_functions as sf
def processmsg(msg, rcpt):
@ -9,12 +8,4 @@ def processmsg(msg, rcpt):
def command(msg, rcpt):
if msg.startswith("!help"):
response = "chatbot commands:" + "\n"
response += "!help Show this help page" + "\n"
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'])
return "chatbot commands: \n" + "!help Show this help page"

View File

@ -1,4 +1,3 @@
slixmpp
ollama
requests
beautifulsoup4

View File

@ -4,6 +4,6 @@ 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.find("span", class_="mw-page-title-main").text
content = soup.find(id="mw-content-text").select("p")[2].text
return "\nTITLE:\n" + title + "\n\nCONTENT:\n" + content + "\n\nFULL LINK:\n" + base_url + query
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