diff --git a/py/ai.py b/py/ai.py index 0a57b57..c51f2d2 100644 --- a/py/ai.py +++ b/py/ai.py @@ -12,9 +12,13 @@ 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 diff --git a/py/api.py b/py/api.py index 646af55..7b09e1d 100644 --- a/py/api.py +++ b/py/api.py @@ -26,16 +26,11 @@ 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) + self.ai.process_local(ai_model, messages, self, access_token) return jsonify({'status': 200}) @self.app.route('/interstellar/api/ai_get', methods=['GET']) @@ -51,13 +46,13 @@ class API: data = request.args.get('data') if action == "create_account": self.db.add_user(data) - elif action == "change_password": + if action == "change_password": self.db.update_password(data) - elif action == "get_data": + if action == "get_data": self.db.get_data(data) - elif action == "change_data": + if action == "change_data": self.db.change_data(data) - elif action == "check_credentials": + if action == "check_credentials": self.db.check_credentials(data) email_address = "emailAddress"