Skip to content
This repository has been archived by the owner on Sep 15, 2024. It is now read-only.

Commit

Permalink
fix: No need to have separate functions to handle API key changes bec…
Browse files Browse the repository at this point in the history
…ause the environment variable should not be updated with user-specified API keys.
  • Loading branch information
anirbanbasu committed May 8, 2024
1 parent 8810094 commit bac9c95
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
4 changes: 2 additions & 2 deletions pages/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def update_llm_system_message(callback_data: Any = None):
value=global_state.global_settings__cohere_api_key,
password=True,
message="You can get an API key from the Cohere website.",
on_value=global_state.update_cohere_apikey,
on_value=global_state.update_llm_settings,
)
solara.InputText(
label="Cohere model",
Expand All @@ -84,7 +84,7 @@ def update_llm_system_message(callback_data: Any = None):
value=global_state.global_settings__openai_api_key,
password=True,
message="You can get an API key from the Open AI website.",
on_value=global_state.update_openai_apikey,
on_value=global_state.update_llm_settings,
)
solara.InputText(
label="Open AI model",
Expand Down
12 changes: 0 additions & 12 deletions utils/global_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,15 +496,3 @@ def initialise_default_settings():
update_index_documents_storage_context()

global_settings_initialised.value = True


def update_openai_apikey(callback_data: Any = None):
"""Update the OpenAI API key in the OS environment variable."""
# os.environ[constants.ENV_KEY_OPENAI_API_KEY] = global_settings__openai_api_key.value
update_llm_settings()


def update_cohere_apikey(callback_data: Any = None):
"""Update the Cohere API key in the OS environment variable."""
# os.environ[constants.ENV_KEY_COHERE_API_KEY] = global_settings__cohere_api_key.value
update_llm_settings()

0 comments on commit bac9c95

Please sign in to comment.