- refactored systemPrompt array in workspaces/update endpoint

- removed jsDocs comments form CheckBoxBlock
This commit is contained in:
sherifButt 2024-03-26 10:27:16 +00:00
parent 26c311d6d3
commit d1eb389f23
4 changed files with 17 additions and 27 deletions

View File

@ -2,23 +2,6 @@ import React from "react";
import Badge from "@/components/Generic/Badges/Badge";
import CheckBox from "../../Inputs/CheckBox";
/**
* @description A block that contains a checkbox and its label and description
* @param {boolean} initialChecked - initial state of the checkbox
* @param {string} label - label for the checkbox
* @param {function} onToggle - function to call when the checkbox is toggled
* @param {string} description - description of the checkbox
* @param {string} name - name of the checkbox
* @param {boolean} badge - whether to show a badge
* @param {string} badgeLabel - label for the badge
* @param {boolean} badgeAnimated - whether the badge should be animated
* @param {string} badgeBg - background color for the badge
* @param {boolean} border - whether to show a border
* @param {React.Component} Icon - icon to show next to the checkbox
* @param {string} contentLocation - location of the content
* @param {boolean} disabled - whether the checkbox is disabled
* @param {boolean} inline - whether the checkbox should be inline
*/
export default function CheckBoxBlock({
initialChecked,
label,

View File

@ -84,7 +84,7 @@ const OptionSelect = ({ data, settings, submit, message, setMessage ,workspace})
<button
className="flex items-center justify-center p-2 mt-4 text-sm text-white/60 hover:text-white rounded"
onClick={() => {
handleSelection(selectedOptions.join(", "));
handleSelection();
handleSubmit();
}}
>

View File

@ -29,6 +29,7 @@ const {
fetchPfp,
} = require("../utils/files/pfp");
const { WorkspaceMetaResponse } = require("../models/workspaceMetaResponse");
const { meta } = require("eslint-plugin-prettier");
function workspaceEndpoints(app) {
if (!app) return;
@ -94,11 +95,17 @@ function workspaceEndpoints(app) {
data.metaResponse
) {
const metaResponseDefaultSettings = WorkspaceMetaResponse.defaultSettings;
console.log("currWorkspace.openAiPrompt", currWorkspace.openAiPrompt)
const currentSystemPrompt =
data.openAiPrompt ||
currWorkspace.openAiPrompt ||
WorkspaceMetaResponse.defaultSystemPrompt;
Object.keys(metaResponseDefaultSettings).map((feature) => {
metaResponseDefaultSettings[feature].config.systemPrompt.content =
data.openAiPrompt || currWorkspace.openAiPrompt ||
WorkspaceMetaResponse.defaultSystemPrompt;
metaResponseDefaultSettings[feature].config.systemPrompt.content = currentSystemPrompt;
metaResponseDefaultSettings[feature].config.promptSchema.list[0] = {
title: "Default",
content: currentSystemPrompt,
}
});
data.metaResponseSettings = JSON.stringify(
metaResponseDefaultSettings

View File

@ -77,7 +77,7 @@ const WorkspaceMetaResponse = {
active: 0,
list: [
{
title: "original prompt",
title: "Default",
content: "",
},
],
@ -87,7 +87,7 @@ const WorkspaceMetaResponse = {
active: 0,
list: [
{
title: "All Input Types",
title: "Default",
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",
},
{
@ -144,7 +144,7 @@ const WorkspaceMetaResponse = {
active: 0,
list: [
{
title: "original prompt",
title: "Default",
content: "",
},
],
@ -154,7 +154,7 @@ const WorkspaceMetaResponse = {
active: 0,
list: [
{
title: "All Input Types",
title: "Default",
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```",
},
{
@ -211,7 +211,7 @@ const WorkspaceMetaResponse = {
active: 0,
list: [
{
title: "original prompt",
title: "Default",
content: "",
},
],