diff --git a/frontend/src/components/Generic/Blocks/TitleBlock/index.jsx b/frontend/src/components/Generic/Blocks/TitleBlock/index.jsx new file mode 100644 index 00000000..8891b7f0 --- /dev/null +++ b/frontend/src/components/Generic/Blocks/TitleBlock/index.jsx @@ -0,0 +1,60 @@ +import Badge from "@/components/Generic/Badges/Badge"; +import React from "react"; + +export default function TitleBlock({ + content, // toggle content goes here + label, + description, + badge = false, + badgeLabel, + badgeAnimated, + badgeBg, + border, + bg, + Icon, + labelStyles, +}) { + const borderStyle = border ? "border border-gray-600 rounded-2xl p-4" : ""; + const backgroundStyle = bg ? "bg-black/10" : ""; + + return ( +
+
+
+
+
+ {Icon && } +
+
+ + {badge && ( + + )} +
+
+
+
+
+
+

+ {description} +

+
+ {content} +
+
+ ); +} diff --git a/frontend/src/components/WorkspaceChat/index.jsx b/frontend/src/components/WorkspaceChat/index.jsx index 1c31c7e6..de8b3d2c 100644 --- a/frontend/src/components/WorkspaceChat/index.jsx +++ b/frontend/src/components/WorkspaceChat/index.jsx @@ -6,6 +6,7 @@ import { useParams } from "react-router-dom"; import ModalWrapper from "../ModalWrapper"; import ChatContainer from "./ChatContainer"; import LoadingChat from "./LoadingChat"; +import MetaResponse from "@/models/metaResponse"; export default function WorkspaceChat({ loading, workspace }) { const { threadSlug = null } = useParams(); @@ -27,19 +28,26 @@ export default function WorkspaceChat({ loading, workspace }) { ? await Workspace.threads.chatHistory(workspace.slug, threadSlug) : await Workspace.chatHistory(workspace.slug); - // TODO: add conditional if dynamic input is enabled in the workspace by default is false // Append metadata to the chat history - if (isMetaInputs) { - chatHistory = chatHistory.map((message) => { - if (message.role === "assistant") { - const { remainingText, metaData } = extractMetaData( - message.content - ); - setCurrentInputMeta(metaData); - return { ...message, content: remainingText, metaData }; - } - return message; - }); + if (workspace?.metaResponse) { + let metaResponseSettings = await MetaResponse.getMetaResponseSettings( + workspace.slug + ); + + console.log("meta Response Settings:", metaResponseSettings); + if (Object.values(metaResponseSettings).some((settings) => settings.isEnabled) + ) { + chatHistory = chatHistory.map((message) => { + if (message.role === "assistant") { + const { remainingText, metaData } = extractMetaData( + message.content + ); + setCurrentInputMeta(metaData); + return { ...message, content: remainingText, metaData }; + } + return message; + }); + } } setHistory(chatHistory); diff --git a/frontend/src/pages/WorkspaceSettings/MetaResponse/FeatureSettings/EnableComponent/index.jsx b/frontend/src/pages/WorkspaceSettings/MetaResponse/FeatureSettings/EnableComponent/index.jsx new file mode 100644 index 00000000..a31da2dc --- /dev/null +++ b/frontend/src/pages/WorkspaceSettings/MetaResponse/FeatureSettings/EnableComponent/index.jsx @@ -0,0 +1,29 @@ +import ToggleBlock from "@/components/Generic/Blocks/ToggleBlock"; + +export default function EnableComponent({ + component, + isEnabled, + description, + onToggle, + Icon, + content, + disabled, + bg, +}) { + return ( +
+ +
+ ); +} diff --git a/frontend/src/pages/WorkspaceSettings/MetaResponse/InputsFeature/EnableSystemPrompt/index.jsx b/frontend/src/pages/WorkspaceSettings/MetaResponse/FeatureSettings/EnableSystemPrompt/index.jsx similarity index 100% rename from frontend/src/pages/WorkspaceSettings/MetaResponse/InputsFeature/EnableSystemPrompt/index.jsx rename to frontend/src/pages/WorkspaceSettings/MetaResponse/FeatureSettings/EnableSystemPrompt/index.jsx diff --git a/frontend/src/pages/WorkspaceSettings/MetaResponse/FeatureSettings/index.jsx b/frontend/src/pages/WorkspaceSettings/MetaResponse/FeatureSettings/index.jsx new file mode 100644 index 00000000..d2711d82 --- /dev/null +++ b/frontend/src/pages/WorkspaceSettings/MetaResponse/FeatureSettings/index.jsx @@ -0,0 +1,100 @@ +import TextAreaBlock from "@/components/Generic/Blocks/TextAreaBlock"; +import EnableSystemPrompt from "./EnableSystemPrompt"; +import CheckBoxBlock from "@/components/Generic/Blocks/CheckBoxBlock"; +import TitleBlock from "@/components/Generic/Blocks/TitleBlock"; +import ToggleBlock from "@/components/Generic/Blocks/ToggleBlock"; +import TextArea from "@/components/Generic/Inputs/TextArea"; + +export default function FeatureSettings({ + workspace, + settings, + onUpdateSettings, +}) { + return ( +
+ + {settings.config.systemPrompt.isEnabled && ( + <> + + + + )} + +