);
diff --git a/frontend/src/pages/WorkspaceSettings/ChatSettings/ChatPromptSettings/index.jsx b/frontend/src/pages/WorkspaceSettings/ChatSettings/ChatPromptSettings/index.jsx
index 48ad4630..b77112aa 100644
--- a/frontend/src/pages/WorkspaceSettings/ChatSettings/ChatPromptSettings/index.jsx
+++ b/frontend/src/pages/WorkspaceSettings/ChatSettings/ChatPromptSettings/index.jsx
@@ -1,11 +1,44 @@
+import Button from "@/components/Generic/Buttons/Button";
import { chatPrompt } from "@/utils/chat";
+import { useEffect, useState } from "react";
export default function ChatPromptSettings({ workspace, setHasChanges }) {
+ const [settings, setSettings] = useState(
+ JSON.parse(workspace.metaResponseSettings)
+ );
+ const [textareaSettings, setTextareaSettings] = useState({
+ isDisabled: false,
+ message: "",
+ disableClasses: "",
+ });
+
+ useEffect(() => {
+ console.log("ChatPromptSettings: ", settings);
+ if (
+ workspace.metaResponse &&
+ Object.keys(settings).length > 0 &&
+ Object.values(settings).some((feature) => feature.isEnabled)
+ ) {
+ console.log("Prompt is managed by Meta Response");
+ setTextareaSettings({
+ ...textareaSettings,
+ isDisabled: true,
+ message: "(Prompt is managed now by Meta Response)",
+ disableClasses: "cursor-not-allowed bg-zinc-900 text-white/40",
+ });
+ }
+ }, [settings]);
+
return (
-
+
The prompt that will be used on this workspace. Define the context and
@@ -18,12 +51,17 @@ export default function ChatPromptSettings({ workspace, setHasChanges }) {
name="openAiPrompt"
rows={5}
defaultValue={chatPrompt(workspace)}
- className="bg-zinc-900 placeholder:text-white/20 text-white text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 mt-2"
+ className={`${
+ textareaSettings.isDisabled
+ ? textareaSettings.disableClasses
+ : " bg-zinc-900"
+ } text-white placeholder:text-white/20 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 mt-2`}
placeholder="Given the following conversation, relevant context, and a follow up question, reply with an answer to the current question the user is asking. Return only your response to the question given the above information following the users instructions as needed."
required={true}
wrap="soft"
autoComplete="off"
onChange={() => setHasChanges(true)}
+ disabled={textareaSettings.isDisabled}
/>
);
diff --git a/frontend/src/pages/WorkspaceSettings/ChatSettings/index.jsx b/frontend/src/pages/WorkspaceSettings/ChatSettings/index.jsx
index 804034c6..d65fe8ff 100644
--- a/frontend/src/pages/WorkspaceSettings/ChatSettings/index.jsx
+++ b/frontend/src/pages/WorkspaceSettings/ChatSettings/index.jsx
@@ -76,7 +76,6 @@ export default function ChatSettings({ workspace, setWorkspace }) {
/>
{hasChanges && (
diff --git a/frontend/src/pages/WorkspaceSettings/MetaResponse/FeatureSettings/EnableSystemPrompt/index.jsx b/frontend/src/pages/WorkspaceSettings/MetaResponse/FeatureSettings/EnableSystemPrompt/index.jsx
index 557c354e..652ce9ec 100644
--- a/frontend/src/pages/WorkspaceSettings/MetaResponse/FeatureSettings/EnableSystemPrompt/index.jsx
+++ b/frontend/src/pages/WorkspaceSettings/MetaResponse/FeatureSettings/EnableSystemPrompt/index.jsx
@@ -2,10 +2,16 @@ import ToggleBlock from "@/components/Generic/Blocks/ToggleBlock";
import showToast from "@/utils/toast";
import { useState } from "react";
-export default function EnableSystemPrompt({ settings, onUpdateSettings }) {
+export default function EnableSystemPrompt({
+ settings,
+ onUpdateSettings,
+ content,
+}) {
const [isEnabled, setIsEnabled] = useState(
- settings.config.systemPrompt.isEnabled
+ settings.config.systemPrompt.isEnabled ||
+ settings.config.systemPrompt.content !== ""
);
+
const toggleSystemPrompt = () => {
onUpdateSettings({
...settings,
@@ -30,16 +36,17 @@ export default function EnableSystemPrompt({ settings, onUpdateSettings }) {
return (
);
diff --git a/frontend/src/pages/WorkspaceSettings/MetaResponse/FeatureSettings/index.jsx b/frontend/src/pages/WorkspaceSettings/MetaResponse/FeatureSettings/index.jsx
index 699a79f6..0e6502b8 100644
--- a/frontend/src/pages/WorkspaceSettings/MetaResponse/FeatureSettings/index.jsx
+++ b/frontend/src/pages/WorkspaceSettings/MetaResponse/FeatureSettings/index.jsx
@@ -1,10 +1,11 @@
+import Badge from "@/components/Generic/Badges/Badge";
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 Button from "@/components/Generic/Buttons/Button";
import TextArea from "@/components/Generic/Inputs/TextArea";
-import Badge from "@/components/Generic/Badges/Badge";
+import showToast from "@/utils/toast";
+import EnableSystemPrompt from "./EnableSystemPrompt";
export default function FeatureSettings({
workspace,
@@ -19,15 +20,14 @@ export default function FeatureSettings({
settings={settings}
onUpdateSettings={onUpdateSettings}
/>
- {settings.config.systemPrompt.isEnabled && (
+ {settings.config.systemPrompt.content !== "" ||
+ settings.config.systemPrompt.isEnabled ? (
+ value={settings.config.systemPrompt.content}
+ onSave={(newContent) => {
onUpdateSettings({
...settings,
config: {
@@ -37,63 +37,171 @@ export default function FeatureSettings({
content: newContent,
},
},
- })
- }
+ });
+ }}
code
initialRows={6}
/>
-
+
+ ) : null}
+
+
+
+
+ {settings.config.promptSchema.list.map((item, index) => (
+ {
+ e.stopPropagation();
+ console.log("selected item", item);
+ onUpdateSettings({
+ ...settings,
+ config: {
+ ...settings.config,
+ promptSchema: {
+ ...settings.config.promptSchema,
+ active: index,
+ },
+ },
+ });
+ showToast(
+ `Schema ${item.title} has been selected`,
+ "success",
+ { clear: true }
+ );
+ }
+ }
+ onDoubleClick={() => {
+ // rename item
+ console.log("renaming item", item);
+ const newSchemas = settings.config.promptSchema.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,
- override,
+ promptSchema: {
+ ...settings.config.promptSchema,
+ list: newSchemas,
},
},
- })
- }
- />
-
- )}
-
-
-
-
- {settings.config.promptSchema.schemas.map((schema, index) => (
- {
+ e.stopPropagation();
+ if (settings.config.promptSchema.list.length === 1) {
+ showToast("Cannot remove last schema", "error", {
+ clear: true,
+ });
+ return;
+ }
+ const newSchemas = settings.config.promptSchema.list.filter(
+ (_, i) => i !== index
+ );
+ const active = settings.config.promptSchema.active;
+ const newActive = active === index ? active - 1 : active;
+ onUpdateSettings({
+ ...settings,
+ config: {
+ ...settings.config,
+ promptSchema: {
+ ...settings.config.promptSchema,
+ list: newSchemas,
+ active: newActive,
+ },
+ },
+ });
+ showToast(`Schema ${item.title} has been removed`, "success", {
+ clear: true,
+ });
+ }}
/>
))}
+
);
diff --git a/frontend/src/pages/WorkspaceSettings/MetaResponse/index.jsx b/frontend/src/pages/WorkspaceSettings/MetaResponse/index.jsx
index 87f7ff2d..00bf2d42 100644
--- a/frontend/src/pages/WorkspaceSettings/MetaResponse/index.jsx
+++ b/frontend/src/pages/WorkspaceSettings/MetaResponse/index.jsx
@@ -1,12 +1,13 @@
+import TitleBlock from "@/components/Generic/Blocks/TitleBlock";
import MetaResponse from "@/models/metaResponse";
+import Workspace from "@/models/workspace";
import showToast from "@/utils/toast";
import { ChatText, Cube, Heart, UserCircle } from "@phosphor-icons/react";
import { useEffect, useState } from "react";
import EnableFeatures from "./EnableFeatures";
import FeatureSettings from "./FeatureSettings";
-import TitleBlock from "@/components/Generic/Blocks/TitleBlock";
-export default function MetaResponseSettings({ workspace }) {
+export default function MetaResponseSettings({ workspace, setWorkspace }) {
const [settings, setSettings] = useState({});
useEffect(() => {
const fetchMetaResponseSettings = async () => {
@@ -20,10 +21,47 @@ export default function MetaResponseSettings({ workspace }) {
}, []);
const handleToggleEnableFeatures = async (feature, enabled) => {
- const updatedFeatureSettings = {
+ let updatedFeatureSettings = {
...settings[feature],
isEnabled: enabled,
};
+ // if enabling a feature, set the systemPrompt content to openAiPrompt and clear openAiPrompt
+ if (settings[feature].config.systemPrompt.openAiPrompt != "") {
+ console.log(
+ "settings[feature].config.systemPrompt.openAiPrompt: ",
+ settings[feature].config.systemPrompt.openAiPrompt
+ );
+ updatedFeatureSettings = {
+ ...updatedFeatureSettings,
+ config: {
+ ...settings[feature].config,
+ systemPrompt: {
+ ...settings[feature].config.systemPrompt,
+ content: settings[feature].config.systemPrompt.openAiPrompt,
+ openAiPrompt: "",
+ },
+ },
+ };
+ // if disabling a feature, clear the systemPrompt.openAiPrompt for all other features
+ Object.keys(settings).map((f) => {
+ if (f !== feature) {
+ const featureSettings = settings[f];
+ if (featureSettings.config.systemPrompt.openAiPrompt !== "") {
+ const updatedFeatureSettings = {
+ ...featureSettings,
+ config: {
+ ...featureSettings.config,
+ systemPrompt: {
+ ...featureSettings.config.systemPrompt,
+ openAiPrompt: "",
+ },
+ },
+ };
+ settings[f] = updatedFeatureSettings;
+ }
+ }
+ });
+ }
const updatedSettings = await MetaResponse.updateMetaResponseSettings(
workspace.slug,
@@ -33,7 +71,7 @@ export default function MetaResponseSettings({ workspace }) {
}
);
- console.log("updatedSettings: ", updatedSettings);
+ console.log("updatedSettings: - ", updatedSettings);
setSettings(updatedSettings);
showToast(
`${feature} has been ${enabled ? "enabled" : "disabled"}`,
@@ -46,18 +84,65 @@ export default function MetaResponseSettings({ workspace }) {
feature,
updatedFeatureSettings
) => {
- const updatedSettings = await MetaResponse.updateMetaResponseSettings(
- workspace.slug,
- {
- ...settings,
- [feature]: updatedFeatureSettings,
- }
- );
-
- console.log("updatedSettings: ", updatedSettings);
- setSettings(updatedSettings);
+ try {
+ const updatedSettings = await MetaResponse.updateMetaResponseSettings(
+ workspace.slug,
+ {
+ ...settings,
+ [feature]: updatedFeatureSettings,
+ }
+ );
+ setSettings(updatedSettings);
+ } catch (error) {
+ console.error(
+ " Error while updating feature settings in MetaResponseSettings: ",
+ error
+ );
+ showToast(`Error: ${error.message}`, "error", { clear: true });
+ }
};
+ const handleUpdateWorkspaceOpenAiPrompt = async () => {
+ const openAiPrompt = () => {
+ let openAiPrompt = "";
+ Object.keys(settings).map((feature) => {
+ const featureSettings = settings[feature];
+ if (featureSettings.isEnabled) {
+ openAiPrompt += featureSettings.config.systemPrompt.content;
+ openAiPrompt +=
+ featureSettings.config.promptSchema.list[
+ featureSettings.config.promptSchema.active
+ ].content;
+
+ }
+ });
+ return openAiPrompt;
+ };
+ try {
+ const updatedSettings = await Workspace.update(workspace.slug, {
+ openAiPrompt: openAiPrompt(),
+ });
+ if (!updatedSettings) return;
+ setWorkspace(updatedSettings.workspace);
+ } catch (error) {
+ console.error(
+ " Error while updating workspace.openAiPrompt in MetaResponseSettings: ",
+ error
+ );
+ showToast(`Error: ${error.message}`, "error", { clear: true });
+ }
+ };
+
+ useEffect(() => {
+ if (
+ workspace.metaResponse &&
+ Object.keys(settings).length > 0 &&
+ Object.values(settings).some((feature) => feature.isEnabled)
+ ) {
+ handleUpdateWorkspaceOpenAiPrompt();
+ }
+ }, [settings]);
+
const mapIcons = {
inputs: ChatText,
sentiments: Heart,
@@ -66,8 +151,8 @@ export default function MetaResponseSettings({ workspace }) {
// const mapFeatures = {
// inputs: InputsFeature,
- // sentiments: InputsFeature,
- // avatars: InputsFeature,
+ // sentiments: SentimentsFeature,
+ // avatars: AvatarsFeature,
// };
return (
@@ -75,7 +160,7 @@ export default function MetaResponseSettings({ workspace }) {
diff --git a/frontend/src/pages/WorkspaceSettings/index.jsx b/frontend/src/pages/WorkspaceSettings/index.jsx
index 7413ab1d..63b20f1f 100644
--- a/frontend/src/pages/WorkspaceSettings/index.jsx
+++ b/frontend/src/pages/WorkspaceSettings/index.jsx
@@ -44,18 +44,28 @@ function ShowWorkspaceChat() {
useEffect(() => {
async function getWorkspace() {
if (!slug) return;
- const _workspace = await Workspace.bySlug(slug);
- if (!_workspace) {
- setLoading(false);
- return;
- }
+ try {
+ const _workspace = await Workspace.bySlug(slug);
+ if (!_workspace) {
+ setLoading(false);
+ return;
+ }
- const suggestedMessages = await Workspace.getSuggestedMessages(slug);
- setWorkspace({
- ..._workspace,
- suggestedMessages,
- });
- setLoading(false);
+ // const metaResponseSettings =
+ // _workspace.metaResponseSettings &&
+ // JSON.parse(_workspace.metaResponseSettings);
+
+ const suggestedMessages = await Workspace.getSuggestedMessages(slug);
+ setWorkspace({
+ ..._workspace,
+ suggestedMessages,
+ // metaResponseSettings,
+ });
+
+ setLoading(false);
+ } catch (error) {
+ console.error("Error getting suggested messages for workspace:", error);
+ }
}
getWorkspace();
}, [slug]);
diff --git a/server/endpoints/workspaces.js b/server/endpoints/workspaces.js
index 87b72345..7d848bd0 100644
--- a/server/endpoints/workspaces.js
+++ b/server/endpoints/workspaces.js
@@ -28,6 +28,7 @@ const {
determineWorkspacePfpFilepath,
fetchPfp,
} = require("../utils/files/pfp");
+const { WorkspaceMetaResponse } = require("../models/workspaceMetaResponse");
function workspaceEndpoints(app) {
if (!app) return;
@@ -89,10 +90,16 @@ function workspaceEndpoints(app) {
}
if (
!currWorkspace.metaResponse &&
- !currWorkspace.metaResponseSettings
+ !currWorkspace.metaResponseSettings &&
+ data.metaResponse
) {
- metaResponseDefaultSettings.inputs.config.systemPrompt.openAiPrompt =
- currWorkspace.openAiPrompt || "";
+ const metaResponseDefaultSettings = WorkspaceMetaResponse.defaultSettings;
+ console.log("currWorkspace.openAiPrompt", currWorkspace.openAiPrompt)
+ Object.keys(metaResponseDefaultSettings).map((feature) => {
+ metaResponseDefaultSettings[feature].config.systemPrompt.content =
+ data.openAiPrompt || currWorkspace.openAiPrompt ||
+ WorkspaceMetaResponse.defaultSystemPrompt;
+ });
data.metaResponseSettings = JSON.stringify(
metaResponseDefaultSettings
);
@@ -583,173 +590,4 @@ function workspaceEndpoints(app) {
}
);
}
-
-const metaResponseDefaultSettings = {
- inputs: {
- isEnabled: false,
- config: {
- systemPrompt: {
- isEnabled: false,
- content: "",
- openAiPrompt: "",
- overrideSystemPrompt: false,
- suggestionsList: [
- {
- title: "",
- content: "",
- },
- ],
- canEdit: ["admin", "manager"],
- },
- promptSchema: {
- content: "## Prompt Guidelines\n- you are a helpful assistant, you will be provided a question to create a list of four elements\n- when requested to return structured data return them in a JSON object code block , don't introduce them or label them, just return them at the end of your response.\n- When presenting choices or detailed information, encapsulate the data in JSON format, aiming for a user-friendly interaction through:\n\t- type options: you will use this if options are a better way to seak users interaction, include displayTypess: buttons, list,checkbox, or dropdown based on the context.\n\t- type range: you will use this if the user is required to input a numeric between a certain range.\n\t- type rating: you will use this if the user should insert a rating, uswaly between one and five.\n\t- type date: you will use this if the user should insert a date.\n- if asked to return options return them as structured data, only when asked.\n- always return response as normal in markdown first then associate the data structure object below.\n- make your response rich in markdown.\n- if you find that your response at any time contain options follow the instructions above.\n---\n### Response Example\n#### Discover More\n**Fascinating Topic**\nExplore intriguing facts and details about your chosen subject, enhancing your understanding and curiosity.\n\n```json\n{\n \"inputs\": {\n \"type\": \"options\",\n \"data\": {\n \"options\": [\n {\n \"label\": \"Restart Router\",\n \"value\": \"restart router\"\n },\n {\n \"label\": \"Check Service Status\",\n \"value\": \"check service status\"\n },\n ... \n ],\n \"label\":\"Select Server \",\n \"description\":\"list of servers as described\"\n \n },\n \"settings\": {\n \"allowMultiple\": false,\n \"displayType\": \"chose one, buttons/list/dropdown\"\n }\n },\n \"sentiment\": \"happy\",\n \"style\": \"text\"\n}\n```\n\ninput types:\n```json\n{\n \"type\":\"options\",\n \"data\":{\n \"options\":[\n {\n \"label\":\"Restart Router\",\n \"value\":\"restart_router\"\n },\n {\n \"label\":\"Check Service Status\",\n \"value\":\"check_service_status\"\n },\n {\n \"label\":\"Contact Support\",\n \"value\":\"contact_support\"\n }\n ]\n },\n \"settings\":{\n \"allowMultiple\":false,\n \"displayType\":\"buttons\"\n }\n}\n```\n\n```json\n{\n \"type\":\"range\",\n \"data\":{\n \"min\":1,\n \"max\":10,\n \"step\":1\n },\n \"settings\":{\n \"showValue\":true\n }\n}\n```\n\n```json\n{\n \"type\":\"rating\",\n \"data\":{\n \"max\":5,\n \"defaultValue\":3,\n \"icon\":\"star\"\n }\n}\n```\n\n```json\n{\n \"type\":\"date\",\n \"settings\":{\n \"format\":\"YYYY-MM-DD\",\n \"minDate\":\"2021-01-01\",\n \"maxDate\":\"2023-12-31\"\n }\n}\n```",
- schemas: [
- {
- title: "All Input Types",
- content: "## Prompt Guidelines\n- you are a helpful assistant, you will be provided a question to create a list of four elements\n- when requested to return structured data return them in a JSON object code block , don't introduce them or label them, just return them at the end of your response.\n- When presenting choices or detailed information, encapsulate the data in JSON format, aiming for a user-friendly interaction through:\n\t- type options: you will use this if options are a better way to seak users interaction, include displayTypess: buttons, list,checkbox, or dropdown based on the context.\n\t- type range: you will use this if the user is required to input a numeric between a certain range.\n\t- type rating: you will use this if the user should insert a rating, uswaly between one and five.\n\t- type date: you will use this if the user should insert a date.\n- if asked to return options return them as structured data, only when asked.\n- always return response as normal in markdown first then associate the data structure object below.\n- make your response rich in markdown.\n- if you find that your response at any time contain options follow the instructions above.\n---\n### Response Example\n#### Discover More\n**Fascinating Topic**\nExplore intriguing facts and details about your chosen subject, enhancing your understanding and curiosity.\n\n```json\n{\n \"inputs\": {\n \"type\": \"options\",\n \"data\": {\n \"options\": [\n {\n \"label\": \"Restart Router\",\n \"value\": \"restart router\"\n },\n {\n \"label\": \"Check Service Status\",\n \"value\": \"check service status\"\n },\n ... \n ],\n \"label\":\"Select Server \",\n \"description\":\"list of servers as described\"\n \n },\n \"settings\": {\n \"allowMultiple\": false,\n \"displayType\": \"chose one, buttons/list/dropdown\"\n }\n },\n \"sentiment\": \"happy\",\n \"style\": \"text\"\n}\n```\n\ninput types:\n```json\n{\n \"type\":\"options\",\n \"data\":{\n \"options\":[\n {\n \"label\":\"Restart Router\",\n \"value\":\"restart_router\"\n },\n {\n \"label\":\"Check Service Status\",\n \"value\":\"check_service_status\"\n },\n {\n \"label\":\"Contact Support\",\n \"value\":\"contact_support\"\n }\n ]\n },\n \"settings\":{\n \"allowMultiple\":false,\n \"displayType\":\"buttons\"\n }\n}\n```\n\n```json\n{\n \"type\":\"range\",\n \"data\":{\n \"min\":1,\n \"max\":10,\n \"step\":1\n },\n \"settings\":{\n \"showValue\":true\n }\n}\n```\n\n```json\n{\n \"type\":\"rating\",\n \"data\":{\n \"max\":5,\n \"defaultValue\":3,\n \"icon\":\"star\"\n }\n}\n```\n\n```json\n{\n \"type\":\"date\",\n \"settings\":{\n \"format\":\"YYYY-MM-DD\",\n \"minDate\":\"2021-01-01\",\n \"maxDate\":\"2023-12-31\"\n }\n}\n```",
- },
- {
- title: "Suggestions Buttons Type",
- content: "## Prompt Guidelines\n- you are a helpful assistant, you will be provided a question to create a list of four elements\n- when requested to return structured data return them in a JSON object code block , don't introduce them or label them, just return them at the end of your response.\n- When presenting choices or detailed information, encapsulate the data in JSON format, aiming for a user-friendly interaction through:\n\t- type options: you will use this if options are a better way to seak users interaction, include displayTypess: buttons, list,checkbox, or dropdown based on the context.\n\t- type range: you will use this if the user is required to input a numeric between a certain range.\n\t- type rating: you will use this if the user should insert a rating, uswaly between one and five.\n\t- type date: you will use this if the user should insert a date.\n- if asked to return options return them as structured data, only when asked.\n- always return response as normal in markdown first then associate the data structure object below.\n- make your response rich in markdown.\n- if you find that your response at any time contain options follow the instructions above.\n---\n### Response Example\n#### Discover More\n**Fascinating Topic**\nExplore intriguing facts and details about your chosen subject, enhancing your understanding and curiosity.\n\n```json\n{\n \"inputs\": {\n \"type\": \"options\",\n \"data\": {\n \"options\": [\n {\n \"label\": \"Restart Router\",\n \"value\": \"restart router\"\n },\n {\n \"label\": \"Check Service Status\",\n \"value\": \"check service status\"\n },\n ... \n ],\n \"label\":\"Select Server \",\n \"description\":\"list of servers as described\"\n \n },\n \"settings\": {\n \"allowMultiple\": false,\n \"displayType\": \"chose one, buttons/list/dropdown\"\n }\n },\n \"sentiment\": \"happy\",\n \"style\": \"text\"\n}\n```",
- },
- ],
- overrideWorkspacePrompt: false,
- canEdit: ["admin", "manager"],
- },
- components: {
- dropDownMenu: {
- isEnabled: false,
- options: [],
- description: "Drop Down menu best to select between functional derisions, ie: continue, Repeat or Move to a new sequence.. etc",
- infoLink: "https://docs.anythingllm.com/docs/meta-response/inputs/dropdown-menu",
-
- },
- optionsList: {
- isEnabled: false,
- options: [],
- description: "Best suited for expansion on a topic",
- infoLink: "https://docs.anythingllm.com/docs/meta-response/inputs/options-list",
- },
- optionsButtons: {
- isEnabled: false,
- options: [],
- description: "Chat will provide answers with the LLM's general knowledge and document context that is found.",
- infoLink: "https://docs.anythingllm.com/docs/meta-response/inputs/options-buttons",
- },
- multiSelectCheckboxes: {
- isEnabled: false,
- options: [],
- description: "Chat will provide answers with the LLM's general knowledge and document context that is found.",
- infoLink: "https://docs.anythingllm.com/docs/meta-response/inputs/multi-select-checkboxes",
- },
- },
- },
- permissions: ["user"],
- description: "Traditionally, interaction with AnythingLLM occurs through a text area. Meta Inputs enhance this by offering alternative interaction methods, including option buttons, multi-select checkboxes, sliders, drop-down menus, and date/time selectors. To utilize these components, you'll need to guide the LLM on incorporating them into its responses with a specific schema",
- infoLink: "https://docs.anythingllm.com/docs/meta-response/inputs",
- },
- sentiments: {
- isEnabled: false,
- config: {
- systemPrompt: {
- isEnabled: false,
- content: "",
- openAiPrompt: "",
- overrideSystemPrompt: false,
- suggestionsList: [
- {
- title: "",
- content: "",
- },
- ],
- canEdit: ["admin", "manager"],
- },
- promptSchema: {
- content: "",
- schemas: [
- {
- title: "",
- content: "",
- },
- ],
- overrideWorkspacePrompt: false,
- canEdit: ["admin", "manager"],
- },
- components: {
- dropDownMenu: {
- isEnabled: false,
- options: [],
-
- },
- optionsList: {
- isEnabled: false,
- options: [],
- },
- optionsButtons: {
- isEnabled: false,
- options: [],
- },
- multiSelectCheckboxes: {
- isEnabled: false,
- options: [],
- },
- },
- },
- permissions: ["user"],
- description: "Activate to enable the AI to analyze and adapt its responses based on the emotional tone of the conversation, enhancing interaction personalization",
- infoLink: "https://docs.anythingllm.com/docs/meta-response/sentiments",
- },
- avatars: {
- isEnabled: false,
- config: {
- systemPrompt: {
- isEnabled: false,
- content: "",
- openAiPrompt: "",
- overrideSystemPrompt: false,
- suggestionsList: [
- {
- title: "",
- content: "",
- },
- ],
- canEdit: ["admin", "manager"],
- },
- promptSchema: {
- content: "",
- schemas: [
- {
- title: "",
- content: "",
- },
- ],
- overrideWorkspacePrompt: false,
- canEdit: ["admin", "manager"],
- },
- components: {
- dropDownMenu: {
- isEnabled: false,
- options: [],
-
- },
- optionsList: {
- isEnabled: false,
- options: [],
- },
- optionsButtons: {
- isEnabled: false,
- options: [],
- },
- multiSelectCheckboxes: {
- isEnabled: false,
- options: [],
- },
- },
- },
- permissions: ["user"],
- description: "Enable avatars to reflect user sentiments, allowing the AI to visually empathize and convey understanding through changes in its profile image based on the meta object's sentiment data.",
- infoLink: "https://docs.anythingllm.com/docs/meta-response/avatars",
- },
-};
-
-module.exports = { workspaceEndpoints };
+module.exports = { workspaceEndpoints };
\ No newline at end of file
diff --git a/server/models/workspaceMetaResponse.js b/server/models/workspaceMetaResponse.js
index 923f7e4f..b8c1e09e 100644
--- a/server/models/workspaceMetaResponse.js
+++ b/server/models/workspaceMetaResponse.js
@@ -63,7 +63,211 @@ const WorkspaceMetaResponse = {
console.error(error.message);
return { workspace: null, message: error.message };
}
- }
+ },
+ defaultSystemPrompt: "Given the following conversation, relevant context, and a follow up question, reply with an answer to the current question the user is asking. Return only your response to the question given the above information following the users instructions as needed.\ngive user some options",
+ defaultSettings: {
+ inputs: {
+ isEnabled: true,
+ config: {
+ systemPrompt: {
+ isEnabled: true,
+ openAiPrompt: "",
+ overrideSystemPrompt: false,
+ content: "",
+ active: 0,
+ list: [
+ {
+ title: "original prompt",
+ content: "",
+ },
+ ],
+ canEdit: ["admin", "manager"],
+ },
+ promptSchema: {
+ active: 0,
+ list: [
+ {
+ title: "All Input Types",
+ content: "## Prompt Guidelines\n- you are a helpful assistant, you will be provided a question to create a list of four elements\n- when requested to return structured data return them in a JSON object code block , don't introduce them or label them, just return them at the end of your response.\n- When presenting choices or detailed information, encapsulate the data in JSON format, aiming for a user-friendly interaction through:\n\t- type options: you will use this if options are a better way to seak users interaction, include displayTypess: buttons, list,checkbox, or dropdown based on the context.\n\t- type range: you will use this if the user is required to input a numeric between a certain range.\n\t- type rating: you will use this if the user should insert a rating, uswaly between one and five.\n\t- type date: you will use this if the user should insert a date.\n- if asked to return options return them as structured data, only when asked.\n- always return response as normal in markdown first then associate the data structure object below.\n- make your response rich in markdown.\n- if you find that your response at any time contain options follow the instructions above.\n- Important follow strictly the json schema examples provided below\n---\n### Response Example\n#### Discover More\n**Fascinating Topic**\nExplore intriguing facts and details about your chosen subject, enhancing your understanding and curiosity.\n\n```json\n{\n \"inputs\": {\n \"type\": \"options\",\n \"data\": {\n \"options\": [\n {\n \"label\": \"Restart Router\",\n \"value\": \"restart router\"\n },\n {\n \"label\": \"Check Service Status\",\n \"value\": \"check service status\"\n },\n ... \n ],\n \"label\":\"Select Server \",\n \"description\":\"list of servers as described\"\n \n },\n \"settings\": {\n \"allowMultiple\": false,\n \"displayType\": \"chose one, buttons/list/dropdown\"\n }\n },\n \"sentiment\": \"happy\",\n \"style\": \"text\"\n}\n```\n\ninput types:\n```json\n{\n \"inputs\": {\n \"type\":\"options\",\n \"data\":{\n \"options\":[\n {\n \"label\":\"Restart Router\",\n \"value\":\"restart_router\"\n },\n {\n \"label\":\"Check Service Status\",\n \"value\":\"check_service_status\"\n },\n {\n \"label\":\"Contact Support\",\n \"value\":\"contact_support\"\n }\n ]\n },\n \"settings\":{\n \"allowMultiple\":false,\n \"displayType\":\"buttons\"\n }\n }\n}\n```\n\n```json\n{\n \"inputs\": {\n \"type\":\"range\",\n \"data\":{\n \"min\":1,\n \"max\":10,\n \"step\":1\n },\n \"settings\":{\n \"showValue\":true\n }\n }\n}\n```\n\n```json\n{\n\"inputs\": {\n \"type\":\"rating\",\n \"data\":{\n \"max\":5,\n \"defaultValue\":3,\n \"icon\":\"star\"\n }\n }\n}\n```\n\n```json\n{\n\"inputs\": {\n \"type\":\"date\",\n \"settings\":{\n \"format\":\"YYYY-MM-DD\",\n \"minDate\":\"2021-01-01\",\n \"maxDate\":\"2023-12-31\"\n }\n}\n}\n```\n---\n",
+ },
+ {
+ title: "Suggestions Buttons Type",
+ content: "## Prompt Guidelines Suggestions Buttons Type\n- you are a helpful assistant, you will be provided a question to create a list of four elements\n- when requested to return structured data return them in a JSON object code block , don't introduce them or label them, just return them at the end of your response.\n- When presenting choices or detailed information, encapsulate the data in JSON format, aiming for a user-friendly interaction through:\n\t- type options: you will use this if options are a better way to seak users interaction, include displayTypess: buttons, list,checkbox, or dropdown based on the context.\n\t- type range: you will use this if the user is required to input a numeric between a certain range.\n\t- type rating: you will use this if the user should insert a rating, uswaly between one and five.\n\t- type date: you will use this if the user should insert a date.\n- if asked to return options return them as structured data, only when asked.\n- always return response as normal in markdown first then associate the data structure object below.\n- make your response rich in markdown.\n- if you find that your response at any time contain options follow the instructions above.\n- Important follow strictly the json schema examples provided below\n---\n### Response Example\n#### Discover More\n**Fascinating Topic**\nExplore intriguing facts and details about your chosen subject, enhancing your understanding and curiosity.\n\n```json\n{\n \"inputs\": {\n \"type\": \"options\",\n \"data\": {\n \"options\": [\n {\n \"label\": \"Restart Router\",\n \"value\": \"restart router\"\n },\n {\n \"label\": \"Check Service Status\",\n \"value\": \"check service status\"\n },\n ... \n ],\n \"label\":\"Select Server \",\n \"description\":\"list of servers as described\"\n \n },\n \"settings\": {\n \"allowMultiple\": false,\n \"displayType\": \"chose one, buttons/list/dropdown\"\n }\n },\n \"sentiment\": \"happy\",\n \"style\": \"text\"\n}\n```",
+ },
+ ],
+ overrideWorkspacePrompt: false,
+ canEdit: ["admin", "manager"],
+ },
+ components: {
+ optionsButtons: {
+ isEnabled: true,
+ isDefault: true,
+ options: [],
+ description: "Chat will provide answers with the LLM's general knowledge and document context that is found.",
+ infoLink: "https://docs.anythingllm.com/docs/meta-response/inputs/options-buttons",
+ },
+ optionsList: {
+ isEnabled: false,
+ isDefault: false,
+ options: [],
+ description: "Best suited for expansion on a topic",
+ infoLink: "https://docs.anythingllm.com/docs/meta-response/inputs/options-list",
+ },
+ multiSelectCheckboxes: {
+ isEnabled: false,
+ isDefault: false,
+ options: [],
+ description: "Chat will provide answers with the LLM's general knowledge and document context that is found.",
+ infoLink: "https://docs.anythingllm.com/docs/meta-response/inputs/multi-select-checkboxes",
+ },
+ dropDownMenu: {
+ isEnabled: false,
+ isDefault: false,
+ options: [],
+ description: "Drop Down menu best to select between functional derisions, ie: continue, Repeat or Move to a new sequence.. etc",
+ infoLink: "https://docs.anythingllm.com/docs/meta-response/inputs/dropdown-menu",
+ },
+ },
+ },
+ permissions: ["user"],
+ description: "Traditionally, interaction with AnythingLLM occurs through a text area. Meta Inputs enhance this by offering alternative interaction methods, including option buttons, multi-select checkboxes, sliders, drop-down menus, and date/time selectors. To utilize these components, you'll need to guide the LLM on incorporating them into its responses with a specific schema",
+ infoLink: "https://docs.anythingllm.com/docs/meta-response/inputs",
+ },
+ sentiments: {
+ isEnabled: false,
+ config: {
+ systemPrompt: {
+ isEnabled: false,
+ openAiPrompt: "",
+ overrideSystemPrompt: false,
+ content: "",
+ active: 0,
+ list: [
+ {
+ title: "original prompt",
+ content: "",
+ },
+ ],
+ canEdit: ["admin", "manager"],
+ },
+ promptSchema: {
+ active: 0,
+ list: [
+ {
+ title: "All Input Types",
+ content: "## Prompt Guidelines All Input Types\n- you are a helpful assistant, you will be provided a question to create a list of four elements\n- when requested to return structured data return them in a JSON object code block , don't introduce them or label them, just return them at the end of your response.\n- When presenting choices or detailed information, encapsulate the data in JSON format, aiming for a user-friendly interaction through:\n\t- type options: you will use this if options are a better way to seak users interaction, include displayTypess: buttons, list,checkbox, or dropdown based on the context.\n\t- type range: you will use this if the user is required to input a numeric between a certain range.\n\t- type rating: you will use this if the user should insert a rating, uswaly between one and five.\n\t- type date: you will use this if the user should insert a date.\n- if asked to return options return them as structured data, only when asked.\n- always return response as normal in markdown first then associate the data structure object below.\n- make your response rich in markdown.\n- if you find that your response at any time contain options follow the instructions above.\n---\n### Response Example\n#### Discover More\n**Fascinating Topic**\nExplore intriguing facts and details about your chosen subject, enhancing your understanding and curiosity.\n\n```json\n{\n \"inputs\": {\n \"type\": \"options\",\n \"data\": {\n \"options\": [\n {\n \"label\": \"Restart Router\",\n \"value\": \"restart router\"\n },\n {\n \"label\": \"Check Service Status\",\n \"value\": \"check service status\"\n },\n ... \n ],\n \"label\":\"Select Server \",\n \"description\":\"list of servers as described\"\n \n },\n \"settings\": {\n \"allowMultiple\": false,\n \"displayType\": \"chose one, buttons/list/dropdown\"\n }\n },\n \"sentiment\": \"happy\",\n \"style\": \"text\"\n}\n```\n\ninput types:\n```json\n{\n \"type\":\"options\",\n \"data\":{\n \"options\":[\n {\n \"label\":\"Restart Router\",\n \"value\":\"restart_router\"\n },\n {\n \"label\":\"Check Service Status\",\n \"value\":\"check_service_status\"\n },\n {\n \"label\":\"Contact Support\",\n \"value\":\"contact_support\"\n }\n ]\n },\n \"settings\":{\n \"allowMultiple\":false,\n \"displayType\":\"buttons\"\n }\n}\n```\n\n```json\n{\n \"type\":\"range\",\n \"data\":{\n \"min\":1,\n \"max\":10,\n \"step\":1\n },\n \"settings\":{\n \"showValue\":true\n }\n}\n```\n\n```json\n{\n \"type\":\"rating\",\n \"data\":{\n \"max\":5,\n \"defaultValue\":3,\n \"icon\":\"star\"\n }\n}\n```\n\n```json\n{\n \"type\":\"date\",\n \"settings\":{\n \"format\":\"YYYY-MM-DD\",\n \"minDate\":\"2021-01-01\",\n \"maxDate\":\"2023-12-31\"\n }\n}\n```",
+ },
+ {
+ title: "Suggestions Buttons Type",
+ content: "## Prompt Guidelines Suggestions Buttons Type\n- you are a helpful assistant, you will be provided a question to create a list of four elements\n- when requested to return structured data return them in a JSON object code block , don't introduce them or label them, just return them at the end of your response.\n- When presenting choices or detailed information, encapsulate the data in JSON format, aiming for a user-friendly interaction through:\n\t- type options: you will use this if options are a better way to seak users interaction, include displayTypess: buttons, list,checkbox, or dropdown based on the context.\n\t- type range: you will use this if the user is required to input a numeric between a certain range.\n\t- type rating: you will use this if the user should insert a rating, uswaly between one and five.\n\t- type date: you will use this if the user should insert a date.\n- if asked to return options return them as structured data, only when asked.\n- always return response as normal in markdown first then associate the data structure object below.\n- make your response rich in markdown.\n- if you find that your response at any time contain options follow the instructions above.\n---\n### Response Example\n#### Discover More\n**Fascinating Topic**\nExplore intriguing facts and details about your chosen subject, enhancing your understanding and curiosity.\n\n```json\n{\n \"inputs\": {\n \"type\": \"options\",\n \"data\": {\n \"options\": [\n {\n \"label\": \"Restart Router\",\n \"value\": \"restart router\"\n },\n {\n \"label\": \"Check Service Status\",\n \"value\": \"check service status\"\n },\n ... \n ],\n \"label\":\"Select Server \",\n \"description\":\"list of servers as described\"\n \n },\n \"settings\": {\n \"allowMultiple\": false,\n \"displayType\": \"chose one, buttons/list/dropdown\"\n }\n },\n \"sentiment\": \"happy\",\n \"style\": \"text\"\n}\n```",
+ },
+ ],
+ overrideWorkspacePrompt: false,
+ canEdit: ["admin", "manager"],
+ },
+ components: {
+ optionsButtons: {
+ isEnabled: true,
+ isDefault: true,
+ options: [],
+ description: "Chat will provide answers with the LLM's general knowledge and document context that is found.",
+ infoLink: "https://docs.anythingllm.com/docs/meta-response/inputs/options-buttons",
+ },
+ optionsList: {
+ isEnabled: false,
+ isDefault: false,
+ options: [],
+ description: "Best suited for expansion on a topic",
+ infoLink: "https://docs.anythingllm.com/docs/meta-response/inputs/options-list",
+ },
+ multiSelectCheckboxes: {
+ isEnabled: false,
+ isDefault: false,
+ options: [],
+ description: "Chat will provide answers with the LLM's general knowledge and document context that is found.",
+ infoLink: "https://docs.anythingllm.com/docs/meta-response/inputs/multi-select-checkboxes",
+ },
+ dropDownMenu: {
+ isEnabled: false,
+ isDefault: false,
+ options: [],
+ description: "Drop Down menu best to select between functional derisions, ie: continue, Repeat or Move to a new sequence.. etc",
+ infoLink: "https://docs.anythingllm.com/docs/meta-response/inputs/dropdown-menu",
+ },
+ },
+ },
+ permissions: ["user"],
+ description: "Activate to enable the AI to analyze and adapt its responses based on the emotional tone of the conversation, enhancing interaction personalization",
+ infoLink: "https://docs.anythingllm.com/docs/meta-response/sentiments",
+ },
+ avatars: {
+ isEnabled: false,
+ config: {
+ systemPrompt: {
+ isEnabled: false,
+ openAiPrompt: "",
+ overrideSystemPrompt: false,
+ content: "",
+ active: 0,
+ list: [
+ {
+ title: "original prompt",
+ content: "",
+ },
+ ],
+ canEdit: ["admin", "manager"],
+ },
+ promptSchema: {
+ active: 0,
+ list: [
+ {
+ title: "All Input Types",
+ content: "## Prompt Guidelines All Input Types\n- you are a helpful assistant, you will be provided a question to create a list of four elements\n- when requested to return structured data return them in a JSON object code block , don't introduce them or label them, just return them at the end of your response.\n- if asked to return options return them as structured data, only when asked.\n- always return response as normal in markdown first then associate the data structure object below.\n- make your response rich in markdown.\n- if you find that your response at any time contain options follow the instructions above.\n---\nResponse example:\n#### Discover More\n**Fascinating Topic**\nExplore intriguing facts and details about your chosen subject, enhancing your understanding and curiosity.\n\n```json\n{\n \"inputs\": {\n \"type\": \"options\",\n \"data\": {\n \"options\": [\n {\n \"label\": \"Restart Router\",\n \"value\": \"restart router\"\n },\n {\n \"label\": \"Check Service Status\",\n \"value\": \"check service status\"\n },\n ... \n ],\n \"label\":\"Select Server \",\n \"description\":\"list of servers as described\"\n \n },\n \"settings\": {\n \"allowMultiple\": false,\n \"displayType\": \"chose one, buttons/list/dropdown\"\n }\n },\n \"sentiment\": \"happy\",\n \"style\": \"text\"\n}\n```\n\ninput types:\n```json\n{\n \"inputs\": {\n \"type\":\"options\",\n \"data\":{\n \"options\":[\n {\n \"label\":\"Restart Router\",\n \"value\":\"restart_router\"\n },\n {\n \"label\":\"Check Service Status\",\n \"value\":\"check_service_status\"\n },\n {\n \"label\":\"Contact Support\",\n \"value\":\"contact_support\"\n }\n ]\n },\n \"settings\":{\n \"allowMultiple\":false,\n \"displayType\":\"buttons\"\n }\n }\n}\n```\n\n```json\n{\n \"inputs\": {\n \"type\":\"range\",\n \"data\":{\n \"min\":1,\n \"max\":10,\n \"step\":1\n },\n \"settings\":{\n \"showValue\":true\n }\n }\n}\n```\n\n```json\n{\n\"inputs\": {\n \"type\":\"rating\",\n \"data\":{\n \"max\":5,\n \"defaultValue\":3,\n \"icon\":\"star\"\n }\n }\n}\n```\n\n```json\n{\n\"inputs\": {\n \"type\":\"date\",\n \"settings\":{\n \"format\":\"YYYY-MM-DD\",\n \"minDate\":\"2021-01-01\",\n \"maxDate\":\"2023-12-31\"\n }\n}\n}\n```",
+ },
+ {
+ title: "Suggestions Buttons Type",
+ content: "## Prompt Guidelines Suggestions Buttons Type\n- you are a helpful assistant, you will be provided a question to create a list of four elements\n- when requested to return structured data return them in a JSON object code block , don't introduce them or label them, just return them at the end of your response.\n- When presenting choices or detailed information, encapsulate the data in JSON format, aiming for a user-friendly interaction through:\n\t- type options: you will use this if options are a better way to seak users interaction, include displayTypess: buttons, list,checkbox, or dropdown based on the context.\n\t- type range: you will use this if the user is required to input a numeric between a certain range.\n\t- type rating: you will use this if the user should insert a rating, uswaly between one and five.\n\t- type date: you will use this if the user should insert a date.\n- if asked to return options return them as structured data, only when asked.\n- always return response as normal in markdown first then associate the data structure object below.\n- make your response rich in markdown.\n- if you find that your response at any time contain options follow the instructions above.\n---\n### Response Example\n#### Discover More\n**Fascinating Topic**\nExplore intriguing facts and details about your chosen subject, enhancing your understanding and curiosity.\n\n```json\n{\n \"inputs\": {\n \"type\": \"options\",\n \"data\": {\n \"options\": [\n {\n \"label\": \"Restart Router\",\n \"value\": \"restart router\"\n },\n {\n \"label\": \"Check Service Status\",\n \"value\": \"check service status\"\n },\n ... \n ],\n \"label\":\"Select Server \",\n \"description\":\"list of servers as described\"\n \n },\n \"settings\": {\n \"allowMultiple\": false,\n \"displayType\": \"chose one, buttons/list/dropdown\"\n }\n },\n \"sentiment\": \"happy\",\n \"style\": \"text\"\n}\n```",
+ },
+ ],
+ overrideWorkspacePrompt: false,
+ canEdit: ["admin", "manager"],
+ },
+ components: {
+ optionsButtons: {
+ isEnabled: true,
+ isDefault: true,
+ options: [],
+ description: "Chat will provide answers with the LLM's general knowledge and document context that is found.",
+ infoLink: "https://docs.anythingllm.com/docs/meta-response/inputs/options-buttons",
+ },
+ optionsList: {
+ isEnabled: false,
+ isDefault: false,
+ options: [],
+ description: "Best suited for expansion on a topic",
+ infoLink: "https://docs.anythingllm.com/docs/meta-response/inputs/options-list",
+ },
+ multiSelectCheckboxes: {
+ isEnabled: false,
+ isDefault: false,
+ options: [],
+ description: "Chat will provide answers with the LLM's general knowledge and document context that is found.",
+ infoLink: "https://docs.anythingllm.com/docs/meta-response/inputs/multi-select-checkboxes",
+ },
+ dropDownMenu: {
+ isEnabled: false,
+ isDefault: false,
+ options: [],
+ description: "Drop Down menu best to select between functional derisions, ie: continue, Repeat or Move to a new sequence.. etc",
+ infoLink: "https://docs.anythingllm.com/docs/meta-response/inputs/dropdown-menu",
+ },
+ },
+ },
+ permissions: ["user"],
+ description: "Enable avatars to reflect user sentiments, allowing the AI to visually empathize and convey understanding through changes in its profile image based on the meta object's sentiment data.",
+ infoLink: "https://docs.anythingllm.com/docs/meta-response/avatars",
+ },
+ },
};
module.exports = { WorkspaceMetaResponse };