use platform api key if the access code is correct
This commit is contained in:
parent
b46d08b416
commit
8a242103fc
@ -81,7 +81,17 @@ async def stream_code(websocket: WebSocket):
|
|||||||
# If neither is provided, we throw an error.
|
# If neither is provided, we throw an error.
|
||||||
openai_api_key = None
|
openai_api_key = None
|
||||||
if "accessCode" in params and params["accessCode"]:
|
if "accessCode" in params and params["accessCode"]:
|
||||||
print("Using access code")
|
print("Access code - using platform API key")
|
||||||
|
if params["accessCode"] == "hi":
|
||||||
|
openai_api_key = os.environ.get("PLATFORM_OPENAI_API_KEY")
|
||||||
|
else:
|
||||||
|
await websocket.send_json(
|
||||||
|
{
|
||||||
|
"type": "error",
|
||||||
|
"value": "Invalid access code. Please try again.",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
return
|
||||||
else:
|
else:
|
||||||
if params["openAiApiKey"]:
|
if params["openAiApiKey"]:
|
||||||
openai_api_key = params["openAiApiKey"]
|
openai_api_key = params["openAiApiKey"]
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user