Merge pull request #3 from harshalmore31/local_ui

Local UI fix: ensure .env file is created if not found when saving API key
pull/709/head
harshalmore31 4 months ago committed by GitHub
commit 4e8ea9564b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1636,6 +1636,10 @@ def create_app():
# Save API key to .env # Save API key to .env
env_path = find_dotenv() env_path = find_dotenv()
if not env_path:
env_path = os.path.join(os.getcwd(), ".env")
with open(env_path, "w") as f:
f.write("")
if provider == "openai": if provider == "openai":
set_key(env_path, "OPENAI_API_KEY", api_key) set_key(env_path, "OPENAI_API_KEY", api_key)
elif provider == "anthropic": elif provider == "anthropic":

Loading…
Cancel
Save