diff --git a/.env.example b/.env.example index 4cf1d50d..f42a8ea0 100644 --- a/.env.example +++ b/.env.example @@ -1,6 +1,6 @@ OPENAI_API_KEY=sk-XXXX -OPENAI_API_TYPE=openai -OPENAI_BASE_URL=https://api.openai.com +OPENAI_API_TYPE=open_ai +OPENAI_BASE_URL=https://api.openai.com/v1 OPENAI_API_VERSION=2023-03-15-preview # OPENAI_EXTRA_HEADERS={"key": "value"} OPENAI_MODELS=[{"displayName": "GPT-3.5", "name": "gpt-3.5-turbo"}, {"displayName": "GPT-4", "name": "gpt-4"}] diff --git a/gpt_code_ui/webapp/main.py b/gpt_code_ui/webapp/main.py index 6b76974a..3adf6efd 100644 --- a/gpt_code_ui/webapp/main.py +++ b/gpt_code_ui/webapp/main.py @@ -19,14 +19,11 @@ load_dotenv('.env') -openai.api_base = os.environ.get("OPENAI_BASE_URL", "https://api.openai.com") -openai.api_type = os.environ.get("OPENAI_API_TYPE", "openai") openai.api_version = os.environ.get("OPENAI_API_VERSION") -openai.api_key = os.environ.get("OPENAI_API_KEY", "") -openai.log = os.getenv("OPENAI_API_LOGLEVEL", "") +openai.log = os.getenv("OPENAI_API_LOGLEVEL") OPENAI_EXTRA_HEADERS = json.loads(os.environ.get("OPENAI_EXTRA_HEADERS", "{}")) -if openai.api_type == "openai": +if openai.api_type == "open_ai": AVAILABLE_MODELS = json.loads(os.environ.get("OPENAI_MODELS", '''[{"displayName": "GPT-3.5", "name": "gpt-3.5-turbo"}, {"displayName": "GPT-4", "name": "gpt-4"}]''')) elif openai.api_type == "azure": try: @@ -138,7 +135,7 @@ async def get_code(user_prompt, user_openai_key=None, model="gpt-3.5-turbo"): ] ) - if openai.api_type == 'openai': + if openai.api_type == 'open_ai': arguments["model"] = model elif openai.api_type == 'azure': arguments["deployment_id"] = model diff --git a/setup.py b/setup.py index 2b7df259..ae6b8eaf 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ setup( name='gpt_code_ui', - version='0.42.38', + version='0.42.39', description="An Open Source version of ChatGPT Code Interpreter", long_description=long_description, long_description_content_type='text/markdown', # This field specifies the format of the `long_description`.