mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-01-30 01:18:07 -05:00
Remove keys.py and replace with python-dotenv.
- Removed `keys.py`. - Added `.env.template`. - Added `.env` to `.gitignore`. - Updated various files that imported `keys` to use `os.getenv` instead. - Updated `requirements.txt` dependencies. - Updated README.md with instructions on setting up environment variables. This change improves security, flexibility, and makes it easier to use Auto-GPT in notebooks. Environment variables are stored in `.env` and loaded via `load_dotenv()` in `scripts/main.py`.
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import os
|
||||
import time
|
||||
import openai
|
||||
import keys
|
||||
|
||||
# Initialize the OpenAI API client
|
||||
openai.api_key = keys.OPENAI_API_KEY
|
||||
openai.api_key = os.getenv("OPENAI_API_KEY")
|
||||
|
||||
|
||||
def create_chat_message(role, content):
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
# Get yours from: https://beta.openai.com/account/api-keys
|
||||
OPENAI_API_KEY = "YOUR-OPENAI-KEY"
|
||||
# To access your ElevenLabs API key, head to https://elevenlabs.io, you
|
||||
# can view your xi-api-key using the 'Profile' tab on the website.
|
||||
ELEVENLABS_API_KEY = "YOUR-ELEVENLABS-KEY"
|
||||
@@ -11,6 +11,11 @@ import speak
|
||||
from enum import Enum, auto
|
||||
import sys
|
||||
from config import Config
|
||||
from dotenv import load_dotenv
|
||||
|
||||
|
||||
# Load environment variables from .env file
|
||||
load_dotenv()
|
||||
|
||||
|
||||
class Argument(Enum):
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import os
|
||||
from playsound import playsound
|
||||
import requests
|
||||
import keys
|
||||
|
||||
|
||||
voices = ["ErXwobaYiN019PkySvjV", "EXAVITQu4vr4xnSDxMaL"]
|
||||
|
||||
tts_headers = {
|
||||
"Content-Type": "application/json",
|
||||
"xi-api-key": keys.ELEVENLABS_API_KEY
|
||||
"xi-api-key": os.getenv("ELEVENLABS_API_KEY")
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user