diff --git a/frontend/src/components/EmbeddingSelection/LocalAiOptions/index.jsx b/frontend/src/components/EmbeddingSelection/LocalAiOptions/index.jsx
index d75da68b..988eebac 100644
--- a/frontend/src/components/EmbeddingSelection/LocalAiOptions/index.jsx
+++ b/frontend/src/components/EmbeddingSelection/LocalAiOptions/index.jsx
@@ -1,41 +1,36 @@
import React, { useEffect, useState } from "react";
+import { CaretDown, CaretUp } from "@phosphor-icons/react";
import System from "@/models/system";
+import PreLoader from "@/components/Preloader";
+import { LOCALAI_COMMON_URLS } from "@/utils/constants";
+import useProviderEndpointAutoDiscovery from "@/hooks/useProviderEndpointAutoDiscovery";
export default function LocalAiOptions({ settings }) {
- const [basePathValue, setBasePathValue] = useState(
- settings?.EmbeddingBasePath
- );
- const [basePath, setBasePath] = useState(settings?.EmbeddingBasePath);
+ const {
+ autoDetecting: loading,
+ basePath,
+ basePathValue,
+ showAdvancedControls,
+ setShowAdvancedControls,
+ handleAutoDetectClick,
+ } = useProviderEndpointAutoDiscovery({
+ provider: "localai",
+ initialBasePath: settings?.EmbeddingBasePath,
+ ENDPOINTS: LOCALAI_COMMON_URLS,
+ });
const [apiKeyValue, setApiKeyValue] = useState(settings?.LocalAiApiKey);
const [apiKey, setApiKey] = useState(settings?.LocalAiApiKey);
return (
-
-
+
+
+
+
+
+
+
+
+
+ {loading ? (
+
+ ) : (
+ <>
+ {!basePathValue.value && (
+
+ )}
+ >
+ )}
+
+
+
+
+
);
}
@@ -102,7 +148,7 @@ function LocalAIModelSelection({ settings, apiKey = null, basePath = null }) {
if (loading || customModels.length == 0) {
return (
-