OOPified. #9

Merged
YasinOnm08 merged 1 commit from React-Group/ai-virtual-assistant:main into main 2024-09-16 13:45:36 +02:00
2 changed files with 30 additions and 24 deletions

View file

@ -1,20 +1,24 @@
from api import API from api import API
class CLIChat:
@staticmethod
def chat():
chat1 = API() chat1 = API()
while True: while True:
print("") print("")
print("Which AI Model do you want to use? Write as a Number (1-5)") print("Which AI Model do you want to use? Write as a Number (1-5).")
model_input = input() model_input = input()
model = int(model_input) model = int(model_input)
if model <= 0 or model > 5: if model <= 0 or model > 5:
print("ungültiges Modell") print("Invalid model.")
continue continue
while True: while True:
print("") print("")
print("Ask a question") print("Ask a question")
inputText = input () input_text = input()
if inputText == "change": if input_text == "change":
break break
outputText = chat1.send_message(inputText, model) output_text = chat1.send_message(input_text, model)
print(outputText) print(output_text)

View file

@ -1,12 +1,14 @@
from flask import Flask, send_from_directory from flask import Flask, send_from_directory
app = Flask(__name__)
class WebHost:
@staticmethod
def main_page():
app = Flask(__name__)
@app.route('/') @app.route('/')
def index(): def index():
return app.send_static_file('index.html') return app.send_static_file('index.html')
if __name__ == '__main__': if __name__ == '__main__':
app.run(debug=True) app.run(debug=True)