Skip to content

Commit

Permalink
remove logs + validate functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
pablonyx committed Sep 2, 2024
1 parent a7fe599 commit d4a18d5
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 25 deletions.
5 changes: 2 additions & 3 deletions backend/danswer/server/manage/embedding/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ def test_embedding_configuration(
test_llm_request: TestEmbeddingRequest,
_: User | None = Depends(current_admin_user),
) -> None:
print(test_llm_request)
try:
test_model = EmbeddingModel(
server_host=MODEL_SERVER_HOST,
Expand All @@ -61,8 +60,8 @@ def test_embedding_configuration(
raise HTTPException(status_code=400, detail=error_msg)


@admin_router.get("/search-settings", response_model=list[EmbeddingModelDetail])
def list_search_settings(
@admin_router.get("", response_model=list[EmbeddingModelDetail])
def list_embedding_models(
_: User | None = Depends(current_admin_user),
db_session: Session = Depends(get_session),
) -> list[EmbeddingModelDetail]:
Expand Down
4 changes: 2 additions & 2 deletions backend/danswer/server/manage/search_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def cancel_new_embedding(


@router.get("/get-current-search-settings")
def get_curr_search_settings(
def get_current_search_settings_endpoint(
_: User | None = Depends(current_user),
db_session: Session = Depends(get_session),
) -> SavedSearchSettings:
Expand All @@ -142,7 +142,7 @@ def get_curr_search_settings(


@router.get("/get-secondary-search-settings")
def get_sec_search_settings(
def get_secondary_search_settings_endpoint(
_: User | None = Depends(current_user),
db_session: Session = Depends(get_session),
) -> SavedSearchSettings | None:
Expand Down
3 changes: 1 addition & 2 deletions web/src/app/admin/configuration/llm/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@ export const LLM_PROVIDERS_ADMIN_URL = "/api/admin/llm/provider";
export const EMBEDDING_PROVIDERS_ADMIN_URL =
"/api/admin/embedding/embedding-provider";

export const EMBEDDING_MODELS_ADMIN_URL =
"/api/admin/embedding/search-settings";
export const EMBEDDING_MODELS_ADMIN_URL = "/api/admin/embedding";
11 changes: 5 additions & 6 deletions web/src/app/admin/embeddings/EmbeddingModelSelectionForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,23 +81,22 @@ export function EmbeddingModelSelection({

const [showDeleteCredentialsModal, setShowDeleteCredentialsModal] =
useState<boolean>(false);

const [showAddConnectorPopup, setShowAddConnectorPopup] =
useState<boolean>(false);

const { data: embeddingModelDetails } = useSWR<CloudEmbeddingModel[]>(
EMBEDDING_MODELS_ADMIN_URL,
errorHandlingFetcher
errorHandlingFetcher,
{ refreshInterval: 5000 } // 5 seconds
);

console.log(embeddingModelDetails);

const { data: embeddingProviderDetails } = useSWR<EmbeddingDetails[]>(
EMBEDDING_PROVIDERS_ADMIN_URL,
errorHandlingFetcher
errorHandlingFetcher,
{ refreshInterval: 5000 } // 5 seconds
);

console.log(embeddingProviderDetails);

const { data: connectors } = useSWR<Connector<any>[]>(
"/api/manage/connector",
errorHandlingFetcher,
Expand Down
28 changes: 16 additions & 12 deletions web/src/app/admin/embeddings/pages/CloudEmbeddingPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
import { EmbeddingDetails } from "../EmbeddingModelSelectionForm";
import { FiExternalLink, FiInfo } from "react-icons/fi";
import { HoverPopup } from "@/components/HoverPopup";
import { Dispatch, SetStateAction, useState } from "react";
import { Dispatch, SetStateAction, useEffect, useState } from "react";
import { LiteLLMModelForm } from "@/components/embedding/LiteLLMModelForm";

export default function CloudEmbeddingPage({
Expand Down Expand Up @@ -66,13 +66,17 @@ export default function CloudEmbeddingPage({
))!),
})
);
const liteLLMProvider = embeddingProviderDetails?.find(
(provider) =>
provider.provider_type === EmbeddingProvider.LITELLM.toLowerCase()
);
console.log("embeddingProviderDetails");
console.log(embeddingProviderDetails);
console.log(liteLLMProvider);
const [liteLLMProvider, setLiteLLMProvider] = useState<
EmbeddingDetails | undefined
>(undefined);

useEffect(() => {
const foundProvider = embeddingProviderDetails?.find(
(provider) =>
provider.provider_type === EmbeddingProvider.LITELLM.toLowerCase()
);
setLiteLLMProvider(foundProvider);
}, [embeddingProviderDetails]);

return (
<div>
Expand Down Expand Up @@ -198,14 +202,14 @@ export default function CloudEmbeddingPage({
</Text>
<Text className="text-sm text-gray-600 mb-4">
Before you can add models, you need to provide an API URL
for your LiteLLM proxy. Click the "Provide API URL" button
above to set up your LiteLLM configuration.
for your LiteLLM proxy. Click the &quot;Provide API
URL&quot; button above to set up your LiteLLM configuration.
</Text>
<div className="flex items-center">
<FiInfo className="text-blue-500 mr-2" size={18} />
<Text className="text-sm text-blue-500">
Once configured, you'll be able to add and manage your
LiteLLM models here.
Once configured, you&apos;ll be able to add and manage
your LiteLLM models here.
</Text>
</div>
</div>
Expand Down

0 comments on commit d4a18d5

Please sign in to comment.