You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As Ayushma will be open to all, it is not viable to have everyone be able to use our Open AI api keys. We should only allow a set number of users to use Ayushma's OpenAI key.
So, add a boolean field called allow_key (or any other name that you think would be more fit) with default false to the user model. Allow /chat and /converse endpoints to have an open_ai_key parameter to be sent in the request headers. Now check if open_ai_key is present in the request headers.
If it is, use that key.
If the key is not present in the request headers, and the allow_key value is True on the requesting user, use the default OPEN_AI_KEY.
If the key is not present in the headers, and the allow_key is False, respond with an error message asking for an open_ai_key
The text was updated successfully, but these errors were encountered:
…points. (#41)
* fixes#39
* move `allow_key` to User model
* update ChatViewSet to use allow_key from user
* remove allow_key from chat serializer
* format
---------
Co-authored-by: Shivank Kacker <kacker.shivank@gmail.com>
As Ayushma will be open to all, it is not viable to have everyone be able to use our Open AI api keys. We should only allow a set number of users to use Ayushma's OpenAI key.
So, add a boolean field called
allow_key
(or any other name that you think would be more fit) with default false to the user model. Allow/chat
and/converse
endpoints to have anopen_ai_key
parameter to be sent in the request headers. Now check ifopen_ai_key
is present in the request headers.allow_key
value isTrue
on the requesting user, use the defaultOPEN_AI_KEY
.allow_key
isFalse
, respond with an error message asking for anopen_ai_key
The text was updated successfully, but these errors were encountered: