forked from React-Group/interstellar_ai
More models
This commit is contained in:
parent
d0f27295d7
commit
83e0614bdb
3 changed files with 34 additions and 2 deletions
12
py/api.py
12
py/api.py
|
@ -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'})
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue