diff --git a/.gitea/workflows/deploy_via_docker_compose.yml b/.gitea/workflows/deploy_via_docker_compose.yml new file mode 100644 index 0000000..dfa8058 --- /dev/null +++ b/.gitea/workflows/deploy_via_docker_compose.yml @@ -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 }}." + + diff --git a/README.md b/README.md index 86d8fa4..3ca968a 100644 --- a/README.md +++ b/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 + + + + + + + + + + + diff --git a/backend/Dockerfile b/backend/Dockerfile index 6ce6299..bd7d40c 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -1,5 +1,10 @@ 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 ollama run llama2 diff --git a/backend/app.py b/backend/app.py index c2ebd8c..1bfc9b8 100644 --- a/backend/app.py +++ b/backend/app.py @@ -64,6 +64,10 @@ from funcs import group_by from elastictools import get_by_id, update_by_id, delete_by_id from models import QueryLog, Chatbot, User +import pyttsx3 + +engine = pyttsx3.init() + #LLM_PAYLOAD = int(os.getenv("LLM_PAYLOAD")) @@ -335,6 +339,53 @@ def login(form: LoginRequest): #-----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): id: str = Field(None, description="The bot's id") diff --git a/backend/public/index.html b/backend/public/index.html index 9bef2c5..2cfa6fb 100644 --- a/backend/public/index.html +++ b/backend/public/index.html @@ -1,20 +1,27 @@ - Ollama Chatbot + Creative Bots - - - - - - + + + + + + + + + @@ -153,25 +160,7 @@
@ - - - - - - - - - - -
- -
@@ -233,6 +217,18 @@ + +
+ + + + + +
+ + + +
@@ -548,7 +544,7 @@ } 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); clean_bot_create_form(); diff --git a/backend/public/manifest.json b/backend/public/manifest.json new file mode 100644 index 0000000..913448a --- /dev/null +++ b/backend/public/manifest.json @@ -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" +} diff --git a/backend/requirements.txt b/backend/requirements.txt index b8a9020..cbeb33c 100644 --- a/backend/requirements.txt +++ b/backend/requirements.txt @@ -28,3 +28,11 @@ cryptography neo4j + +pyttsx3 + + + + + + diff --git a/backend/webbot.py b/backend/webbot.py index fd950a1..e0a3c11 100644 --- a/backend/webbot.py +++ b/backend/webbot.py @@ -8,7 +8,6 @@ from selenium.webdriver.support import expected_conditions as EC #from selenium.webdriver.chrome.options import Options - from webdriver_manager.firefox import GeckoDriverManager from selenium.webdriver.firefox.service import Service as FirefoxService @@ -108,10 +107,6 @@ class Bot: 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): """ 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 - - - - """ #ele.text #ele = browser.find_element_by_id("") @@ -149,8 +140,6 @@ ele.send_keys("test") ele.send_keys(Keys.RETURN) - - def getKeiserHeadlines(): url = "http://maxkeiser.com/" soup = BeautifulSoup(readUrl(url), "html.parser") @@ -185,7 +174,3 @@ def getWeltHeadLines(): return ls """ - - - -