diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index 7a1395f1..7633af2c 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -57,6 +57,10 @@ export default function App() { } /> } /> + } + /> } @@ -68,10 +72,6 @@ export default function App() { } /> {/* Admin */} - } - /> } diff --git a/frontend/src/components/Modals/MangeWorkspace/Documents/index.jsx b/frontend/src/components/Modals/MangeWorkspace/Documents/index.jsx index c5a66748..705e78fa 100644 --- a/frontend/src/components/Modals/MangeWorkspace/Documents/index.jsx +++ b/frontend/src/components/Modals/MangeWorkspace/Documents/index.jsx @@ -195,7 +195,7 @@ export default function DocumentSettings({ }; return ( -
+
-
- -

- The specific chat model that will be used for this workspace. If - empty, will use the system LLM preference. -

-
- -
- ); - } - - return ( -
-
- -

- The specific chat model that will be used for this workspace. If - empty, will use the system LLM preference. -

-
- - -
- ); -} diff --git a/frontend/src/components/Modals/MangeWorkspace/Settings/index.jsx b/frontend/src/components/Modals/MangeWorkspace/Settings/index.jsx deleted file mode 100644 index 48a3ff5d..00000000 --- a/frontend/src/components/Modals/MangeWorkspace/Settings/index.jsx +++ /dev/null @@ -1,387 +0,0 @@ -import React, { useState, useRef, useEffect } from "react"; -import Workspace from "../../../../models/workspace"; -import paths from "../../../../utils/paths"; -import { chatPrompt } from "../../../../utils/chat"; -import System from "../../../../models/system"; -import PreLoader from "../../../Preloader"; -import { useParams } from "react-router-dom"; -import showToast from "../../../../utils/toast"; -import ChatModelPreference from "./ChatModelPreference"; -import { Link } from "react-router-dom"; - -// Ensure that a type is correct before sending the body -// to the backend. -function castToType(key, value) { - const definitions = { - openAiTemp: { - cast: (value) => Number(value), - }, - openAiHistory: { - cast: (value) => Number(value), - }, - similarityThreshold: { - cast: (value) => parseFloat(value), - }, - topN: { - cast: (value) => Number(value), - }, - }; - - if (!definitions.hasOwnProperty(key)) return value; - return definitions[key].cast(value); -} - -function recommendedSettings(provider = null) { - switch (provider) { - case "mistral": - return { temp: 0 }; - default: - return { temp: 0.7 }; - } -} - -export default function WorkspaceSettings({ active, workspace, settings }) { - const { slug } = useParams(); - const formEl = useRef(null); - const [saving, setSaving] = useState(false); - const [hasChanges, setHasChanges] = useState(false); - const [deleting, setDeleting] = useState(false); - const defaults = recommendedSettings(settings?.LLMProvider); - - const handleUpdate = async (e) => { - setSaving(true); - e.preventDefault(); - const data = {}; - const form = new FormData(formEl.current); - for (var [key, value] of form.entries()) data[key] = castToType(key, value); - const { workspace: updatedWorkspace, message } = await Workspace.update( - workspace.slug, - data - ); - if (!!updatedWorkspace) { - showToast("Workspace updated!", "success", { clear: true }); - } else { - showToast(`Error: ${message}`, "error", { clear: true }); - } - setSaving(false); - setHasChanges(false); - }; - - const deleteWorkspace = async () => { - if ( - !window.confirm( - `You are about to delete your entire ${workspace.name} workspace. This will remove all vector embeddings on your vector database.\n\nThe original source files will remain untouched. This action is irreversible.` - ) - ) - return false; - - setDeleting(true); - const success = await Workspace.delete(workspace.slug); - if (!success) { - showToast("Workspace could not be deleted!", "error", { clear: true }); - setDeleting(false); - return; - } - - workspace.slug === slug - ? (window.location = paths.home()) - : window.location.reload(); - }; - - return ( -
-
-
-
- Workspace Settings -
-
-
-

- Vector database identifier -

-

- {" "} -

-

- {workspace?.slug} -

-
- -
-

- Number of vectors -

-

- Total number of vectors in your vector database. -

- -
-
-
-
-
-
-
- -
-
- -

- This will only change the display name of your workspace. -

-
- setHasChanges(true)} - /> -
- -
-
- -

- This setting controls how "random" or dynamic your chat - responses will be. -
- The higher the number (1.0 maximum) the more random and - incoherent. -
- Recommended: {defaults.temp} -

-
- e.target.blur()} - defaultValue={workspace?.openAiTemp ?? defaults.temp} - className="bg-zinc-900 text-white text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5" - placeholder="0.7" - required={true} - autoComplete="off" - onChange={() => setHasChanges(true)} - /> -
- -
-
- -

- The number of previous chats that will be included in the - response's short-term memory. - Recommend 20. - Anything more than 45 is likely to lead to continuous chat - failures depending on message size. -

-
- e.target.blur()} - defaultValue={workspace?.openAiHistory ?? 20} - className="bg-zinc-900 text-white text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5" - placeholder="20" - required={true} - autoComplete="off" - onChange={() => setHasChanges(true)} - /> -
-
-
- -
-
-
- -

- The prompt that will be used on this workspace. Define the - context and instructions for the AI to generate a response. - You should to provide a carefully crafted prompt so the AI - can generate a relevant and accurate response. -

-
-