diff --git a/frontend/src/components/WorkspaceChat/ChatContainer/MetaInputs/index.jsx b/frontend/src/components/WorkspaceChat/ChatContainer/MetaInputs/index.jsx index 249b5af2..05d36a4d 100644 --- a/frontend/src/components/WorkspaceChat/ChatContainer/MetaInputs/index.jsx +++ b/frontend/src/components/WorkspaceChat/ChatContainer/MetaInputs/index.jsx @@ -27,7 +27,6 @@ const inputComponents = { const MetaInputs = ({ inputs, - isMetaInputs, submit, setMessage, workspace, @@ -51,9 +50,7 @@ const MetaInputs = ({ // Condition to show the dynamic input or the forced text input const shouldShowMetaInputs = - workspace?.metaResponse && inputs !== undefined && !isForcedTextInput - - + workspace?.metaResponse && inputs !== undefined && !isForcedTextInput; return (
diff --git a/frontend/src/pages/WorkspaceSettings/ChatSettings/ChatEnableMetaResponse/index.jsx b/frontend/src/pages/WorkspaceSettings/ChatSettings/ChatEnableMetaResponse/index.jsx index d6434405..6d0da1e6 100644 --- a/frontend/src/pages/WorkspaceSettings/ChatSettings/ChatEnableMetaResponse/index.jsx +++ b/frontend/src/pages/WorkspaceSettings/ChatSettings/ChatEnableMetaResponse/index.jsx @@ -15,9 +15,9 @@ export default function ChatEnableMetaResponse({ workspace, setHasChanges }) { } onToggle={toggleMetaResponse} name="metaResponse" - description="Turn on this feature to dynamically adjust the chat interface based on conversation context, using options like dropdowns, sliders, and suggestions for a tailored user experience." - // badge - // badgeLabel="New" + description="Turn on this feature to dynamically adjust the chat interface based on conversation context, using options like dropdowns, sliders, and suggestions for a tailored user experience. For Better experience, use GPT-4 or any advanced LLM model." + badge + badgeLabel="New" // badgeAnimated />
diff --git a/frontend/src/pages/WorkspaceSettings/MetaResponse/FeatureSettings/EnableSystemPrompt/index.jsx b/frontend/src/pages/WorkspaceSettings/MetaResponse/FeatureSettings/EnableSystemPrompt/index.jsx index 652ce9ec..be762ed3 100644 --- a/frontend/src/pages/WorkspaceSettings/MetaResponse/FeatureSettings/EnableSystemPrompt/index.jsx +++ b/frontend/src/pages/WorkspaceSettings/MetaResponse/FeatureSettings/EnableSystemPrompt/index.jsx @@ -9,7 +9,9 @@ export default function EnableSystemPrompt({ }) { const [isEnabled, setIsEnabled] = useState( settings.config.systemPrompt.isEnabled || - settings.config.systemPrompt.content !== "" + settings.config.systemPrompt.list[ + settings.config.systemPrompt.active + ].content ); const toggleSystemPrompt = () => { @@ -47,6 +49,9 @@ export default function EnableSystemPrompt({ description="Specify the context and instructions for the AI in this workspace. A well-defined prompt ensures the AI delivers relevant and precise responses." inline content={content} + disabled={settings.config.systemPrompt.list[ + settings.config.systemPrompt.active + ].content} /> ); diff --git a/frontend/src/pages/WorkspaceSettings/MetaResponse/FeatureSettings/index.jsx b/frontend/src/pages/WorkspaceSettings/MetaResponse/FeatureSettings/index.jsx index 0e6502b8..5dd247d1 100644 --- a/frontend/src/pages/WorkspaceSettings/MetaResponse/FeatureSettings/index.jsx +++ b/frontend/src/pages/WorkspaceSettings/MetaResponse/FeatureSettings/index.jsx @@ -20,10 +20,12 @@ export default function FeatureSettings({ settings={settings} onUpdateSettings={onUpdateSettings} /> - {settings.config.systemPrompt.content !== "" || + {settings.config.systemPrompt.list[ + settings.config.systemPrompt.active + ].content || settings.config.systemPrompt.isEnabled ? (
- + /> */} +
+
+ {settings.config.systemPrompt.list.map((item, index) => ( + { + e.stopPropagation(); + console.log("selected item", item); + onUpdateSettings({ + ...settings, + config: { + ...settings.config, + systemPrompt: { + ...settings.config.systemPrompt, + active: index, + }, + }, + }); + showToast( + `Schema ${item.title} has been selected`, + "success", + { clear: true } + ); + } + } + onDoubleClick={() => { + // rename item + console.log("renaming item", item); + const newSchemas = settings.config.systemPrompt.list.map( + (s, i) => { + if (i === index) { + return { + ...s, + title: + prompt("Enter new item title", s.title) || + s.title, + }; + } + return s; + } + ); + console.log("New item", newSchemas); + onUpdateSettings({ + ...settings, + config: { + ...settings.config, + systemPrompt: { + ...settings.config.systemPrompt, + list: newSchemas, + }, + }, + }); + }} + onClose={(e) => { + e.stopPropagation(); + if (settings.config.systemPrompt.list.length === 1) { + showToast("Cannot remove last schema", "error", { + clear: true, + }); + return; + } + const newSchemas = + settings.config.systemPrompt.list.filter( + (_, i) => i !== index + ); + const active = settings.config.systemPrompt.active; + const newActive = active === index ? active - 1 : active; + onUpdateSettings({ + ...settings, + config: { + ...settings.config, + systemPrompt: { + ...settings.config.systemPrompt, + list: newSchemas, + active: newActive, + }, + }, + }); + showToast( + `Schema ${item.title} has been removed`, + "success", + { + clear: true, + } + ); + }} + /> + ))} +
+