Compare commits
2 commits
579274000c
...
840654f9d1
Author | SHA1 | Date | |
---|---|---|---|
|
840654f9d1 | ||
|
7b6f91c117 |
2 changed files with 10 additions and 9 deletions
4
py/ai.py
4
py/ai.py
|
@ -12,13 +12,9 @@ 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
|
||||||
|
|
15
py/api.py
15
py/api.py
|
@ -26,11 +26,16 @@ 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'})
|
||||||
self.ai.process_local(ai_model, messages, self, 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})
|
return jsonify({'status': 200})
|
||||||
|
|
||||||
@self.app.route('/interstellar/api/ai_get', methods=['GET'])
|
@self.app.route('/interstellar/api/ai_get', methods=['GET'])
|
||||||
|
@ -46,13 +51,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)
|
||||||
if action == "change_password":
|
elif action == "change_password":
|
||||||
self.db.update_password(data)
|
self.db.update_password(data)
|
||||||
if action == "get_data":
|
elif action == "get_data":
|
||||||
self.db.get_data(data)
|
self.db.get_data(data)
|
||||||
if action == "change_data":
|
elif action == "change_data":
|
||||||
self.db.change_data(data)
|
self.db.change_data(data)
|
||||||
if action == "check_credentials":
|
elif 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