Uhmm fixed

This commit is contained in:
Patrick_Pluto 2024-09-24 09:24:31 +02:00
parent c1d1bf246c
commit 7010be84ea
5 changed files with 40 additions and 13 deletions

View file

@ -42,19 +42,22 @@ class API:
return jsonify({'status': 200})
elif model_type == "mistral":
api_key = data.get('api_key')
thread = threading.Thread(target=self.ai.process_mistralai, args=(ai_model, messages, self, access_token, api_key))
thread = threading.Thread(target=self.ai.process_mistralai,
args=(ai_model, messages, self, access_token, api_key))
thread.start()
thread.join()
return jsonify({'status': 200})
elif model_type == "openai":
api_key = data.get('api_key')
thread = threading.Thread(target=self.ai.process_openai, args=(ai_model, messages, self, access_token, api_key))
thread = threading.Thread(target=self.ai.process_openai,
args=(ai_model, messages, self, access_token, api_key))
thread.start()
thread.join()
return jsonify({'status': 200})
elif model_type == "anthropic":
api_key = data.get('api_key')
thread = threading.Thread(target=self.ai.process_anthropic, args=(ai_model, messages, self, access_token, api_key))
thread = threading.Thread(target=self.ai.process_anthropic,
args=(ai_model, messages, self, access_token, api_key))
thread.start()
thread.join()
return jsonify({'status': 200})
@ -118,3 +121,7 @@ class API:
ssl_context = ("cert.pem", "key.pem")
self.app.run(debug=True, host='0.0.0.0', port=5000)
api = API()
api.run()