refactor code

This commit is contained in:
Mathieu Broillet 2023-11-06 21:38:38 +01:00
parent 23c9f95fce
commit 0fcae7a20f
Signed by: mathieu
GPG Key ID: C0E9E0E95AF03319
8 changed files with 45 additions and 42 deletions

View File

@ -17,6 +17,7 @@ if __name__ == '__main__':
# Join the room # Join the room
sock.emit('join', json.dumps({'uuid': 'clientpc'})) sock.emit('join', json.dumps({'uuid': 'clientpc'}))
# Listen for messages from the server # Listen for messages from the server
@sock.on('message_from_assistant') @sock.on('message_from_assistant')
def on_message_from_jarvis(data): def on_message_from_jarvis(data):

2
run.py
View File

@ -1,8 +1,8 @@
import logging import logging
from src.audio import audio_utils from src.audio import audio_utils
from src.database import db_utils
from src.constants import TTSEngine, STTEngine from src.constants import TTSEngine, STTEngine
from src.database import db_utils
from src.network import api from src.network import api
# import lingua_franca # import lingua_franca

View File

@ -1,7 +1,8 @@
# Always prefer setuptools over distutils # Always prefer setuptools over distutils
from setuptools import setup, find_packages
import pathlib import pathlib
from setuptools import setup, find_packages
here = pathlib.Path(__file__).parent.resolve() here = pathlib.Path(__file__).parent.resolve()
# Get the long description from the README file # Get the long description from the README file

View File

@ -1,7 +1,6 @@
import logging import logging
import os.path import os.path
import sqlite3 import sqlite3
from pathlib import Path
from src.get_path_file import project_path from src.get_path_file import project_path

View File

@ -5,8 +5,8 @@ import openai
from flask import Flask, request from flask import Flask, request
from flask_socketio import SocketIO from flask_socketio import SocketIO
from src.network import endpoint_handler, socket_handler
from src.constants import Endpoints, Sockets from src.constants import Endpoints, Sockets
from src.network import endpoint_handler, socket_handler
# Set this variable to "threading", "eventlet" or "gevent" to test the # Set this variable to "threading", "eventlet" or "gevent" to test the
# different async modes, or leave it set to None for the application to choose # different async modes, or leave it set to None for the application to choose

View File

@ -1,6 +1,7 @@
--- Create a commands table that contains all the already executed commandes and the simplified version by ChatGPT --- Create a commands table that contains all the already executed commandes and the simplified version by ChatGPT
DROP TABLE IF EXISTS commands; DROP TABLE IF EXISTS commands;
CREATE TABLE commands ( CREATE TABLE commands
(
id INTEGER PRIMARY KEY, id INTEGER PRIMARY KEY,
original_command VARCHAR NOT NULL, original_command VARCHAR NOT NULL,
simplified_command VARCHAR NOT NULL, simplified_command VARCHAR NOT NULL,
@ -8,7 +9,8 @@ CREATE TABLE commands (
); );
DROP TABLE IF EXISTS responses; DROP TABLE IF EXISTS responses;
CREATE TABLE responses ( CREATE TABLE responses
(
id INTEGER PRIMARY KEY, id INTEGER PRIMARY KEY,
response VARCHAR NOT NULL response VARCHAR NOT NULL
); );