From ba5394acc3c21cfd0f2f024de84e30a20c4f72bc Mon Sep 17 00:00:00 2001 From: pablodanswer Date: Tue, 3 Sep 2024 15:17:32 -0700 Subject: [PATCH 1/9] update for auth --- backend/model_server/encoders.py | 14 +- .../modals/ChangeCredentialsModal.tsx | 180 ++++++++++++------ .../modals/ProviderCreationModal.tsx | 12 +- .../embeddings/pages/CloudEmbeddingPage.tsx | 4 +- 4 files changed, 139 insertions(+), 71 deletions(-) diff --git a/backend/model_server/encoders.py b/backend/model_server/encoders.py index ad9d8582bec..8249ce1fda7 100644 --- a/backend/model_server/encoders.py +++ b/backend/model_server/encoders.py @@ -237,15 +237,18 @@ def get_local_reranking_model( def embed_with_litellm_proxy( - texts: list[str], api_url: str, model: str + texts: list[str], api_url: str, model_name: str, api_key: str | None ) -> list[Embedding]: + headers = {} if not api_key else {"Authorization": f"Bearer {api_key}"} + with httpx.Client() as client: response = client.post( api_url, json={ - "model": model, + "model": model_name, "input": texts, }, + headers=headers, ) response.raise_for_status() result = response.json() @@ -280,7 +283,12 @@ def embed_text( logger.error("API URL not provided for LiteLLM proxy") raise ValueError("API URL is required for LiteLLM proxy embedding.") try: - return embed_with_litellm_proxy(texts, api_url, model_name or "") + return embed_with_litellm_proxy( + texts=texts, + api_url=api_url, + model_name=model_name or "", + api_key=api_key, + ) except Exception as e: logger.exception(f"Error during LiteLLM proxy embedding: {str(e)}") raise diff --git a/web/src/app/admin/embeddings/modals/ChangeCredentialsModal.tsx b/web/src/app/admin/embeddings/modals/ChangeCredentialsModal.tsx index d17e15d0f78..9e848bbe2c0 100644 --- a/web/src/app/admin/embeddings/modals/ChangeCredentialsModal.tsx +++ b/web/src/app/admin/embeddings/modals/ChangeCredentialsModal.tsx @@ -153,34 +153,22 @@ export function ChangeCredentialsModal({ title={`Modify your ${provider.provider_type} ${isProxy ? "URL" : "key"}`} onOutsideClick={onCancel} > -
- - Want to swap out your {isProxy ? "URL" : "key"}? - - - Visit API - - -
- {useFileUpload ? ( - <> - - - {fileName &&

Uploaded file: {fileName}

} - - ) : ( - <> + <> + {isProxy && ( +
+ + Want to swap out your URL? + + + Visit API + + +
setApiKeyOrUrl(e.target.value)} - placeholder={`Paste your ${isProxy ? "API URL" : "API key"} here`} + placeholder="Paste your API URL here" /> - - )} -
+
+ + {testError && ( + + {testError} + + )} - {testError && ( - - {testError} - +
+ +
+ + {deletionError && ( + + {deletionError} + + )} + +
)} -
- +
+ + + + You can also delete your configuration. + + + This is only possible if you have already switched to a different + embedding type! + + + + {deletionError && ( + + {deletionError} + + )}
- - - - You can also delete your {isProxy ? "URL" : "key"}. - - - This is only possible if you have already switched to a different - embedding type! - - - - {deletionError && ( - - {deletionError} - - )} - + ); } diff --git a/web/src/app/admin/embeddings/modals/ProviderCreationModal.tsx b/web/src/app/admin/embeddings/modals/ProviderCreationModal.tsx index b4aa909aea3..1107001b70c 100644 --- a/web/src/app/admin/embeddings/modals/ProviderCreationModal.tsx +++ b/web/src/app/admin/embeddings/modals/ProviderCreationModal.tsx @@ -182,15 +182,17 @@ export function ProviderCreationModal({ -
- {isProxy ? ( +
+ {isProxy && ( - ) : useFileUpload ? ( + )} + + {useFileUpload ? ( <> )} diff --git a/web/src/app/admin/embeddings/pages/CloudEmbeddingPage.tsx b/web/src/app/admin/embeddings/pages/CloudEmbeddingPage.tsx index 9e5644344c9..db2c0ad66c7 100644 --- a/web/src/app/admin/embeddings/pages/CloudEmbeddingPage.tsx +++ b/web/src/app/admin/embeddings/pages/CloudEmbeddingPage.tsx @@ -181,7 +181,7 @@ export default function CloudEmbeddingPage({ onClick={() => setShowTentativeProvider(LITELLM_CLOUD_PROVIDER)} className="mb-2 px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600 text-sm cursor-pointer" > - Provide API URL + Set API Configuration ) : ( )} From 046ee0ed147c8b7a98c47d573464f136dd68f736 Mon Sep 17 00:00:00 2001 From: pablodanswer Date: Tue, 3 Sep 2024 18:24:02 -0700 Subject: [PATCH 2/9] validated embedding model names --- .../danswer/server/manage/embedding/api.py | 4 +- .../danswer/server/manage/embedding/models.py | 1 + backend/model_server/encoders.py | 3 + .../managers/embedding_provider.py | 189 ++++++++++++++++++ .../modals/ProviderCreationModal.tsx | 27 ++- 5 files changed, 216 insertions(+), 8 deletions(-) create mode 100644 backend/tests/integration/common_utils/managers/embedding_provider.py diff --git a/backend/danswer/server/manage/embedding/api.py b/backend/danswer/server/manage/embedding/api.py index 2cee962ee6b..86764879a1c 100644 --- a/backend/danswer/server/manage/embedding/api.py +++ b/backend/danswer/server/manage/embedding/api.py @@ -42,10 +42,10 @@ def test_embedding_configuration( api_key=test_llm_request.api_key, api_url=test_llm_request.api_url, provider_type=test_llm_request.provider_type, + model_name=test_llm_request.model_name, normalize=False, query_prefix=None, passage_prefix=None, - model_name=None, ) test_model.encode(["Testing Embedding"], text_type=EmbedTextType.QUERY) @@ -59,6 +59,8 @@ def test_embedding_configuration( logger.error(f"{error_msg} Error message: {e}", exc_info=True) raise HTTPException(status_code=400, detail=error_msg) + # raise ValueError("error_msg") + @admin_router.get("", response_model=list[EmbeddingModelDetail]) def list_embedding_models( diff --git a/backend/danswer/server/manage/embedding/models.py b/backend/danswer/server/manage/embedding/models.py index 50518e6ec01..fc39721a2d6 100644 --- a/backend/danswer/server/manage/embedding/models.py +++ b/backend/danswer/server/manage/embedding/models.py @@ -12,6 +12,7 @@ class TestEmbeddingRequest(BaseModel): provider_type: EmbeddingProvider api_key: str | None = None api_url: str | None = None + model_name: str | None = None class CloudEmbeddingProvider(BaseModel): diff --git a/backend/model_server/encoders.py b/backend/model_server/encoders.py index 8249ce1fda7..333f5fb20ea 100644 --- a/backend/model_server/encoders.py +++ b/backend/model_server/encoders.py @@ -240,6 +240,9 @@ def embed_with_litellm_proxy( texts: list[str], api_url: str, model_name: str, api_key: str | None ) -> list[Embedding]: headers = {} if not api_key else {"Authorization": f"Bearer {api_key}"} + print( + f"Embedding {len(texts)} texts with provider and api {api_url} api key {api_key}" + ) with httpx.Client() as client: response = client.post( diff --git a/backend/tests/integration/common_utils/managers/embedding_provider.py b/backend/tests/integration/common_utils/managers/embedding_provider.py new file mode 100644 index 00000000000..0893f1fca1c --- /dev/null +++ b/backend/tests/integration/common_utils/managers/embedding_provider.py @@ -0,0 +1,189 @@ +import requests + +from danswer.db.models import EmbeddingProvider +from danswer.server.manage.embedding.models import TestEmbeddingRequest +from tests.integration.common_utils.constants import API_SERVER_URL +from tests.integration.common_utils.constants import GENERAL_HEADERS +from tests.integration.common_utils.managers.search_settings import ( + SearchSettingsManager, +) +from tests.integration.common_utils.test_models import TestCloudEmbeddingProvider +from tests.integration.common_utils.test_models import TestUser + + +class EmbeddingProviderManager: + @staticmethod + def test( + user_performing_action: TestUser, embedding_provider: TestCloudEmbeddingProvider + ) -> None: + test_embedding_request = TestEmbeddingRequest( + provider_type=embedding_provider.provider_type, + api_key=embedding_provider.api_key, + api_url=embedding_provider.api_url, + ) + response = requests.post( + url=f"{API_SERVER_URL}/admin/embedding/test-embedding", + json=test_embedding_request.model_dump(), + headers=user_performing_action.headers + if user_performing_action + else GENERAL_HEADERS, + ) + + if response.status_code != 200: + raise ValueError(f"Failed to test embedding provider: {response.json()}") + + def create( + provider_type: EmbeddingProvider, + api_url: str | None = None, + api_key: str | None = None, + user_performing_action: TestUser | None = None, + ) -> TestCloudEmbeddingProvider: + embedding_provider_request = { + "provider_type": provider_type, + "api_url": api_url, + "api_key": api_key, + } + + response = requests.put( + url=f"{API_SERVER_URL}/admin/embedding/embedding-provider", + json=embedding_provider_request, + headers=user_performing_action.headers + if user_performing_action + else GENERAL_HEADERS, + ) + response.raise_for_status() + + response_data = response.json() + print(response_data) + return TestCloudEmbeddingProvider( + provider_type=response_data["provider_type"], + api_key=response_data.get("api_key"), + api_url=response_data.get("api_url"), + model_name=None, + dimensions=None, + query_prefix=None, + passage_prefix=None, + batch_size=None, + api_version=None, + ) + + @staticmethod + def get_all( + user_performing_action: TestUser | None = None, + ) -> list[TestCloudEmbeddingProvider]: + response = requests.get( + url=f"{API_SERVER_URL}/admin/embedding/embedding-provider", + headers=user_performing_action.headers + if user_performing_action + else GENERAL_HEADERS, + ) + + response.raise_for_status() + return [ + TestCloudEmbeddingProvider(**embedding_provider) + for embedding_provider in response.json() + ] + + @staticmethod + def edit( + embedding_provider: TestCloudEmbeddingProvider, + user_performing_action: TestUser | None = None, + ) -> None: + response = requests.put( + url=f"{API_SERVER_URL}/admin/embedding/embedding-provider", + json=embedding_provider.model_dump(), + headers=user_performing_action.headers + if user_performing_action + else GENERAL_HEADERS, + ) + response.raise_for_status() + + @staticmethod + def delete( + provider_type: EmbeddingProvider, + user_performing_action: TestUser | None = None, + ) -> None: + response = requests.delete( + url=f"{API_SERVER_URL}/admin/embedding/embedding-provider/{provider_type}", + headers=user_performing_action.headers + if user_performing_action + else GENERAL_HEADERS, + ) + response.raise_for_status() + + @staticmethod + def verify_providers( + embedding_providers: list[TestCloudEmbeddingProvider], + user_performing_action: TestUser | None = None, + ) -> None: + current_providers = EmbeddingProviderManager.get_all(user_performing_action) + + for expected_provider in embedding_providers: + matching_provider = next( + ( + p + for p in current_providers + if p.provider_type == expected_provider.provider_type + ), + None, + ) + + if matching_provider is None: + raise ValueError( + f"Embedding provider {expected_provider.provider_type} not found in current providers" + ) + + # Validate all settings match + if matching_provider.api_url != expected_provider.api_url: + raise ValueError( + f"API URL mismatch for provider {expected_provider.provider_type}" + ) + + if matching_provider.api_key != expected_provider.api_key: + raise ValueError( + f"API Key mismatch for provider {expected_provider.provider_type}" + ) + + @staticmethod + def verify( + embedding_provider: TestCloudEmbeddingProvider, + user_performing_action: TestUser | None = None, + ) -> None: + current_settings = SearchSettingsManager.get_current(user_performing_action) + current_provider_type = current_settings.provider_type + + if current_provider_type is None: + raise ValueError("No current embedding provider found") + + if current_provider_type != embedding_provider.provider_type: + raise ValueError( + f"Current embedding provider {current_provider_type} does not match expected {embedding_provider.provider_type}" + ) + + # Additional checks for API key and URL can be added here if needed + # Note: The actual API key might not be accessible for security reasons + if current_settings.api_url != embedding_provider.api_url: + raise ValueError( + "Current embedding provider API URL does not match expected settings" + ) + + @staticmethod + def test_embedding( + provider_type: EmbeddingProvider, + api_url: str | None = None, + api_key: str | None = None, + user_performing_action: TestUser | None = None, + ) -> None: + test_request = { + "provider_type": provider_type, + "api_url": api_url, + "api_key": api_key, + } + response = requests.post( + url=f"{API_SERVER_URL}/admin/embedding/test-embedding", + json=test_request, + headers=user_performing_action.headers + if user_performing_action + else GENERAL_HEADERS, + ) + response.raise_for_status() diff --git a/web/src/app/admin/embeddings/modals/ProviderCreationModal.tsx b/web/src/app/admin/embeddings/modals/ProviderCreationModal.tsx index 1107001b70c..c3a50731c07 100644 --- a/web/src/app/admin/embeddings/modals/ProviderCreationModal.tsx +++ b/web/src/app/admin/embeddings/modals/ProviderCreationModal.tsx @@ -36,6 +36,7 @@ export function ProviderCreationModal({ ? Object.entries(existingProvider.custom_config) : [], model_id: 0, + model_name: null, }; const validationSchema = Yup.object({ @@ -45,6 +46,9 @@ export function ProviderCreationModal({ : useFileUpload ? Yup.string() : Yup.string().required("API Key is required"), + model_name: isProxy + ? Yup.string().required("Model name is required") + : Yup.string().nullable(), api_url: isProxy ? Yup.string().required("API URL is required") : Yup.string(), @@ -96,6 +100,7 @@ export function ProviderCreationModal({ provider_type: values.provider_type.toLowerCase().split(" ")[0], api_key: values.api_key, api_url: values.api_url, + model_name: values.model_name, }), } ); @@ -184,12 +189,20 @@ export function ProviderCreationModal({
{isProxy && ( - + <> + + + )} {useFileUpload ? ( @@ -207,7 +220,7 @@ export function ProviderCreationModal({ ) : ( From 366723c6e2d24fa6cc5868f5b87c0249c550568c Mon Sep 17 00:00:00 2001 From: pablodanswer Date: Tue, 3 Sep 2024 18:31:24 -0700 Subject: [PATCH 3/9] remove embedding provider --- .../managers/embedding_provider.py | 189 ------------------ 1 file changed, 189 deletions(-) delete mode 100644 backend/tests/integration/common_utils/managers/embedding_provider.py diff --git a/backend/tests/integration/common_utils/managers/embedding_provider.py b/backend/tests/integration/common_utils/managers/embedding_provider.py deleted file mode 100644 index 0893f1fca1c..00000000000 --- a/backend/tests/integration/common_utils/managers/embedding_provider.py +++ /dev/null @@ -1,189 +0,0 @@ -import requests - -from danswer.db.models import EmbeddingProvider -from danswer.server.manage.embedding.models import TestEmbeddingRequest -from tests.integration.common_utils.constants import API_SERVER_URL -from tests.integration.common_utils.constants import GENERAL_HEADERS -from tests.integration.common_utils.managers.search_settings import ( - SearchSettingsManager, -) -from tests.integration.common_utils.test_models import TestCloudEmbeddingProvider -from tests.integration.common_utils.test_models import TestUser - - -class EmbeddingProviderManager: - @staticmethod - def test( - user_performing_action: TestUser, embedding_provider: TestCloudEmbeddingProvider - ) -> None: - test_embedding_request = TestEmbeddingRequest( - provider_type=embedding_provider.provider_type, - api_key=embedding_provider.api_key, - api_url=embedding_provider.api_url, - ) - response = requests.post( - url=f"{API_SERVER_URL}/admin/embedding/test-embedding", - json=test_embedding_request.model_dump(), - headers=user_performing_action.headers - if user_performing_action - else GENERAL_HEADERS, - ) - - if response.status_code != 200: - raise ValueError(f"Failed to test embedding provider: {response.json()}") - - def create( - provider_type: EmbeddingProvider, - api_url: str | None = None, - api_key: str | None = None, - user_performing_action: TestUser | None = None, - ) -> TestCloudEmbeddingProvider: - embedding_provider_request = { - "provider_type": provider_type, - "api_url": api_url, - "api_key": api_key, - } - - response = requests.put( - url=f"{API_SERVER_URL}/admin/embedding/embedding-provider", - json=embedding_provider_request, - headers=user_performing_action.headers - if user_performing_action - else GENERAL_HEADERS, - ) - response.raise_for_status() - - response_data = response.json() - print(response_data) - return TestCloudEmbeddingProvider( - provider_type=response_data["provider_type"], - api_key=response_data.get("api_key"), - api_url=response_data.get("api_url"), - model_name=None, - dimensions=None, - query_prefix=None, - passage_prefix=None, - batch_size=None, - api_version=None, - ) - - @staticmethod - def get_all( - user_performing_action: TestUser | None = None, - ) -> list[TestCloudEmbeddingProvider]: - response = requests.get( - url=f"{API_SERVER_URL}/admin/embedding/embedding-provider", - headers=user_performing_action.headers - if user_performing_action - else GENERAL_HEADERS, - ) - - response.raise_for_status() - return [ - TestCloudEmbeddingProvider(**embedding_provider) - for embedding_provider in response.json() - ] - - @staticmethod - def edit( - embedding_provider: TestCloudEmbeddingProvider, - user_performing_action: TestUser | None = None, - ) -> None: - response = requests.put( - url=f"{API_SERVER_URL}/admin/embedding/embedding-provider", - json=embedding_provider.model_dump(), - headers=user_performing_action.headers - if user_performing_action - else GENERAL_HEADERS, - ) - response.raise_for_status() - - @staticmethod - def delete( - provider_type: EmbeddingProvider, - user_performing_action: TestUser | None = None, - ) -> None: - response = requests.delete( - url=f"{API_SERVER_URL}/admin/embedding/embedding-provider/{provider_type}", - headers=user_performing_action.headers - if user_performing_action - else GENERAL_HEADERS, - ) - response.raise_for_status() - - @staticmethod - def verify_providers( - embedding_providers: list[TestCloudEmbeddingProvider], - user_performing_action: TestUser | None = None, - ) -> None: - current_providers = EmbeddingProviderManager.get_all(user_performing_action) - - for expected_provider in embedding_providers: - matching_provider = next( - ( - p - for p in current_providers - if p.provider_type == expected_provider.provider_type - ), - None, - ) - - if matching_provider is None: - raise ValueError( - f"Embedding provider {expected_provider.provider_type} not found in current providers" - ) - - # Validate all settings match - if matching_provider.api_url != expected_provider.api_url: - raise ValueError( - f"API URL mismatch for provider {expected_provider.provider_type}" - ) - - if matching_provider.api_key != expected_provider.api_key: - raise ValueError( - f"API Key mismatch for provider {expected_provider.provider_type}" - ) - - @staticmethod - def verify( - embedding_provider: TestCloudEmbeddingProvider, - user_performing_action: TestUser | None = None, - ) -> None: - current_settings = SearchSettingsManager.get_current(user_performing_action) - current_provider_type = current_settings.provider_type - - if current_provider_type is None: - raise ValueError("No current embedding provider found") - - if current_provider_type != embedding_provider.provider_type: - raise ValueError( - f"Current embedding provider {current_provider_type} does not match expected {embedding_provider.provider_type}" - ) - - # Additional checks for API key and URL can be added here if needed - # Note: The actual API key might not be accessible for security reasons - if current_settings.api_url != embedding_provider.api_url: - raise ValueError( - "Current embedding provider API URL does not match expected settings" - ) - - @staticmethod - def test_embedding( - provider_type: EmbeddingProvider, - api_url: str | None = None, - api_key: str | None = None, - user_performing_action: TestUser | None = None, - ) -> None: - test_request = { - "provider_type": provider_type, - "api_url": api_url, - "api_key": api_key, - } - response = requests.post( - url=f"{API_SERVER_URL}/admin/embedding/test-embedding", - json=test_request, - headers=user_performing_action.headers - if user_performing_action - else GENERAL_HEADERS, - ) - response.raise_for_status() From c9cba2717b3cd960c107c6d478da87f51cdcb9bc Mon Sep 17 00:00:00 2001 From: pablodanswer Date: Tue, 3 Sep 2024 18:32:39 -0700 Subject: [PATCH 4/9] remove logs --- backend/danswer/server/manage/embedding/api.py | 2 -- backend/model_server/encoders.py | 3 --- 2 files changed, 5 deletions(-) diff --git a/backend/danswer/server/manage/embedding/api.py b/backend/danswer/server/manage/embedding/api.py index 86764879a1c..eac872810ef 100644 --- a/backend/danswer/server/manage/embedding/api.py +++ b/backend/danswer/server/manage/embedding/api.py @@ -59,8 +59,6 @@ def test_embedding_configuration( logger.error(f"{error_msg} Error message: {e}", exc_info=True) raise HTTPException(status_code=400, detail=error_msg) - # raise ValueError("error_msg") - @admin_router.get("", response_model=list[EmbeddingModelDetail]) def list_embedding_models( diff --git a/backend/model_server/encoders.py b/backend/model_server/encoders.py index 333f5fb20ea..8249ce1fda7 100644 --- a/backend/model_server/encoders.py +++ b/backend/model_server/encoders.py @@ -240,9 +240,6 @@ def embed_with_litellm_proxy( texts: list[str], api_url: str, model_name: str, api_key: str | None ) -> list[Embedding]: headers = {} if not api_key else {"Authorization": f"Bearer {api_key}"} - print( - f"Embedding {len(texts)} texts with provider and api {api_url} api key {api_key}" - ) with httpx.Client() as client: response = client.post( From 678b33e18328fad09713f6ae51e66c8f51089995 Mon Sep 17 00:00:00 2001 From: pablodanswer Date: Wed, 4 Sep 2024 09:18:24 -0700 Subject: [PATCH 5/9] add ability to delete search setting --- backend/danswer/configs/app_configs.py | 2 +- backend/danswer/db/search_settings.py | 79 ++++++++++++++++++- .../danswer/server/manage/embedding/models.py | 4 + .../danswer/server/manage/search_settings.py | 24 +++++- .../docker_compose/docker-compose.dev.yml | 2 +- .../docker_compose/docker-compose.gpu-dev.yml | 2 +- .../docker-compose.search-testing.yml | 2 +- .../embeddings/pages/CloudEmbeddingPage.tsx | 57 ++++++++++--- web/src/app/admin/embeddings/pages/utils.ts | 37 +++++++++ 9 files changed, 192 insertions(+), 17 deletions(-) create mode 100644 web/src/app/admin/embeddings/pages/utils.ts diff --git a/backend/danswer/configs/app_configs.py b/backend/danswer/configs/app_configs.py index f6b218c5f56..e1b45409575 100644 --- a/backend/danswer/configs/app_configs.py +++ b/backend/danswer/configs/app_configs.py @@ -134,7 +134,7 @@ os.environ.get("POSTGRES_PASSWORD") or "password" ) POSTGRES_HOST = os.environ.get("POSTGRES_HOST") or "localhost" -POSTGRES_PORT = os.environ.get("POSTGRES_PORT") or "5432" +POSTGRES_PORT = os.environ.get("POSTGRES_PORT") or "5433" POSTGRES_DB = os.environ.get("POSTGRES_DB") or "postgres" # defaults to False diff --git a/backend/danswer/db/search_settings.py b/backend/danswer/db/search_settings.py index 0cb50295337..73305394027 100644 --- a/backend/danswer/db/search_settings.py +++ b/backend/danswer/db/search_settings.py @@ -1,3 +1,5 @@ +from sqlalchemy import and_ +from sqlalchemy import delete from sqlalchemy import select from sqlalchemy.orm import Session @@ -13,6 +15,7 @@ from danswer.db.engine import get_sqlalchemy_engine from danswer.db.llm import fetch_embedding_provider from danswer.db.models import CloudEmbeddingProvider +from danswer.db.models import IndexAttempt from danswer.db.models import IndexModelStatus from danswer.db.models import SearchSettings from danswer.indexing.models import IndexingSetting @@ -28,11 +31,44 @@ logger = setup_logger() -def create_search_settings( +def create_or_fetch_search_settings( search_settings: SavedSearchSettings, db_session: Session, status: IndexModelStatus = IndexModelStatus.FUTURE, ) -> SearchSettings: + # Check if a SearchSettings instance with the same model_name and provider_type already exists + existing_settings = ( + db_session.query(SearchSettings) + .filter( + SearchSettings.model_name == search_settings.model_name, + SearchSettings.provider_type == search_settings.provider_type, + ) + .first() + ) + + if existing_settings: + # Update all values of the existing settings manually + existing_settings.model_dim = search_settings.model_dim + existing_settings.normalize = search_settings.normalize + existing_settings.query_prefix = search_settings.query_prefix + existing_settings.passage_prefix = search_settings.passage_prefix + existing_settings.status = status + existing_settings.index_name = search_settings.index_name + existing_settings.multipass_indexing = search_settings.multipass_indexing + existing_settings.multilingual_expansion = ( + search_settings.multilingual_expansion + ) + existing_settings.disable_rerank_for_streaming = ( + search_settings.disable_rerank_for_streaming + ) + existing_settings.rerank_model_name = search_settings.rerank_model_name + existing_settings.rerank_provider_type = search_settings.rerank_provider_type + existing_settings.rerank_api_key = search_settings.rerank_api_key + existing_settings.num_rerank = search_settings.num_rerank + + db_session.commit() + return existing_settings + embedding_model = SearchSettings( model_name=search_settings.model_name, model_dim=search_settings.model_dim, @@ -89,6 +125,47 @@ def get_current_db_embedding_provider( return current_embedding_provider +def delete_search_settings( + db_session: Session, provider_type: EmbeddingProvider | None, model_name: str +) -> None: + current_settings = get_current_search_settings(db_session) + + if ( + current_settings.provider_type == provider_type + and current_settings.model_name == model_name + ): + raise ValueError("Cannot delete currently active search settings") + + # First, delete associated index attempts + index_attempts_query = delete(IndexAttempt).where( + IndexAttempt.search_settings_id.in_( + select(SearchSettings.id).where( + and_( + SearchSettings.provider_type == provider_type, + SearchSettings.model_name == model_name, + SearchSettings.status != IndexModelStatus.PRESENT, + ) + ) + ) + ) + db_session.execute(index_attempts_query) + + # Then, delete the search settings + search_settings_query = delete(SearchSettings).where( + and_( + SearchSettings.provider_type == provider_type, + SearchSettings.model_name == model_name, + SearchSettings.status != IndexModelStatus.PRESENT, + ) + ) + + result = db_session.execute(search_settings_query) + db_session.commit() + + if result.rowcount == 0: + raise ValueError("No matching search settings found to delete") + + def get_current_search_settings(db_session: Session) -> SearchSettings: query = ( select(SearchSettings) diff --git a/backend/danswer/server/manage/embedding/models.py b/backend/danswer/server/manage/embedding/models.py index fc39721a2d6..b4ca7862b55 100644 --- a/backend/danswer/server/manage/embedding/models.py +++ b/backend/danswer/server/manage/embedding/models.py @@ -8,6 +8,10 @@ from danswer.db.models import CloudEmbeddingProvider as CloudEmbeddingProviderModel +class SearchSettingsDeleteRequest(BaseModel): + search_settings_id: int + + class TestEmbeddingRequest(BaseModel): provider_type: EmbeddingProvider api_key: str | None = None diff --git a/backend/danswer/server/manage/search_settings.py b/backend/danswer/server/manage/search_settings.py index 831528b8157..4a17784ddd6 100644 --- a/backend/danswer/server/manage/search_settings.py +++ b/backend/danswer/server/manage/search_settings.py @@ -13,7 +13,8 @@ from danswer.db.index_attempt import expire_index_attempts from danswer.db.models import IndexModelStatus from danswer.db.models import User -from danswer.db.search_settings import create_search_settings +from danswer.db.search_settings import create_or_fetch_search_settings +from danswer.db.search_settings import delete_search_settings from danswer.db.search_settings import get_current_search_settings from danswer.db.search_settings import get_embedding_provider_from_provider_type from danswer.db.search_settings import get_secondary_search_settings @@ -23,6 +24,7 @@ from danswer.natural_language_processing.search_nlp_models import clean_model_name from danswer.search.models import SavedSearchSettings from danswer.search.models import SearchSettingsCreationRequest +from danswer.server.manage.embedding.models import SearchSettingsDeleteRequest from danswer.server.manage.models import FullModelVersionResponse from danswer.server.models import IdReturn from danswer.utils.logger import setup_logger @@ -88,7 +90,7 @@ def set_new_search_settings( db_session=db_session, ) - new_search_settings = create_search_settings( + new_search_settings = create_or_fetch_search_settings( search_settings=new_search_settings_request, db_session=db_session ) @@ -97,6 +99,7 @@ def set_new_search_settings( primary_index_name=search_settings.index_name, secondary_index_name=new_search_settings.index_name, ) + document_index.ensure_indices_exist( index_embedding_dim=search_settings.model_dim, secondary_index_embedding_dim=new_search_settings.model_dim, @@ -132,6 +135,23 @@ def cancel_new_embedding( ) +@router.delete("/delete-search-settings") +def delete_search_settings_endpoint( + deletion_request: SearchSettingsDeleteRequest, + _: User | None = Depends(current_admin_user), + db_session: Session = Depends(get_session), +) -> None: + print(deletion_request) + try: + delete_search_settings( + db_session=db_session, + provider_type=deletion_request.provider_type, + model_name=deletion_request.model_name, + ) + except ValueError as e: + raise HTTPException(status_code=400, detail=str(e)) + + @router.get("/get-current-search-settings") def get_current_search_settings_endpoint( _: User | None = Depends(current_user), diff --git a/deployment/docker_compose/docker-compose.dev.yml b/deployment/docker_compose/docker-compose.dev.yml index 0f3fd40eeb9..9795a9a5878 100644 --- a/deployment/docker_compose/docker-compose.dev.yml +++ b/deployment/docker_compose/docker-compose.dev.yml @@ -282,7 +282,7 @@ services: - POSTGRES_USER=${POSTGRES_USER:-postgres} - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-password} ports: - - "5432:5432" + - "5433:5432" volumes: - db_volume:/var/lib/postgresql/data diff --git a/deployment/docker_compose/docker-compose.gpu-dev.yml b/deployment/docker_compose/docker-compose.gpu-dev.yml index ffb99534557..1b9860f2404 100644 --- a/deployment/docker_compose/docker-compose.gpu-dev.yml +++ b/deployment/docker_compose/docker-compose.gpu-dev.yml @@ -292,7 +292,7 @@ services: - POSTGRES_USER=${POSTGRES_USER:-postgres} - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-password} ports: - - "5432:5432" + - "5433:5432" volumes: - db_volume:/var/lib/postgresql/data diff --git a/deployment/docker_compose/docker-compose.search-testing.yml b/deployment/docker_compose/docker-compose.search-testing.yml index efb387eb083..34ab5278b3c 100644 --- a/deployment/docker_compose/docker-compose.search-testing.yml +++ b/deployment/docker_compose/docker-compose.search-testing.yml @@ -150,7 +150,7 @@ services: - POSTGRES_USER=${POSTGRES_USER:-postgres} - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-password} ports: - - "5432" + - "5433" volumes: - db_volume:/var/lib/postgresql/data diff --git a/web/src/app/admin/embeddings/pages/CloudEmbeddingPage.tsx b/web/src/app/admin/embeddings/pages/CloudEmbeddingPage.tsx index db2c0ad66c7..428c51f3205 100644 --- a/web/src/app/admin/embeddings/pages/CloudEmbeddingPage.tsx +++ b/web/src/app/admin/embeddings/pages/CloudEmbeddingPage.tsx @@ -12,10 +12,13 @@ import { LITELLM_CLOUD_PROVIDER, } from "../../../../components/embedding/interfaces"; import { EmbeddingDetails } from "../EmbeddingModelSelectionForm"; -import { FiExternalLink, FiInfo } from "react-icons/fi"; +import { FiExternalLink, FiInfo, FiTrash } from "react-icons/fi"; import { HoverPopup } from "@/components/HoverPopup"; import { Dispatch, SetStateAction, useEffect, useState } from "react"; import { LiteLLMModelForm } from "@/components/embedding/LiteLLMModelForm"; +import { deleteSearchSettings } from "./utils"; +import { usePopup } from "@/components/admin/connectors/Popup"; +import { DeleteEntityModal } from "@/components/modals/DeleteEntityModal"; export default function CloudEmbeddingPage({ currentModel, @@ -283,11 +286,25 @@ export function CloudModelCard({ React.SetStateAction >; }) { + const { popup, setPopup } = usePopup(); + const [showDeleteModel, setShowDeleteModel] = useState(false); const enabled = model.model_name === currentModel.model_name && model.provider_type?.toLowerCase() == currentModel.provider_type?.toLowerCase(); + const deleteModel = async () => { + const response = await deleteSearchSettings( + model.provider_type as EmbeddingProvider | null, + model.model_name + ); + if (response.ok) { + setPopup({ message: "Model deleted successfully", type: "success" }); + } else { + setPopup({ message: "Failed to delete model", type: "error" }); + } + }; + return (
+ {showDeleteModel && ( + deleteModel()} + onClose={() => setShowDeleteModel(false)} + /> + )} +

{model.model_name}

- e.stopPropagation()} - className="text-blue-500 hover:text-blue-700 transition-colors duration-200" - > - - +
+ {model.provider_type == EmbeddingProvider.LITELLM.toLowerCase() && ( + + )} + e.stopPropagation()} + className="text-blue-500 hover:text-blue-700 transition-colors duration-200" + > + + +

{model.description}

{model?.provider_type?.toLowerCase() != diff --git a/web/src/app/admin/embeddings/pages/utils.ts b/web/src/app/admin/embeddings/pages/utils.ts new file mode 100644 index 00000000000..82fff640c5d --- /dev/null +++ b/web/src/app/admin/embeddings/pages/utils.ts @@ -0,0 +1,37 @@ +// + +import { EmbeddingProvider } from "@/components/embedding/interfaces"; + +// @router.delete("/delete-search-settings") +// def delete_search_settings_endpoint( +// provider_type: EmbeddingProvider | None, +// model_name: str, +// _: User | None = Depends(current_admin_user), +// db_session: Session = Depends(get_session), +// ) -> None: +// try: +// delete_search_settings( +// db_session=db_session, +// provider_type=provider_type, +// model_name=model_name +// ) +// except ValueError as e: +// raise HTTPException(status_code=400, detail=str(e)) + +export const deleteSearchSettings = async ( + provider_type: EmbeddingProvider | null, + model_name: string +) => { + const res = await fetch(`/api/search-settings/delete-search-settings`, { + method: "DELETE", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ provider_type, model_name }), + }); + + if (!res.ok) { + throw new Error("Failed to delete search settings"); + } + return res; +}; From 1731eca24d45ea94fad841a9e4940c4d55ae61b8 Mon Sep 17 00:00:00 2001 From: pablodanswer Date: Wed, 4 Sep 2024 10:03:31 -0700 Subject: [PATCH 6/9] add abiility to delete models + more streamlined API endpoints --- backend/danswer/configs/app_configs.py | 2 +- backend/danswer/db/search_settings.py | 25 ++++++------------- backend/danswer/indexing/models.py | 2 ++ .../danswer/server/manage/search_settings.py | 6 ++--- backend/shared_configs/configs.py | 1 + .../docker_compose/docker-compose.dev.yml | 2 +- .../docker_compose/docker-compose.gpu-dev.yml | 2 +- .../docker-compose.search-testing.yml | 2 +- .../embeddings/pages/CloudEmbeddingPage.tsx | 19 ++++++++++---- web/src/app/admin/embeddings/pages/utils.ts | 15 +++-------- web/src/components/embedding/interfaces.tsx | 1 + 11 files changed, 35 insertions(+), 42 deletions(-) diff --git a/backend/danswer/configs/app_configs.py b/backend/danswer/configs/app_configs.py index e1b45409575..f6b218c5f56 100644 --- a/backend/danswer/configs/app_configs.py +++ b/backend/danswer/configs/app_configs.py @@ -134,7 +134,7 @@ os.environ.get("POSTGRES_PASSWORD") or "password" ) POSTGRES_HOST = os.environ.get("POSTGRES_HOST") or "localhost" -POSTGRES_PORT = os.environ.get("POSTGRES_PORT") or "5433" +POSTGRES_PORT = os.environ.get("POSTGRES_PORT") or "5432" POSTGRES_DB = os.environ.get("POSTGRES_DB") or "postgres" # defaults to False diff --git a/backend/danswer/db/search_settings.py b/backend/danswer/db/search_settings.py index 73305394027..d34ef22b7ca 100644 --- a/backend/danswer/db/search_settings.py +++ b/backend/danswer/db/search_settings.py @@ -125,36 +125,22 @@ def get_current_db_embedding_provider( return current_embedding_provider -def delete_search_settings( - db_session: Session, provider_type: EmbeddingProvider | None, model_name: str -) -> None: +def delete_search_settings(db_session: Session, search_settings_id: int) -> None: current_settings = get_current_search_settings(db_session) - if ( - current_settings.provider_type == provider_type - and current_settings.model_name == model_name - ): + if current_settings.id == search_settings_id: raise ValueError("Cannot delete currently active search settings") # First, delete associated index attempts index_attempts_query = delete(IndexAttempt).where( - IndexAttempt.search_settings_id.in_( - select(SearchSettings.id).where( - and_( - SearchSettings.provider_type == provider_type, - SearchSettings.model_name == model_name, - SearchSettings.status != IndexModelStatus.PRESENT, - ) - ) - ) + IndexAttempt.search_settings_id == search_settings_id ) db_session.execute(index_attempts_query) # Then, delete the search settings search_settings_query = delete(SearchSettings).where( and_( - SearchSettings.provider_type == provider_type, - SearchSettings.model_name == model_name, + SearchSettings.id == search_settings_id, SearchSettings.status != IndexModelStatus.PRESENT, ) ) @@ -165,6 +151,9 @@ def delete_search_settings( if result.rowcount == 0: raise ValueError("No matching search settings found to delete") + if result.rowcount == 0: + raise ValueError("No matching search settings found to delete") + def get_current_search_settings(db_session: Session) -> SearchSettings: query = ( diff --git a/backend/danswer/indexing/models.py b/backend/danswer/indexing/models.py index c468b9fb181..93dc0f7315d 100644 --- a/backend/danswer/indexing/models.py +++ b/backend/danswer/indexing/models.py @@ -95,6 +95,7 @@ def from_index_chunk( class EmbeddingModelDetail(BaseModel): + id: int | None = None model_name: str normalize: bool query_prefix: str | None @@ -112,6 +113,7 @@ def from_db_model( search_settings: "SearchSettings", ) -> "EmbeddingModelDetail": return cls( + id=search_settings.id, model_name=search_settings.model_name, normalize=search_settings.normalize, query_prefix=search_settings.query_prefix, diff --git a/backend/danswer/server/manage/search_settings.py b/backend/danswer/server/manage/search_settings.py index 4a17784ddd6..b5152fb0cc7 100644 --- a/backend/danswer/server/manage/search_settings.py +++ b/backend/danswer/server/manage/search_settings.py @@ -141,15 +141,13 @@ def delete_search_settings_endpoint( _: User | None = Depends(current_admin_user), db_session: Session = Depends(get_session), ) -> None: - print(deletion_request) try: delete_search_settings( db_session=db_session, - provider_type=deletion_request.provider_type, - model_name=deletion_request.model_name, + search_settings_id=deletion_request.search_settings_id, ) except ValueError as e: - raise HTTPException(status_code=400, detail=str(e)) + raise HTTPException(status_code=status.HTTP_400_BAD_REQUEST, detail=str(e)) @router.get("/get-current-search-settings") diff --git a/backend/shared_configs/configs.py b/backend/shared_configs/configs.py index 2357d96d952..f5698d6a6ff 100644 --- a/backend/shared_configs/configs.py +++ b/backend/shared_configs/configs.py @@ -58,6 +58,7 @@ # Fields which should only be set on new search setting PRESERVED_SEARCH_FIELDS = [ + "id", "provider_type", "api_key", "model_name", diff --git a/deployment/docker_compose/docker-compose.dev.yml b/deployment/docker_compose/docker-compose.dev.yml index 9795a9a5878..0f3fd40eeb9 100644 --- a/deployment/docker_compose/docker-compose.dev.yml +++ b/deployment/docker_compose/docker-compose.dev.yml @@ -282,7 +282,7 @@ services: - POSTGRES_USER=${POSTGRES_USER:-postgres} - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-password} ports: - - "5433:5432" + - "5432:5432" volumes: - db_volume:/var/lib/postgresql/data diff --git a/deployment/docker_compose/docker-compose.gpu-dev.yml b/deployment/docker_compose/docker-compose.gpu-dev.yml index 1b9860f2404..ffb99534557 100644 --- a/deployment/docker_compose/docker-compose.gpu-dev.yml +++ b/deployment/docker_compose/docker-compose.gpu-dev.yml @@ -292,7 +292,7 @@ services: - POSTGRES_USER=${POSTGRES_USER:-postgres} - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-password} ports: - - "5433:5432" + - "5432:5432" volumes: - db_volume:/var/lib/postgresql/data diff --git a/deployment/docker_compose/docker-compose.search-testing.yml b/deployment/docker_compose/docker-compose.search-testing.yml index 34ab5278b3c..efb387eb083 100644 --- a/deployment/docker_compose/docker-compose.search-testing.yml +++ b/deployment/docker_compose/docker-compose.search-testing.yml @@ -150,7 +150,7 @@ services: - POSTGRES_USER=${POSTGRES_USER:-postgres} - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-password} ports: - - "5433" + - "5432" volumes: - db_volume:/var/lib/postgresql/data diff --git a/web/src/app/admin/embeddings/pages/CloudEmbeddingPage.tsx b/web/src/app/admin/embeddings/pages/CloudEmbeddingPage.tsx index 428c51f3205..a6c71530f24 100644 --- a/web/src/app/admin/embeddings/pages/CloudEmbeddingPage.tsx +++ b/web/src/app/admin/embeddings/pages/CloudEmbeddingPage.tsx @@ -294,14 +294,22 @@ export function CloudModelCard({ currentModel.provider_type?.toLowerCase(); const deleteModel = async () => { - const response = await deleteSearchSettings( - model.provider_type as EmbeddingProvider | null, - model.model_name - ); + if (!model.id) { + setPopup({ message: "Model cannot be deleted", type: "error" }); + return; + } + + const response = await deleteSearchSettings(model.id); + if (response.ok) { setPopup({ message: "Model deleted successfully", type: "success" }); + setShowDeleteModel(false); } else { - setPopup({ message: "Failed to delete model", type: "error" }); + setPopup({ + message: + "Failed to delete model. Ensure you are not attempting to delete a curently active model.", + type: "error", + }); } }; @@ -313,6 +321,7 @@ export function CloudModelCard({ : "border-gray-300 hover:border-blue-300 hover:shadow-sm" } ${!provider.configured && "opacity-80 hover:opacity-100"}`} > + {popup} {showDeleteModel && ( { - const res = await fetch(`/api/search-settings/delete-search-settings`, { +export const deleteSearchSettings = async (search_settings_id: number) => { + const response = await fetch(`/api/search-settings/delete-search-settings`, { method: "DELETE", headers: { "Content-Type": "application/json", }, - body: JSON.stringify({ provider_type, model_name }), + body: JSON.stringify({ search_settings_id }), }); - - if (!res.ok) { - throw new Error("Failed to delete search settings"); - } - return res; + return response; }; diff --git a/web/src/components/embedding/interfaces.tsx b/web/src/components/embedding/interfaces.tsx index 0fafaa840ca..daa56128c3d 100644 --- a/web/src/components/embedding/interfaces.tsx +++ b/web/src/components/embedding/interfaces.tsx @@ -39,6 +39,7 @@ export interface CloudEmbeddingProvider { // Embedding Models export interface EmbeddingModelDescriptor { + id?: number; model_name: string; model_dim: number; normalize: boolean; From f57004faef512b0f4da703af4c766729303ee237 Mon Sep 17 00:00:00 2001 From: pablodanswer Date: Wed, 4 Sep 2024 10:10:21 -0700 Subject: [PATCH 7/9] remove upsert --- backend/danswer/db/search_settings.py | 35 +------------------ .../danswer/server/manage/search_settings.py | 4 +-- 2 files changed, 3 insertions(+), 36 deletions(-) diff --git a/backend/danswer/db/search_settings.py b/backend/danswer/db/search_settings.py index d34ef22b7ca..23729841b28 100644 --- a/backend/danswer/db/search_settings.py +++ b/backend/danswer/db/search_settings.py @@ -31,44 +31,11 @@ logger = setup_logger() -def create_or_fetch_search_settings( +def create_search_settings( search_settings: SavedSearchSettings, db_session: Session, status: IndexModelStatus = IndexModelStatus.FUTURE, ) -> SearchSettings: - # Check if a SearchSettings instance with the same model_name and provider_type already exists - existing_settings = ( - db_session.query(SearchSettings) - .filter( - SearchSettings.model_name == search_settings.model_name, - SearchSettings.provider_type == search_settings.provider_type, - ) - .first() - ) - - if existing_settings: - # Update all values of the existing settings manually - existing_settings.model_dim = search_settings.model_dim - existing_settings.normalize = search_settings.normalize - existing_settings.query_prefix = search_settings.query_prefix - existing_settings.passage_prefix = search_settings.passage_prefix - existing_settings.status = status - existing_settings.index_name = search_settings.index_name - existing_settings.multipass_indexing = search_settings.multipass_indexing - existing_settings.multilingual_expansion = ( - search_settings.multilingual_expansion - ) - existing_settings.disable_rerank_for_streaming = ( - search_settings.disable_rerank_for_streaming - ) - existing_settings.rerank_model_name = search_settings.rerank_model_name - existing_settings.rerank_provider_type = search_settings.rerank_provider_type - existing_settings.rerank_api_key = search_settings.rerank_api_key - existing_settings.num_rerank = search_settings.num_rerank - - db_session.commit() - return existing_settings - embedding_model = SearchSettings( model_name=search_settings.model_name, model_dim=search_settings.model_dim, diff --git a/backend/danswer/server/manage/search_settings.py b/backend/danswer/server/manage/search_settings.py index b5152fb0cc7..c8433467f6c 100644 --- a/backend/danswer/server/manage/search_settings.py +++ b/backend/danswer/server/manage/search_settings.py @@ -13,7 +13,7 @@ from danswer.db.index_attempt import expire_index_attempts from danswer.db.models import IndexModelStatus from danswer.db.models import User -from danswer.db.search_settings import create_or_fetch_search_settings +from danswer.db.search_settings import create_search_settings from danswer.db.search_settings import delete_search_settings from danswer.db.search_settings import get_current_search_settings from danswer.db.search_settings import get_embedding_provider_from_provider_type @@ -90,7 +90,7 @@ def set_new_search_settings( db_session=db_session, ) - new_search_settings = create_or_fetch_search_settings( + new_search_settings = create_search_settings( search_settings=new_search_settings_request, db_session=db_session ) From fe2af9eb7bc096ccf4d3bd6896f0fbf247b1c6b4 Mon Sep 17 00:00:00 2001 From: pablodanswer Date: Wed, 4 Sep 2024 10:13:05 -0700 Subject: [PATCH 8/9] minor typing fix --- backend/danswer/db/search_settings.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/backend/danswer/db/search_settings.py b/backend/danswer/db/search_settings.py index 23729841b28..01f458493f7 100644 --- a/backend/danswer/db/search_settings.py +++ b/backend/danswer/db/search_settings.py @@ -112,15 +112,9 @@ def delete_search_settings(db_session: Session, search_settings_id: int) -> None ) ) - result = db_session.execute(search_settings_query) + db_session.execute(search_settings_query) db_session.commit() - if result.rowcount == 0: - raise ValueError("No matching search settings found to delete") - - if result.rowcount == 0: - raise ValueError("No matching search settings found to delete") - def get_current_search_settings(db_session: Session) -> SearchSettings: query = ( From 33825c93c0241363cfa59a8d8ba1adf26378e443 Mon Sep 17 00:00:00 2001 From: pablodanswer Date: Wed, 4 Sep 2024 13:38:53 -0700 Subject: [PATCH 9/9] add connector utils --- .../[connector]/AddConnectorPage.tsx | 2 +- .../modals/ProviderCreationModal.tsx | 2 +- web/src/app/admin/embeddings/pages/utils.ts | 20 ------------------- 3 files changed, 2 insertions(+), 22 deletions(-) diff --git a/web/src/app/admin/connectors/[connector]/AddConnectorPage.tsx b/web/src/app/admin/connectors/[connector]/AddConnectorPage.tsx index fa088caf886..3c919e64e31 100644 --- a/web/src/app/admin/connectors/[connector]/AddConnectorPage.tsx +++ b/web/src/app/admin/connectors/[connector]/AddConnectorPage.tsx @@ -91,7 +91,7 @@ export default function AddConnector({ >({ name: "", groups: [], - is_public: false, + is_public: true, ...configuration.values.reduce( (acc, field) => { if (field.type === "list") { diff --git a/web/src/app/admin/embeddings/modals/ProviderCreationModal.tsx b/web/src/app/admin/embeddings/modals/ProviderCreationModal.tsx index c3a50731c07..54ca5d72e78 100644 --- a/web/src/app/admin/embeddings/modals/ProviderCreationModal.tsx +++ b/web/src/app/admin/embeddings/modals/ProviderCreationModal.tsx @@ -221,7 +221,7 @@ export function ProviderCreationModal({ )} diff --git a/web/src/app/admin/embeddings/pages/utils.ts b/web/src/app/admin/embeddings/pages/utils.ts index 4e4acb3a14f..86af49522b4 100644 --- a/web/src/app/admin/embeddings/pages/utils.ts +++ b/web/src/app/admin/embeddings/pages/utils.ts @@ -1,23 +1,3 @@ -// - -import { EmbeddingProvider } from "@/components/embedding/interfaces"; - -// @router.delete("/delete-search-settings") -// def delete_search_settings_endpoint( -// provider_type: EmbeddingProvider | None, -// model_name: str, -// _: User | None = Depends(current_admin_user), -// db_session: Session = Depends(get_session), -// ) -> None: -// try: -// delete_search_settings( -// db_session=db_session, -// provider_type=provider_type, -// model_name=model_name -// ) -// except ValueError as e: -// raise HTTPException(status_code=400, detail=str(e)) - export const deleteSearchSettings = async (search_settings_id: number) => { const response = await fetch(`/api/search-settings/delete-search-settings`, { method: "DELETE",