more stuff
This commit is contained in:
parent
08812c6d94
commit
542548b902
18
.gitea/workflows/deploy_via_docker_compose.yml
Normal file
18
.gitea/workflows/deploy_via_docker_compose.yml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
name: Gitea Docker Redeploy
|
||||||
|
run-name: ${{ gitea.actor }} is deploying new version
|
||||||
|
on: [push]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
Explore-Gitea-Actions:
|
||||||
|
#runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- run: echo "🎉 The job was automatically triggered by a ${{ gitea.event_name }} event."
|
||||||
|
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!"
|
||||||
|
|
||||||
|
- name: List files in the repository
|
||||||
|
run: |
|
||||||
|
ls ~
|
||||||
|
|
||||||
|
- run: echo "🍏 This job's status is ${{ job.status }}."
|
||||||
|
|
||||||
|
|
15
README.md
15
README.md
@ -51,3 +51,18 @@ sudo docker rmi $(sudo docker images -f "dangling=true" -q)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Give just the translation of the given input to German and nothing else.
|
||||||
|
|
||||||
|
|
||||||
|
Give the JSON of a graph linking Germanys 9 biggest cities
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
FROM python:3.12
|
FROM python:3.12
|
||||||
RUN apt-get update && apt-get install -y firefox-esr
|
|
||||||
|
RUN apt-get update
|
||||||
|
RUN apt-get install -y firefox-esr
|
||||||
|
RUN apt-get install -y ffmpeg
|
||||||
|
RUN apt-get install -y espeak-ng
|
||||||
|
|
||||||
#RUN curl https://ollama.ai/install.sh | sh
|
#RUN curl https://ollama.ai/install.sh | sh
|
||||||
#RUN ollama run llama2
|
#RUN ollama run llama2
|
||||||
|
|
||||||
|
@ -64,6 +64,10 @@ from funcs import group_by
|
|||||||
from elastictools import get_by_id, update_by_id, delete_by_id
|
from elastictools import get_by_id, update_by_id, delete_by_id
|
||||||
from models import QueryLog, Chatbot, User
|
from models import QueryLog, Chatbot, User
|
||||||
|
|
||||||
|
import pyttsx3
|
||||||
|
|
||||||
|
engine = pyttsx3.init()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#LLM_PAYLOAD = int(os.getenv("LLM_PAYLOAD"))
|
#LLM_PAYLOAD = int(os.getenv("LLM_PAYLOAD"))
|
||||||
@ -335,6 +339,53 @@ def login(form: LoginRequest):
|
|||||||
|
|
||||||
#-----bot routes------
|
#-----bot routes------
|
||||||
|
|
||||||
|
|
||||||
|
class GetSpeechRequest(BaseModel):
|
||||||
|
text: str = Field(None, description="Some text to convert to mp3")
|
||||||
|
|
||||||
|
|
||||||
|
@app.post('/text2speech', summary="", tags=[], security=security)
|
||||||
|
@uses_jwt()
|
||||||
|
def text2speech(form: GetSpeechRequest, decoded_jwt, user):
|
||||||
|
|
||||||
|
#def get_voice(s):
|
||||||
|
# for v in engine.getProperty("voices"):
|
||||||
|
# if s == v.id:
|
||||||
|
# return v
|
||||||
|
|
||||||
|
#def set_voice(v):
|
||||||
|
# engine.setProperty("voice", v.id)
|
||||||
|
|
||||||
|
#def set_volume(n):
|
||||||
|
# engine.setProperty('volume', engine.getProperty('volume') + n)
|
||||||
|
|
||||||
|
#def set_rate(n):
|
||||||
|
# engine.setProperty('rate', engine.getProperty('rate') + n)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#voices = engine.getProperty('voices')
|
||||||
|
#engine.setProperty('voice', voices[1].id)
|
||||||
|
#set_voice(get_voice("english"))
|
||||||
|
#set_volume(-5.0)
|
||||||
|
#set_rate(-40)
|
||||||
|
|
||||||
|
# Speak the response
|
||||||
|
#engine.say(response)
|
||||||
|
#ngine.say("Hello World!")
|
||||||
|
#engine.say("Neuroscience!")
|
||||||
|
|
||||||
|
|
||||||
|
file_name = 'speech.mp3'
|
||||||
|
engine.save_to_file(form.text, file_name)
|
||||||
|
engine.runAndWait()
|
||||||
|
return send_file(file_name) #, mimetype = 'zip', attachment_filename= 'Audiofiles.zip', as_attachment = True)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class GetBotRequest(BaseModel):
|
class GetBotRequest(BaseModel):
|
||||||
id: str = Field(None, description="The bot's id")
|
id: str = Field(None, description="The bot's id")
|
||||||
|
|
||||||
|
@ -1,20 +1,27 @@
|
|||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Ollama Chatbot</title>
|
<title>Creative Bots</title>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<link rel="icon" href="favicon.svg">
|
<link rel="icon" href="favicon.svg">
|
||||||
|
|
||||||
|
|
||||||
<script src="viz.js"></script>
|
|
||||||
<script src="viz_widget.js"></script>
|
|
||||||
<script src="tabs.js"></script>
|
|
||||||
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!--
|
||||||
|
<script src="tabs.js"></script>
|
||||||
|
-->
|
||||||
|
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css">
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css">
|
||||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.min.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
<!--
|
||||||
|
load the following async:?
|
||||||
|
-->
|
||||||
|
<script src="viz.js"></script>
|
||||||
|
<script src="viz_widget.js"></script>
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.0.1/socket.io.js" integrity="sha512-q/dWJ3kcmjBLU4Qc47E4A9kTB4m3wuTY7vkFJDTZKjTs8jhyGQnaUrxa0Ytd0ssMZhbNua9hE+E7Qv1j+DyZwA==" crossorigin="anonymous"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.0.1/socket.io.js" integrity="sha512-q/dWJ3kcmjBLU4Qc47E4A9kTB4m3wuTY7vkFJDTZKjTs8jhyGQnaUrxa0Ytd0ssMZhbNua9hE+E7Qv1j+DyZwA==" crossorigin="anonymous"></script>
|
||||||
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
|
||||||
@ -153,25 +160,7 @@
|
|||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<span class="input-group-text">@
|
<span class="input-group-text">@
|
||||||
<select name="bots" id="bot_select" class="form-select"></select>
|
<select name="bots" id="bot_select" class="form-select"></select>
|
||||||
|
|
||||||
<!--
|
|
||||||
<input size="8" class="form-control" list="bot_select" name="bots" placeholder="bot">
|
|
||||||
<datalist id="bot_select">
|
|
||||||
|
|
||||||
<option value="Superman">
|
|
||||||
|
|
||||||
|
|
||||||
</datalist>
|
|
||||||
-->
|
|
||||||
|
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!--
|
|
||||||
<input id="user_input" type="text" class="form-control" placeholder="What is...">
|
|
||||||
-->
|
|
||||||
|
|
||||||
<input class="form-control" list="questions" name="question" id="user_input" placeholder="What is...">
|
<input class="form-control" list="questions" name="question" id="user_input" placeholder="What is...">
|
||||||
<datalist id="questions">
|
<datalist id="questions">
|
||||||
<option value="Write all the ministries of Germany and their suborganizations in dot lang and return the source code!">
|
<option value="Write all the ministries of Germany and their suborganizations in dot lang and return the source code!">
|
||||||
@ -179,19 +168,14 @@
|
|||||||
<option value="Is a monad a burito?">
|
<option value="Is a monad a burito?">
|
||||||
<option value="Give the JSON of a graph linking Germanys 9 biggest cities">
|
<option value="Give the JSON of a graph linking Germanys 9 biggest cities">
|
||||||
</datalist>
|
</datalist>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<button id="submit_btn" class="btn btn-success" type="submit">Send</button>
|
<button id="submit_btn" class="btn btn-success" type="submit">Send</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<!-- Button to open the offcanvas sidebar -->
|
<!-- Button to open the offcanvas sidebar -->
|
||||||
<button class="btn btn-light" type="button" data-bs-toggle="offcanvas" data-bs-target="#demo">
|
<button class="btn btn-light" type="button" data-bs-toggle="offcanvas" data-bs-target="#demo">
|
||||||
Settings...
|
Settings...
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="tab-pane container fade" id="create_bot_tab">
|
<div class="tab-pane container fade" id="create_bot_tab">
|
||||||
|
|
||||||
@ -233,6 +217,18 @@
|
|||||||
<label for="bot_system_prompt">System prompt:</label>
|
<label for="bot_system_prompt">System prompt:</label>
|
||||||
<textarea id="bot_system_prompt" class="form-control" rows="8" name="text" placeholder="Answer all questions short and sweet!"></textarea>
|
<textarea id="bot_system_prompt" class="form-control" rows="8" name="text" placeholder="Answer all questions short and sweet!"></textarea>
|
||||||
|
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<label for="avatar">Text documents:</label>
|
||||||
|
<input disabled class="form-control" type="file" id="avatar" name="avatar" multiple accept=".pdf,.xml,.txt,.md,.doc,.docx,.odt,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document" />
|
||||||
|
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<label for="url">Links:</label>
|
||||||
|
<input disabled class="form-control" type="url" name="url" id="url" placeholder="https://example.com" pattern="https://.*" size="30" required />
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@ -548,7 +544,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
try{
|
try{
|
||||||
await create_bot(jwt, name, visibility, description, llm, sys_prompt);
|
let {bot_id} = await create_bot(jwt, name, visibility, description, llm, sys_prompt);
|
||||||
alert_bot_creation(true);
|
alert_bot_creation(true);
|
||||||
clean_bot_create_form();
|
clean_bot_create_form();
|
||||||
|
|
||||||
|
13
backend/public/manifest.json
Normal file
13
backend/public/manifest.json
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"name": "Creative Bots",
|
||||||
|
"short_name": "Creative Bots",
|
||||||
|
"icons": [{
|
||||||
|
"src": "favicon.svg",
|
||||||
|
"sizes": "48x48 72x72 96x96 128x128 256x256 512x512",
|
||||||
|
"type": "image/svg+xml",
|
||||||
|
"purpose": "any"
|
||||||
|
}],
|
||||||
|
"background_color": "#2D7CAC",
|
||||||
|
"theme_color": "#2D7CAC",
|
||||||
|
"display": "fullscreen"
|
||||||
|
}
|
@ -28,3 +28,11 @@ cryptography
|
|||||||
|
|
||||||
neo4j
|
neo4j
|
||||||
|
|
||||||
|
|
||||||
|
pyttsx3
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -8,7 +8,6 @@ from selenium.webdriver.support import expected_conditions as EC
|
|||||||
|
|
||||||
#from selenium.webdriver.chrome.options import Options
|
#from selenium.webdriver.chrome.options import Options
|
||||||
|
|
||||||
|
|
||||||
from webdriver_manager.firefox import GeckoDriverManager
|
from webdriver_manager.firefox import GeckoDriverManager
|
||||||
from selenium.webdriver.firefox.service import Service as FirefoxService
|
from selenium.webdriver.firefox.service import Service as FirefoxService
|
||||||
|
|
||||||
@ -108,10 +107,6 @@ class Bot:
|
|||||||
self.__browser.execute_script(f"window.scrollBy(0,{d})")
|
self.__browser.execute_script(f"window.scrollBy(0,{d})")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def collect_pagination_items(bot, start_url, next_page, get_nr_pages, get_items, kill_cookie_questions=lambda: None):
|
def collect_pagination_items(bot, start_url, next_page, get_nr_pages, get_items, kill_cookie_questions=lambda: None):
|
||||||
"""
|
"""
|
||||||
Collect all the content of a pagination
|
Collect all the content of a pagination
|
||||||
@ -132,10 +127,6 @@ def collect_pagination_items(bot, start_url, next_page, get_nr_pages, get_items,
|
|||||||
|
|
||||||
return results
|
return results
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
#ele.text
|
#ele.text
|
||||||
#ele = browser.find_element_by_id("")
|
#ele = browser.find_element_by_id("")
|
||||||
@ -149,8 +140,6 @@ ele.send_keys("test")
|
|||||||
ele.send_keys(Keys.RETURN)
|
ele.send_keys(Keys.RETURN)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def getKeiserHeadlines():
|
def getKeiserHeadlines():
|
||||||
url = "http://maxkeiser.com/"
|
url = "http://maxkeiser.com/"
|
||||||
soup = BeautifulSoup(readUrl(url), "html.parser")
|
soup = BeautifulSoup(readUrl(url), "html.parser")
|
||||||
@ -185,7 +174,3 @@ def getWeltHeadLines():
|
|||||||
return ls
|
return ls
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user