Compare commits
No commits in common. "840654f9d1a13882f66c3294ad6430daba0f4733" and "579274000ce6c5e447a8b7ac0d2d5828ede1f394" have entirely different histories.
840654f9d1
...
579274000c
2 changed files with 9 additions and 10 deletions
4
py/ai.py
4
py/ai.py
|
@ -12,9 +12,13 @@ class AI:
|
||||||
options={"temperature": 0.5},
|
options={"temperature": 0.5},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
for i in messages:
|
||||||
|
print(i)
|
||||||
|
|
||||||
return_class.ai_response[access_token] = ""
|
return_class.ai_response[access_token] = ""
|
||||||
|
|
||||||
for chunk in stream:
|
for chunk in stream:
|
||||||
|
print(chunk['message']['content'])
|
||||||
return_class.ai_response[access_token] += chunk['message']['content']
|
return_class.ai_response[access_token] += chunk['message']['content']
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
13
py/api.py
13
py/api.py
|
@ -26,16 +26,11 @@ class API:
|
||||||
def send_ai():
|
def send_ai():
|
||||||
data = request.get_json()
|
data = request.get_json()
|
||||||
messages = data.get('messages')
|
messages = data.get('messages')
|
||||||
model_type = data.get('model_type')
|
|
||||||
ai_model = data.get('ai_model')
|
ai_model = data.get('ai_model')
|
||||||
access_token = data.get('access_token')
|
access_token = data.get('access_token')
|
||||||
if access_token not in self.ai_response:
|
if access_token not in self.ai_response:
|
||||||
return jsonify({'status': 401, 'error': 'Invalid access token'})
|
return jsonify({'status': 401, 'error': 'Invalid access token'})
|
||||||
|
|
||||||
if model_type == "local":
|
|
||||||
self.ai.process_local(ai_model, messages, self, access_token)
|
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})
|
return jsonify({'status': 200})
|
||||||
|
|
||||||
@self.app.route('/interstellar/api/ai_get', methods=['GET'])
|
@self.app.route('/interstellar/api/ai_get', methods=['GET'])
|
||||||
|
@ -51,13 +46,13 @@ class API:
|
||||||
data = request.args.get('data')
|
data = request.args.get('data')
|
||||||
if action == "create_account":
|
if action == "create_account":
|
||||||
self.db.add_user(data)
|
self.db.add_user(data)
|
||||||
elif action == "change_password":
|
if action == "change_password":
|
||||||
self.db.update_password(data)
|
self.db.update_password(data)
|
||||||
elif action == "get_data":
|
if action == "get_data":
|
||||||
self.db.get_data(data)
|
self.db.get_data(data)
|
||||||
elif action == "change_data":
|
if action == "change_data":
|
||||||
self.db.change_data(data)
|
self.db.change_data(data)
|
||||||
elif action == "check_credentials":
|
if action == "check_credentials":
|
||||||
self.db.check_credentials(data)
|
self.db.check_credentials(data)
|
||||||
|
|
||||||
email_address = "emailAddress"
|
email_address = "emailAddress"
|
||||||
|
|
Loading…
Reference in a new issue