More models

This commit is contained in:
Patrick_Pluto 2024-09-23 11:57:16 +02:00
parent d0f27295d7
commit 83e0614bdb
3 changed files with 34 additions and 2 deletions

View file

@ -46,6 +46,18 @@ class API:
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.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.start()
thread.join()
return jsonify({'status': 200})
return jsonify({'status': 401, 'error': 'Invalid AI model type'})