read access code from params
This commit is contained in:
parent
78a10c9571
commit
b46d08b416
@ -79,13 +79,17 @@ async def stream_code(websocket: WebSocket):
|
|||||||
|
|
||||||
# Get the OpenAI API key from the request. Fall back to environment variable if not provided.
|
# Get the OpenAI API key from the request. Fall back to environment variable if not provided.
|
||||||
# If neither is provided, we throw an error.
|
# If neither is provided, we throw an error.
|
||||||
if params["openAiApiKey"]:
|
openai_api_key = None
|
||||||
openai_api_key = params["openAiApiKey"]
|
if "accessCode" in params and params["accessCode"]:
|
||||||
print("Using OpenAI API key from client-side settings dialog")
|
print("Using access code")
|
||||||
else:
|
else:
|
||||||
openai_api_key = os.environ.get("OPENAI_API_KEY")
|
if params["openAiApiKey"]:
|
||||||
if openai_api_key:
|
openai_api_key = params["openAiApiKey"]
|
||||||
print("Using OpenAI API key from environment variable")
|
print("Using OpenAI API key from client-side settings dialog")
|
||||||
|
else:
|
||||||
|
openai_api_key = os.environ.get("OPENAI_API_KEY")
|
||||||
|
if openai_api_key:
|
||||||
|
print("Using OpenAI API key from environment variable")
|
||||||
|
|
||||||
if not openai_api_key:
|
if not openai_api_key:
|
||||||
print("OpenAI API key not found")
|
print("OpenAI API key not found")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user