fixed stuff with the backend and the pesky cpython cache

This commit is contained in:
Patrick_Pluto 2024-09-20 15:46:02 +02:00
parent b924d30616
commit 7b6f91c117
3 changed files with 11 additions and 9 deletions

1
.gitignore vendored
View file

@ -38,6 +38,7 @@ next-env.d.ts
.idea/
venv/
__pycache__/
key.pem
cert.pem

View file

@ -12,13 +12,9 @@ class AI:
options={"temperature": 0.5},
)
for i in messages:
print(i)
return_class.ai_response[access_token] = ""
for chunk in stream:
print(chunk['message']['content'])
return_class.ai_response[access_token] += chunk['message']['content']
@staticmethod

View file

@ -26,11 +26,16 @@ class API:
def send_ai():
data = request.get_json()
messages = data.get('messages')
model_type = data.get('model_type')
ai_model = data.get('ai_model')
access_token = data.get('access_token')
if access_token not in self.ai_response:
return jsonify({'status': 401, 'error': 'Invalid access token'})
if model_type == "local":
self.ai.process_local(ai_model, messages, self, access_token)
if model_type == "mistral":
self.ai.process_mistralai(ai_model, messages, self, access_token)
return jsonify({'status': 200})
@self.app.route('/interstellar/api/ai_get', methods=['GET'])
@ -46,13 +51,13 @@ class API:
data = request.args.get('data')
if action == "create_account":
self.db.add_user(data)
if action == "change_password":
elif action == "change_password":
self.db.update_password(data)
if action == "get_data":
elif action == "get_data":
self.db.get_data(data)
if action == "change_data":
elif action == "change_data":
self.db.change_data(data)
if action == "check_credentials":
elif action == "check_credentials":
self.db.check_credentials(data)
email_address = "emailAddress"