Skip to content

LLM-Driven Extraction of Unstructured Data — Built for API Deployments & ETL Pipeline Workflows

Settings Modal in Prompt Studio (#94)

Tahier Hussain7a9f16204e02
diff --git a/frontend/src/components/agency/configure-connector-modal/ConfigureConnectorModal.css b/frontend/src/components/agency/configure-connector-modal/ConfigureConnectorModal.css
index 0bc4478fa..6c92c0579 100644
--- a/frontend/src/components/agency/configure-connector-modal/ConfigureConnectorModal.css
+++ b/frontend/src/components/agency/configure-connector-modal/ConfigureConnectorModal.css
@@ -18,6 +18,7 @@
height: 100%;
display: flex;
flex-direction: column;
+ overflow-y: auto;
}
.conn-modal-col-left {
@@ -92,4 +93,4 @@
.conn-modal-col .ant-tabs-nav {
margin: 0px;
-}
\ No newline at end of file
+}
diff --git a/frontend/src/components/agency/ds-settings-card/DsSettingsCard.jsx b/frontend/src/components/agency/ds-settings-card/DsSettingsCard.jsx
index 1fa142a95..a789b9bc0 100644
--- a/frontend/src/components/agency/ds-settings-card/DsSettingsCard.jsx
+++ b/frontend/src/components/agency/ds-settings-card/DsSettingsCard.jsx
@@ -17,8 +17,7 @@ import {
} from "antd";
import PropTypes from "prop-types";
import { useEffect, useState } from "react";
-
-import { titleCase } from "../../../helpers/GetStaticData";
+import { getMenuItem, titleCase } from "../../../helpers/GetStaticData";
import { useAxiosPrivate } from "../../../hooks/useAxiosPrivate";
import { useAlertStore } from "../../../store/alert-store";
import { useSessionStore } from "../../../store/session-store";
@@ -125,7 +124,7 @@ function DsSettingsCard({ type, endpointDetails, message }) {
) {
return;
}
- menuItems.push(getItem(item?.name, item?.id, sourceIcon(item?.icon)));
+ menuItems.push(getMenuItem(item?.name, item?.id, sourceIcon(item?.icon)));
});
setSelectedId("");
setFilteredList(menuItems);
@@ -181,16 +180,6 @@ function DsSettingsCard({ type, endpointDetails, message }) {
return <Image src={src} height={25} width={25} preview={false} />;
};
- const getItem = (label, key, icon, children, type) => {
- return {
- key,
- icon,
- children,
- label,
- type,
- };
- };
-
const clearDestination = (updatedData) => {
const body = { ...destination, ...updatedData };
diff --git a/frontend/src/components/custom-tools/add-llm-profile-modal/AddLlmProfileModal.css b/frontend/src/components/custom-tools/add-llm-profile/AddLlmProfile.css
similarity index 97%
rename from frontend/src/components/custom-tools/add-llm-profile-modal/AddLlmProfileModal.css
rename to frontend/src/components/custom-tools/add-llm-profile/AddLlmProfile.css
index 734fbdcb5..555441c58 100644
--- a/frontend/src/components/custom-tools/add-llm-profile-modal/AddLlmProfileModal.css
+++ b/frontend/src/components/custom-tools/add-llm-profile/AddLlmProfile.css
@@ -2,4 +2,4 @@
.add-llm-profile-row {
width: 100%;
-}
\ No newline at end of file
+}
diff --git a/frontend/src/components/custom-tools/add-llm-profile-modal/AddLlmProfileModal.jsx b/frontend/src/components/custom-tools/add-llm-profile/AddLlmProfile.jsx
similarity index 57%
rename from frontend/src/components/custom-tools/add-llm-profile-modal/AddLlmProfileModal.jsx
rename to frontend/src/components/custom-tools/add-llm-profile/AddLlmProfile.jsx
index 39ec3661a..17982dd56 100644
--- a/frontend/src/components/custom-tools/add-llm-profile-modal/AddLlmProfileModal.jsx
+++ b/frontend/src/components/custom-tools/add-llm-profile/AddLlmProfile.jsx
@@ -1,11 +1,10 @@
-import { CaretRightOutlined } from "@ant-design/icons";
+import { ArrowLeftOutlined, CaretRightOutlined } from "@ant-design/icons";
import {
- Checkbox,
+ Button,
Col,
Collapse,
Form,
Input,
- Modal,
Row,
Select,
Space,
@@ -22,17 +21,10 @@ import { useCustomToolStore } from "../../../store/custom-tool-store";
import { useSessionStore } from "../../../store/session-store";
import { CustomButton } from "../../widgets/custom-button/CustomButton";
import SpaceWrapper from "../../widgets/space-wrapper/SpaceWrapper";
-import "./AddLlmProfileModal.css";
+import "./AddLlmProfile.css";
import { useExceptionHandler } from "../../../hooks/useExceptionHandler";
-function AddLlmProfileModal({
- open,
- setOpen,
- editLlmProfileId,
- setEditLlmProfileId,
- modalTitle,
- setModalTitle,
-}) {
+function AddLlmProfile({ editLlmProfileId, setEditLlmProfileId, setIsAddLlm }) {
const [form] = Form.useForm();
const [formDetails, setFormDetails] = useState({});
const [resetForm, setResetForm] = useState(false);
@@ -44,6 +36,8 @@ function AddLlmProfileModal({
const [x2TextItems, setX2TextItems] = useState([]);
const [activeKey, setActiveKey] = useState(false);
const [loading, setLoading] = useState(false);
+ const [modalTitle, setModalTitle] = useState("");
+ const [areAdaptersReady, setAreAdaptersReady] = useState(false);
const { sessionDetails } = useSessionStore();
const { details, getDropdownItems, llmProfiles, updateCustomTool } =
useCustomToolStore();
@@ -67,10 +61,14 @@ function AddLlmProfileModal({
};
});
setRetrievalItems(items);
+
+ return () => {
+ setEditLlmProfileId(null);
+ };
}, []);
useEffect(() => {
- if (open && editLlmProfileId) {
+ if (editLlmProfileId) {
return;
}
@@ -86,20 +84,20 @@ function AddLlmProfileModal({
retrieval_strategy: "simple",
similarity_top_k: 1,
section: "Default",
- reindex: false,
prompt_studio_tool: details?.tool_id,
});
- setEditLlmProfileId(null);
- setModalTitle("Add new LLM Profile");
+ setModalTitle("Add New LLM Profile");
setActiveKey(false);
- }, [open]);
+ }, []);
useEffect(() => {
- if (!editLlmProfileId) {
+ if (!editLlmProfileId || !areAdaptersReady) {
return;
}
+ setModalTitle("Edit LLM Profile");
+
const llmProfileDetails = [...llmProfiles].find(
(item) => item?.profile_id === editLlmProfileId
);
@@ -132,11 +130,10 @@ function AddLlmProfileModal({
retrieval_strategy: llmProfileDetails?.retrieval_strategy,
similarity_top_k: llmProfileDetails?.similarity_top_k,
section: llmProfileDetails?.section,
- reindex: llmProfileDetails?.reindex,
prompt_studio_tool: details?.tool_id,
});
setActiveKey(true);
- }, [editLlmProfileId]);
+ }, [editLlmProfileId, areAdaptersReady]);
useEffect(() => {
if (resetForm) {
@@ -224,6 +221,7 @@ function AddLlmProfileModal({
});
}
});
+ setAreAdaptersReady(true);
})
.catch((err) => {
setAlertDetails(
@@ -276,17 +274,6 @@ function AddLlmProfileModal({
>
<Select options={[{ value: "Default" }]} />
</Form.Item>
- <Form.Item
- label="Re-Index"
- valuePropName="checked"
- name="reindex"
- validateStatus={
- getBackendErrorDetail("reindex", backendErrors) ? "error" : ""
- }
- help={getBackendErrorDetail("reindex", backendErrors)}
- >
- <Checkbox />
- </Form.Item>
</div>
),
},
@@ -327,7 +314,6 @@ function AddLlmProfileModal({
llmProfiles: newLlmProfiles,
};
updateCustomTool(updatedState);
- setOpen(false);
setAlertDetails({
type: "success",
content: "Saved successfully",
@@ -350,14 +336,7 @@ function AddLlmProfileModal({
};
return (
- <Modal
- className="pre-post-amble-modal"
- open={open}
- onCancel={() => setOpen(false)}
- maskClosable={false}
- centered
- footer={null}
- >
+ <div className="settings-body-pad-top">
<Form
form={form}
layout="vertical"
@@ -365,185 +344,182 @@ function AddLlmProfileModal({
onValuesChange={handleInputChange}
onFinish={handleSubmit}
>
- <div className="pre-post-amble-body">
- <SpaceWrapper>
- <div>
- <Typography.Text className="add-cus-tool-header">
- {modalTitle}
- </Typography.Text>
- </div>
- <div>
- <Form.Item
- label="Name"
- name="profile_name"
- rules={[
- {
- required: true,
- message: "Please enter the name",
- },
- { validator: validateEmptyOrWhitespace },
- ]}
- validateStatus={
- getBackendErrorDetail("profile_name", backendErrors)
- ? "error"
- : ""
- }
- help={getBackendErrorDetail("profile_name", backendErrors)}
- >
- <Input />
- </Form.Item>
- <Row className="add-llm-profile-row">
- <Col span={15}>
- <Form.Item
- label="LLM"
- name="llm"
- rules={[
- { required: true, message: "Please enter the LLM" },
- { validator: validateEmptyOrWhitespace },
- ]}
- validateStatus={
- getBackendErrorDetail("llm", backendErrors) ? "error" : ""
- }
- help={getBackendErrorDetail("llm", backendErrors)}
- >
- <Select options={llmItems} />
- </Form.Item>
- </Col>
- <Col span={1} />
- <Col span={8}>
- <Form.Item
- label="Chunk Size"
- name="chunk_size"
- rules={[
- {
- required: true,
- message: "Please enter the chunk size",
- },
- ]}
- validateStatus={
- getBackendErrorDetail("chunk_size", backendErrors)
- ? "error"
- : ""
- }
- help={getBackendErrorDetail("chunk_size", backendErrors)}
- >
- <Input type="number" />
- </Form.Item>
- </Col>
- </Row>
- <Row className="add-llm-profile-row">
- <Col span={15}>
- <Form.Item
- label="Vector Database"
- name="vector_store"
- rules={[
- {
- required: true,
- message: "Please select the vector store",
- },
- { validator: validateEmptyOrWhitespace },
- ]}
- validateStatus={
- getBackendErrorDetail("vector_store", backendErrors)
- ? "error"
- : ""
- }
- help={getBackendErrorDetail("vector_store", backendErrors)}
- >
- <Select options={vectorDbItems} />
- </Form.Item>
- </Col>
- <Col span={1} />
- <Col span={8}>
- <Form.Item
- label="Overlap"
- name="chunk_overlap"
- rules={[
- {
- required: true,
- message: "Please enter the overlap",
- },
- ]}
- validateStatus={
- getBackendErrorDetail("chunk_overlap", backendErrors)
- ? "error"
- : ""
- }
- help={getBackendErrorDetail("chunk_overlap", backendErrors)}
- >
- <Input type="number" />
- </Form.Item>
- </Col>
- </Row>
- <Form.Item
- label="Embedding Model"
- name="embedding_model"
- rules={[
- {
- required: true,
- message: "Please select the embedding model",
- },
- { validator: validateEmptyOrWhitespace },
- ]}
- validateStatus={
- getBackendErrorDetail("embedding_model", backendErrors)
- ? "error"
- : ""
- }
- help={getBackendErrorDetail("embedding_model", backendErrors)}
- >
- <Select options={embeddingItems} />
- </Form.Item>
- <Form.Item
- label="Text Extractor"
- name="x2text"
- rules={[
- {
- required: true,
- message: "Please select the text extractor",
- },
- { validator: validateEmptyOrWhitespace },
- ]}
- validateStatus={
- getBackendErrorDetail("x2text", backendErrors) ? "error" : ""
- }
- help={getBackendErrorDetail("x2text", backendErrors)}
- >
- <Select options={x2TextItems} />
- </Form.Item>
- <Collapse
- expandIcon={({ isActive }) => handleCaretIcon(isActive)}
- size="small"
- style={{
- background: token.colorBgContainer,
- }}
- items={getItems(panelStyle)}
- activeKey={activeKey && "1"}
- onChange={handleCollapse}
- />
- </div>
- </SpaceWrapper>
- </div>
- <Form.Item className="pre-post-amble-footer display-flex-right">
+ <SpaceWrapper>
+ <div>
+ <Button size="small" type="text" onClick={() => setIsAddLlm(false)}>
+ <ArrowLeftOutlined />
+ </Button>
+ <Typography.Text className="add-cus-tool-header">
+ {modalTitle}
+ </Typography.Text>
+ </div>
+ <div>
+ <Form.Item
+ label="Name"
+ name="profile_name"
+ rules={[
+ {
+ required: true,
+ message: "Please enter the name",
+ },
+ { validator: validateEmptyOrWhitespace },
+ ]}
+ validateStatus={
+ getBackendErrorDetail("profile_name", backendErrors)
+ ? "error"
+ : ""
+ }
+ help={getBackendErrorDetail("profile_name", backendErrors)}
+ >
+ <Input />
+ </Form.Item>
+ <Row className="add-llm-profile-row">
+ <Col span={15}>
+ <Form.Item
+ label="LLM"
+ name="llm"
+ rules={[
+ { required: true, message: "Please enter the LLM" },
+ { validator: validateEmptyOrWhitespace },
+ ]}
+ validateStatus={
+ getBackendErrorDetail("llm", backendErrors) ? "error" : ""
+ }
+ help={getBackendErrorDetail("llm", backendErrors)}
+ >
+ <Select options={llmItems} />
+ </Form.Item>
+ </Col>
+ <Col span={1} />
+ <Col span={8}>
+ <Form.Item
+ label="Chunk Size"
+ name="chunk_size"
+ rules={[
+ {
+ required: true,
+ message: "Please enter the chunk size",
+ },
+ ]}
+ validateStatus={
+ getBackendErrorDetail("chunk_size", backendErrors)
+ ? "error"
+ : ""
+ }
+ help={getBackendErrorDetail("chunk_size", backendErrors)}
+ >
+ <Input type="number" />
+ </Form.Item>
+ </Col>
+ </Row>
+ <Row className="add-llm-profile-row">
+ <Col span={15}>
+ <Form.Item
+ label="Vector Database"
+ name="vector_store"
+ rules={[
+ {
+ required: true,
+ message: "Please select the vector store",
+ },
+ { validator: validateEmptyOrWhitespace },
+ ]}
+ validateStatus={
+ getBackendErrorDetail("vector_store", backendErrors)
+ ? "error"
+ : ""
+ }
+ help={getBackendErrorDetail("vector_store", backendErrors)}
+ >
+ <Select options={vectorDbItems} />
+ </Form.Item>
+ </Col>
+ <Col span={1} />
+ <Col span={8}>
+ <Form.Item
+ label="Overlap"
+ name="chunk_overlap"
+ rules={[
+ {
+ required: true,
+ message: "Please enter the overlap",
+ },
+ ]}
+ validateStatus={
+ getBackendErrorDetail("chunk_overlap", backendErrors)
+ ? "error"
+ : ""
+ }
+ help={getBackendErrorDetail("chunk_overlap", backendErrors)}
+ >
+ <Input type="number" />
+ </Form.Item>
+ </Col>
+ </Row>
+ <Form.Item
+ label="Embedding Model"
+ name="embedding_model"
+ rules={[
+ {
+ required: true,
+ message: "Please select the embedding model",
+ },
+ { validator: validateEmptyOrWhitespace },
+ ]}
+ validateStatus={
+ getBackendErrorDetail("embedding_model", backendErrors)
+ ? "error"
+ : ""
+ }
+ help={getBackendErrorDetail("embedding_model", backendErrors)}
+ >
+ <Select options={embeddingItems} />
+ </Form.Item>
+ <Form.Item
+ label="Text Extractor"
+ name="x2text"
+ rules={[
+ {
+ required: true,
+ message: "Please select the text extractor",
+ },
+ { validator: validateEmptyOrWhitespace },
+ ]}
+ validateStatus={
+ getBackendErrorDetail("x2text", backendErrors) ? "error" : ""
+ }
+ help={getBackendErrorDetail("x2text", backendErrors)}
+ >
+ <Select options={x2TextItems} />
+ </Form.Item>
+ <Collapse
+ expandIcon={({ isActive }) => handleCaretIcon(isActive)}
+ size="small"
+ style={{
+ background: token.colorBgContainer,
+ }}
+ items={getItems(panelStyle)}
+ activeKey={activeKey && "1"}
+ onChange={handleCollapse}
+ />
+ </div>
+ </SpaceWrapper>
+ <Form.Item className="display-flex-right">
<Space>
- <CustomButton onClick={() => setOpen(false)}>Cancel</CustomButton>
<CustomButton type="primary" htmlType="submit" loading={loading}>
{editLlmProfileId ? "Update" : "Add"}
</CustomButton>
</Space>
</Form.Item>
</Form>
- </Modal>
+ </div>
);
}
-AddLlmProfileModal.propTypes = {
- open: PropTypes.bool.isRequired,
- setOpen: PropTypes.func.isRequired,
+AddLlmProfile.propTypes = {
editLlmProfileId: PropTypes.string,
setEditLlmProfileId: PropTypes.func.isRequired,
- modalTitle: PropTypes.string,
- setModalTitle: PropTypes.func.isRequired,
+ setIsAddLlm: PropTypes.func.isRequired,
};
-export { AddLlmProfileModal };
+export { AddLlmProfile };
diff --git a/frontend/src/components/custom-tools/custom-synonyms/CustomSynonyms.jsx b/frontend/src/components/custom-tools/custom-synonyms/CustomSynonyms.jsx
index e35307556..2a85e4cb1 100644
--- a/frontend/src/components/custom-tools/custom-synonyms/CustomSynonyms.jsx
+++ b/frontend/src/components/custom-tools/custom-synonyms/CustomSynonyms.jsx
@@ -1,6 +1,5 @@
import { DeleteOutlined, PlusOutlined } from "@ant-design/icons";
import { Button, Input, Select, Space, Table, Typography } from "antd";
-import PropTypes from "prop-types";
import { useEffect, useState } from "react";
import { useAxiosPrivate } from "../../../hooks/useAxiosPrivate";
@@ -33,7 +32,7 @@ const columns = [
},
];
-function CustomSynonyms({ setOpen }) {
+function CustomSynonyms() {
const [synonyms, setSynonyms] = useState([]);
const [rows, setRows] = useState([]);
const [isLoading, setIsLoading] = useState(false);
@@ -172,7 +171,7 @@ function CustomSynonyms({ setOpen }) {
const grammar = res?.data?.prompt_grammer;
const updatedDetails = { ...details };
updatedDetails["prompt_grammer"] = grammar;
- updateCustomTool(updatedDetails);
+ updateCustomTool({ details: updatedDetails });
setAlertDetails({
type: "success",
content: "Saved synonyms successfully",
@@ -193,48 +192,45 @@ function CustomSynonyms({ setOpen }) {
};
return (
- <div>
- <div className="pre-post-amble-body">
- <SpaceWrapper>
- <div>
- <Typography.Text className="add-cus-tool-header">
- Custom Synonyms
- </Typography.Text>
- </div>
- <div>
- <Table
- columns={columns}
- dataSource={rows}
- size="small"
- bordered
- pagination={{ position: [] }}
- />
- </div>
- <div>
+ <div className="settings-body-pad-top">
+ <SpaceWrapper>
+ <div>
+ <Typography.Text className="add-cus-tool-header">
+ Custom Synonyms
+ </Typography.Text>
+ </div>
+ <div>
+ <Table
+ columns={columns}
+ dataSource={rows}
+ size="small"
+ bordered
+ pagination={{ position: [] }}
+ />
+ </div>
+ <div>
+ <CustomButton
+ type="primary"
+ icon={<PlusOutlined />}
+ onClick={handleAddRow}
+ >
+ Rows
+ </CustomButton>
+ </div>
+ <div className="display-flex-right">
+ <Space>
<CustomButton
type="primary"
- icon={<PlusOutlined />}
- onClick={handleAddRow}
+ onClick={handleSave}
+ loading={isLoading}
>
- Rows
+ Save
</CustomButton>
- </div>
- </SpaceWrapper>
- </div>
- <div className="pre-post-amble-footer display-flex-right">
- <Space>
- <Button onClick={() => setOpen(false)}>Cancel</Button>
- <CustomButton type="primary" onClick={handleSave} loading={isLoading}>
- Save
- </CustomButton>
- </Space>
- </div>
+ </Space>
+ </div>
+ </SpaceWrapper>
</div>
);
}
-CustomSynonyms.propTypes = {
- setOpen: PropTypes.func.isRequired,
-};
-
export { CustomSynonyms };
diff --git a/frontend/src/components/custom-tools/document-parser/DocumentParser.jsx b/frontend/src/components/custom-tools/document-parser/DocumentParser.jsx
index e36271699..390ae6c41 100644
--- a/frontend/src/components/custom-tools/document-parser/DocumentParser.jsx
+++ b/frontend/src/components/custom-tools/document-parser/DocumentParser.jsx
@@ -16,7 +16,6 @@ import { PromptCard } from "../prompt-card/PromptCard";
import { useExceptionHandler } from "../../../hooks/useExceptionHandler";
function DocumentParser({
- setOpenAddLlmModal,
addPromptInstance,
scrollToBottom,
setScrollToBottom,
@@ -222,7 +221,6 @@ function DocumentParser({
promptDetails={item}
handleChange={handleChange}
handleDelete={handleDelete}
- setOpenAddLlmModal={setOpenAddLlmModal}
updateStatus={updateStatus}
updatePlaceHolder="Enter Prompt"
/>
@@ -245,7 +243,6 @@ function DocumentParser({
}
DocumentParser.propTypes = {
- setOpenAddLlmModal: PropTypes.func.isRequired,
addPromptInstance: PropTypes.func.isRequired,
scrollToBottom: PropTypes.bool.isRequired,
setScrollToBottom: PropTypes.func.isRequired,
diff --git a/frontend/src/components/custom-tools/header/Header.css b/frontend/src/components/custom-tools/header/Header.css
index fd9ed84d1..f990c7087 100644
--- a/frontend/src/components/custom-tools/header/Header.css
+++ b/frontend/src/components/custom-tools/header/Header.css
@@ -31,5 +31,5 @@
}
.select-llm-pro-header {
- padding: 20px 0px 0px 20px;
-}
\ No newline at end of file
+ padding-top: 12px;
+}
diff --git a/frontend/src/components/custom-tools/header/Header.jsx b/frontend/src/components/custom-tools/header/Header.jsx
index b9bb05587..2007a4cac 100644
--- a/frontend/src/components/custom-tools/header/Header.jsx
+++ b/frontend/src/components/custom-tools/header/Header.jsx
@@ -1,15 +1,12 @@
import {
ArrowLeftOutlined,
- CodeOutlined,
- DiffOutlined,
EditOutlined,
ExportOutlined,
- FileTextOutlined,
- MessageOutlined,
+ SettingOutlined,
} from "@ant-design/icons";
import { Button, Tooltip, Typography } from "antd";
import PropTypes from "prop-types";
-import { useEffect, useState } from "react";
+import { useState } from "react";
import { useNavigate } from "react-router-dom";
import "./Header.css";
@@ -18,51 +15,17 @@ import { useAlertStore } from "../../../store/alert-store";
import { useCustomToolStore } from "../../../store/custom-tool-store";
import { useSessionStore } from "../../../store/session-store";
import { CustomButton } from "../../widgets/custom-button/CustomButton";
-import { PreAndPostAmbleModal } from "../pre-and-post-amble-modal/PreAndPostAmbleModal";
-import { SelectLlmProfileModal } from "../select-llm-profile-modal/SelectLlmProfileModal";
import { useExceptionHandler } from "../../../hooks/useExceptionHandler";
-let SummarizeHeader = null;
-
-try {
- SummarizeHeader =
- require("../../../plugins/summarize-header/SummarizeHeader").SummarizeHeader;
-} catch {
- // The component will remain null of it is not available
-}
-
-function Header({
- setOpenCusSynonymsModal,
- setOpenManageLlmModal,
- handleUpdateTool,
-}) {
- const [openPreOrPostAmbleModal, setOpenPreOrPostAmbleModal] = useState(false);
- const [openSummLlmProfileModal, setOpenSummLlmProfileModal] = useState(false);
- const [preOrPostAmble, setPreOrPostAmble] = useState("");
+function Header({ setOpenSettings }) {
const [isExportLoading, setIsExportLoading] = useState(false);
- const [summarizeLlmBtnText, setSummarizeLlmBtnText] = useState(null);
- const [llmItems, setLlmItems] = useState([]);
- const { details, llmProfiles } = useCustomToolStore();
+ const { details } = useCustomToolStore();
const { sessionDetails } = useSessionStore();
const { setAlertDetails } = useAlertStore();
const axiosPrivate = useAxiosPrivate();
const navigate = useNavigate();
const handleException = useExceptionHandler();
- useEffect(() => {
- getLlmProfilesDropdown();
- }, [llmProfiles]);
-
- const handleOpenPreOrPostAmbleModal = (type) => {
- setOpenPreOrPostAmbleModal(true);
- setPreOrPostAmble(type);
- };
-
- const handleClosePreOrPostAmbleModal = () => {
- setOpenPreOrPostAmbleModal(false);
- setPreOrPostAmble("");
- };
-
const handleExport = () => {
const requestOptions = {
method: "GET",
@@ -85,16 +48,6 @@ function Header({
});
};
- const getLlmProfilesDropdown = () => {
- const items = [...llmProfiles].map((item) => {
- return {
- value: item?.profile_id,
- label: item?.profile_name,
- };
- });
- setLlmItems(items);
- };
-
return (
<div className="custom-tools-header-layout">
<div>
@@ -115,41 +68,12 @@ function Header({
</Button>
</div>
<div className="custom-tools-header-btns">
- {SummarizeHeader && (
- <SummarizeHeader
- setOpen={setOpenSummLlmProfileModal}
- btnText={summarizeLlmBtnText}
- />
- )}
- <div>
- <Button
- onClick={() => setOpenCusSynonymsModal(true)}
- icon={<MessageOutlined />}
- >
- Manage Grammar
- </Button>
- </div>
- <div>
- <Button
- onClick={() => setOpenManageLlmModal(true)}
- icon={<CodeOutlined />}
- >
- Manage LLM Profiles
- </Button>
- </div>
- <div className="custom-tools-header-v-divider" />
- <div>
- <Tooltip title="Preamble">
- <Button onClick={() => handleOpenPreOrPostAmbleModal("PREAMBLE")}>
- <DiffOutlined />
- </Button>
- </Tooltip>
- </div>
<div>
- <Tooltip title="Postamble">
- <Button onClick={() => handleOpenPreOrPostAmbleModal("POSTAMBLE")}>
- <FileTextOutlined />
- </Button>
+ <Tooltip title="Settings">
+ <Button
+ icon={<SettingOutlined />}
+ onClick={() => setOpenSettings(true)}
+ />
</Tooltip>
</div>
<div className="custom-tools-header-v-divider" />
@@ -165,27 +89,12 @@ function Header({
</Tooltip>
</div>
</div>
- <PreAndPostAmbleModal
- isOpen={openPreOrPostAmbleModal}
- closeModal={handleClosePreOrPostAmbleModal}
- type={preOrPostAmble}
- handleUpdateTool={handleUpdateTool}
- />
- <SelectLlmProfileModal
- open={openSummLlmProfileModal}
- setOpen={setOpenSummLlmProfileModal}
- llmItems={llmItems}
- setBtnText={setSummarizeLlmBtnText}
- handleUpdateTool={handleUpdateTool}
- />
</div>
);
}
Header.propTypes = {
- setOpenCusSynonymsModal: PropTypes.func.isRequired,
- setOpenManageLlmModal: PropTypes.func.isRequired,
- handleUpdateTool: PropTypes.func.isRequired,
+ setOpenSettings: PropTypes.func.isRequired,
};
export { Header };
diff --git a/frontend/src/components/custom-tools/manage-llm-profiles/ManageLlmProfiles.jsx b/frontend/src/components/custom-tools/manage-llm-profiles/ManageLlmProfiles.jsx
index 48b076dbc..909188a5a 100644
--- a/frontend/src/components/custom-tools/manage-llm-profiles/ManageLlmProfiles.jsx
+++ b/frontend/src/components/custom-tools/manage-llm-profiles/ManageLlmProfiles.jsx
@@ -1,6 +1,5 @@
import { DeleteOutlined, EditOutlined } from "@ant-design/icons";
-import { Button, Radio, Space, Table, Typography } from "antd";
-import PropTypes from "prop-types";
+import { Button, Radio, Table, Typography } from "antd";
import { useEffect, useState } from "react";
import { useAxiosPrivate } from "../../../hooks/useAxiosPrivate";
@@ -8,10 +7,11 @@ import { useAlertStore } from "../../../store/alert-store";
import { useCustomToolStore } from "../../../store/custom-tool-store";
import { useSessionStore } from "../../../store/session-store";
import { ConfirmModal } from "../../widgets/confirm-modal/ConfirmModal";
-import { CustomButton } from "../../widgets/custom-button/CustomButton";
import SpaceWrapper from "../../widgets/space-wrapper/SpaceWrapper";
import "./ManageLlmProfiles.css";
import { useExceptionHandler } from "../../../hooks/useExceptionHandler";
+import { AddLlmProfile } from "../add-llm-profile/AddLlmProfile";
+import { CustomButton } from "../../widgets/custom-button/CustomButton";
const columns = [
{
@@ -58,13 +58,10 @@ const columns = [
align: "center",
},
];
-function ManageLlmProfiles({
- setOpen,
- setOpenLlm,
- setEditLlmProfileId,
- setModalTitle,
-}) {
+function ManageLlmProfiles() {
const [rows, setRows] = useState([]);
+ const [isAddLlm, setIsAddLlm] = useState(false);
+ const [editLlmProfileId, setEditLlmProfileId] = useState(null);
const axiosPrivate = useAxiosPrivate();
const { sessionDetails } = useSessionStore();
const { details, defaultLlmProfile, updateCustomTool, llmProfiles } =
@@ -105,7 +102,7 @@ function ManageLlmProfiles({
};
useEffect(() => {
- const modifiedRows = llmProfiles.map((item, index) => {
+ const modifiedRows = llmProfiles.map((item) => {
return {
key: item?.profile_id,
name: item?.profile_name || "",
@@ -143,15 +140,9 @@ function ManageLlmProfiles({
setRows(modifiedRows);
}, [llmProfiles, defaultLlmProfile]);
- const handleAddNewLlm = () => {
- setOpen(false);
- setOpenLlm(true);
- };
-
const handleEdit = (id) => {
setEditLlmProfileId(id);
- setModalTitle("Manage LLM profile");
- handleAddNewLlm();
+ setIsAddLlm(true);
};
const handleDelete = (id) => {
@@ -184,45 +175,42 @@ function ManageLlmProfiles({
});
};
+ if (isAddLlm) {
+ return (
+ <AddLlmProfile
+ editLlmProfileId={editLlmProfileId}
+ setEditLlmProfileId={setEditLlmProfileId}
+ setIsAddLlm={setIsAddLlm}
+ />
+ );
+ }
+
return (
- <div>
- <div className="pre-post-amble-body">
- <SpaceWrapper>
- <div>
- <Typography.Text className="add-cus-tool-header">
- LLM Profiles Manager
- </Typography.Text>
- </div>
- <div className="add-cus-tool-gap" />
- <div>
- <Table
- columns={columns}
- dataSource={rows}
- size="small"
- bordered
- max-width="100%"
- pagination={{ pageSize: 10 }}
- />
- </div>
- </SpaceWrapper>
- </div>
- <div className="pre-post-amble-footer display-flex-right">
- <Space>
- <Button onClick={() => setOpen(false)}>Cancel</Button>
- <CustomButton type="primary" onClick={handleAddNewLlm}>
- Add New LLM Profile
- </CustomButton>
- </Space>
+ <div className="settings-body-pad-top">
+ <SpaceWrapper>
+ <div>
+ <Typography.Text className="add-cus-tool-header">
+ LLM Profiles Manager
+ </Typography.Text>
+ </div>
+ <div>
+ <Table
+ columns={columns}
+ dataSource={rows}
+ size="small"
+ bordered
+ max-width="100%"
+ pagination={{ pageSize: 10 }}
+ />
+ </div>
+ </SpaceWrapper>
+ <div className="display-flex-right">
+ <CustomButton type="primary" onClick={() => setIsAddLlm(true)}>
+ Add New LLM Profile
+ </CustomButton>
</div>
</div>
);
}
-ManageLlmProfiles.propTypes = {
- setOpen: PropTypes.func.isRequired,
- setOpenLlm: PropTypes.func.isRequired,
- setEditLlmProfileId: PropTypes.func.isRequired,
- setModalTitle: PropTypes.func.isRequired,
-};
-
export { ManageLlmProfiles };
diff --git a/frontend/src/components/custom-tools/output-for-doc-modal/OutputForDocModal.jsx b/frontend/src/components/custom-tools/output-for-doc-modal/OutputForDocModal.jsx
index 2eea1240c..ca52b0b42 100644
--- a/frontend/src/components/custom-tools/output-for-doc-modal/OutputForDocModal.jsx
+++ b/frontend/src/components/custom-tools/output-for-doc-modal/OutputForDocModal.jsx
@@ -135,7 +135,7 @@ OutputForDocModal.propTypes = {
setOpen: PropTypes.func.isRequired,
promptId: PropTypes.string.isRequired,
promptKey: PropTypes.string.isRequired,
- profileManagerId: PropTypes.string.isRequired,
+ profileManagerId: PropTypes.string,
};
export { OutputForDocModal };
diff --git a/frontend/src/components/custom-tools/pre-and-post-amble-modal/PreAndPostAmbleModal.jsx b/frontend/src/components/custom-tools/pre-and-post-amble-modal/PreAndPostAmbleModal.jsx
index 0d083fa5b..268852a76 100644
--- a/frontend/src/components/custom-tools/pre-and-post-amble-modal/PreAndPostAmbleModal.jsx
+++ b/frontend/src/components/custom-tools/pre-and-post-amble-modal/PreAndPostAmbleModal.jsx
@@ -1,4 +1,4 @@
-import { Button, Input, Modal, Space, Typography } from "antd";
+import { Input, Space, Typography } from "antd";
import PropTypes from "prop-types";
import { useEffect, useState } from "react";
import "./PreAndPostAmbleModal.css";
@@ -7,13 +7,14 @@ import { useAlertStore } from "../../../store/alert-store";
import { useCustomToolStore } from "../../../store/custom-tool-store";
import { CustomButton } from "../../widgets/custom-button/CustomButton";
import { useExceptionHandler } from "../../../hooks/useExceptionHandler";
+import SpaceWrapper from "../../widgets/space-wrapper/SpaceWrapper";
const fieldNames = {
preamble: "PREAMBLE",
postamble: "POSTAMBLE",
};
-function PreAndPostAmbleModal({ isOpen, closeModal, type, handleUpdateTool }) {
+function PreAndPostAmbleModal({ type, handleUpdateTool }) {
const [title, setTitle] = useState("");
const [text, setText] = useState("");
const { details, updateCustomTool } = useCustomToolStore();
@@ -21,12 +22,6 @@ function PreAndPostAmbleModal({ isOpen, closeModal, type, handleUpdateTool }) {
const handleException = useExceptionHandler();
useEffect(() => {
- if (!isOpen) {
- setText("");
- setTitle("");
- return;
- }
-
if (type === fieldNames.preamble) {
setTitle("Preamble");
setText(details?.preamble || "");
@@ -37,7 +32,7 @@ function PreAndPostAmbleModal({ isOpen, closeModal, type, handleUpdateTool }) {
setTitle("Postamble");
setText(details?.postamble || "");
}
- }, [isOpen]);
+ }, [type]);
const handleSave = () => {
const body = {};
@@ -57,7 +52,6 @@ function PreAndPostAmbleModal({ isOpen, closeModal, type, handleUpdateTool }) {
};
const updatedDetails = { ...details, ...updatedData };
updateCustomTool({ details: updatedDetails });
- closeModal();
setAlertDetails({
type: "success",
content: "Saved successfully",
@@ -69,50 +63,38 @@ function PreAndPostAmbleModal({ isOpen, closeModal, type, handleUpdateTool }) {
};
return (
- <Modal
- className="pre-post-amble-modal"
- open={isOpen}
- onCancel={closeModal}
- footer={null}
- centered
- maskClosable={false}
- >
- <div className="pre-post-amble-body">
- <Space direction="vertical" className="pre-post-amble-body-space">
- <div>
- <Typography.Text strong className="pre-post-amble-title">
- {title}
- </Typography.Text>
- </div>
- <div>
- <div>
- <Typography.Text>Add {title}</Typography.Text>
- </div>
- </div>
+ <div className="settings-body-pad-top">
+ <SpaceWrapper>
+ <div>
+ <Typography.Text strong className="pre-post-amble-title">
+ {title}
+ </Typography.Text>
+ </div>
+ <div>
<div>
- <Input.TextArea
- rows={3}
- value={text}
- onChange={(e) => setText(e.target.value)}
- />
+ <Typography.Text>Add {title}</Typography.Text>
</div>
- </Space>
- </div>
- <div className="pre-post-amble-footer display-flex-right">
- <Space>
- <Button onClick={closeModal}>Cancel</Button>
- <CustomButton type="primary" onClick={handleSave}>
- Save
- </CustomButton>
- </Space>
- </div>
- </Modal>
+ </div>
+ <div>
+ <Input.TextArea
+ rows={3}
+ value={text}
+ onChange={(e) => setText(e.target.value)}
+ />
+ </div>
+ <div className="display-flex-right">
+ <Space>
+ <CustomButton type="primary" onClick={handleSave}>
+ Save
+ </CustomButton>
+ </Space>
+ </div>
+ </SpaceWrapper>
+ </div>
);
}
PreAndPostAmbleModal.propTypes = {
- isOpen: PropTypes.bool.isRequired,
- closeModal: PropTypes.func.isRequired,
type: PropTypes.string.isRequired,
handleUpdateTool: PropTypes.func.isRequired,
};
diff --git a/frontend/src/components/custom-tools/select-llm-profile-modal/SelectLlmProfileModal.jsx b/frontend/src/components/custom-tools/select-llm-profile-modal/SelectLlmProfileModal.jsx
deleted file mode 100644
index 909f4583e..000000000
--- a/frontend/src/components/custom-tools/select-llm-profile-modal/SelectLlmProfileModal.jsx
+++ /dev/null
@@ -1,229 +0,0 @@
-import {
- Button,
- Checkbox,
- Form,
- Input,
- Modal,
- Select,
- Space,
- Switch,
- Typography,
-} from "antd";
-import PropTypes from "prop-types";
-import { useCallback, useEffect, useState } from "react";
-import debounce from "lodash/debounce";
-
-import { useCustomToolStore } from "../../../store/custom-tool-store";
-import { useAlertStore } from "../../../store/alert-store";
-import { CustomButton } from "../../widgets/custom-button/CustomButton";
-import { useExceptionHandler } from "../../../hooks/useExceptionHandler";
-
-const fieldNames = {
- SUMMARIZE_LLM_PROFILE: "summarize_llm_profile",
- SUMMARIZE_PROMPT: "summarize_prompt",
- SUMMARIZE_CONTEXT: "summarize_context",
- SUMMARIZE_AS_SOURCE: "summarize_as_source",
-};
-function SelectLlmProfileModal({
- open,
- setOpen,
- llmItems,
- setBtnText,
- handleUpdateTool,
-}) {
- const [selectedLlm, setSelectedLlm] = useState("");
- const [prompt, setPrompt] = useState("");
- const [isContext, setIsContext] = useState(false);
- const [isSource, setIsSource] = useState(false);
- const [isModified, setIsModified] = useState(false);
- const [isLoading, setIsLoading] = useState(false);
- const { details, updateCustomTool } = useCustomToolStore();
- const { setAlertDetails } = useAlertStore();
- const handleException = useExceptionHandler();
-
- useEffect(() => {
- setPrompt(details?.summarize_prompt);
- setIsContext(details?.summarize_context);
- setIsSource(details?.summarize_as_source);
- }, []);
-
- useEffect(() => {
- if (!selectedLlm) {
- setBtnText("");
- }
- }, [selectedLlm]);
-
- useEffect(() => {
- if (llmItems?.length) {
- setSelectedLlm(details?.summarize_llm_profile);
- handleBtnText(details?.summarize_llm_profile);
- }
- }, [llmItems]);
-
- const handleBtnText = (llm) => {
- const llmItem = [...llmItems].find((item) => item?.value === llm);
- setBtnText(llmItem?.label || "");
- };
-
- const handleStateUpdate = (fieldName, value) => {
- if (fieldName === fieldNames.SUMMARIZE_LLM_PROFILE) {
- setSelectedLlm(value);
- }
-
- if (fieldName === fieldNames.SUMMARIZE_PROMPT) {
- setPrompt(value);
- }
-
- if (fieldName === fieldNames.SUMMARIZE_CONTEXT) {
- setIsContext(value);
- setIsSource(value ? isSource : false);
- }
-
- if (fieldName === fieldNames.SUMMARIZE_AS_SOURCE) {
- setIsSource(value);
- }
-
- if (!isModified) {
- setIsModified(true);
- }
- };
-
- const handleSave = () => {
- const body = {
- [fieldNames.SUMMARIZE_LLM_PROFILE]: selectedLlm,
- [fieldNames.SUMMARIZE_PROMPT]: prompt,
- [fieldNames.SUMMARIZE_CONTEXT]: isContext,
- [fieldNames.SUMMARIZE_AS_SOURCE]: isSource,
- };
-
- setIsLoading(true);
- handleUpdateTool(body)
- .then(() => {
- handleBtnText(selectedLlm);
- const updatedDetails = { ...details };
- updatedDetails["summarize_llm_profile"] = selectedLlm;
- updatedDetails["summarize_prompt"] = prompt;
- updatedDetails["summarize_context"] = isContext;
- updatedDetails["summarize_as_source"] = isSource;
- updateCustomTool({ details: updatedDetails });
-
- setAlertDetails({
- type: "success",
- content: "Successfully updated the LLM profile",
- });
- setIsModified(false);
- setOpen(false);
- })
- .catch((err) => {
- setAlertDetails(
- handleException(err, "Failed to update the LLM profile")
- );
- })
- .finally(() => {
- setIsLoading(false);
- });
- };
-
- const onSearchDebounce = useCallback(
- debounce((event) => {
- handleStateUpdate(event.target.name, event.target.value);
- }, 1000),
- []
- );
-
- return (
- <Modal
- className="pre-post-amble-modal"
- open={open}
- onCancel={() => setOpen(null)}
- maskClosable={false}
- centered
- footer={null}
- >
- <div>
- <div className="select-llm-pro-header">
- <Typography.Text strong className="pre-post-amble-title">
- Summarize Manager
- </Typography.Text>
- </div>
- <Form layout="vertical">
- <div className="pre-post-amble-body">
- <Form.Item label="Select LLM Profile">
- <Select
- placeholder="Select Eval LLM"
- defaultValue={selectedLlm}
- options={llmItems}
- onChange={(value) =>
- handleStateUpdate(fieldNames.SUMMARIZE_LLM_PROFILE, value)
- }
- />
- </Form.Item>
- <Form.Item label="Prompt">
- <Input.TextArea
- rows={3}
- placeholder="Enter Prompt"
- name={fieldNames.SUMMARIZE_PROMPT}
- defaultValue={prompt}
- onChange={onSearchDebounce}
- />
- </Form.Item>
- <Form.Item>
- <Space>
- <Switch
- defaultValue={isContext}
- disabled={!selectedLlm}
- size="small"
- onChange={(value) =>
- handleStateUpdate(fieldNames.SUMMARIZE_CONTEXT, value)
- }
- />
- <Typography.Text>Summarize Context</Typography.Text>
- </Space>
- </Form.Item>
- <Form.Item>
- <Space>
- <Checkbox
- checked={isSource}
- disabled={!isContext || !selectedLlm}
- size="small"
- onChange={(e) =>
- handleStateUpdate(
- fieldNames.SUMMARIZE_AS_SOURCE,
- e.target.checked
- )
- }
- />
- <Typography.Text>
- Use summarize context as source
- </Typography.Text>
- </Space>
- </Form.Item>
- </div>
- <div className="pre-post-amble-footer display-flex-right">
- <Space>
- <Button onClick={() => setOpen(null)}>Cancel</Button>
- <CustomButton
- type="primary"
- onClick={handleSave}
- disabled={!isModified}
- loading={isLoading}
- >
- Save
- </CustomButton>
- </Space>
- </div>
- </Form>
- </div>
- </Modal>
- );
-}
-
-SelectLlmProfileModal.propTypes = {
- open: PropTypes.bool.isRequired,
- setOpen: PropTypes.func.isRequired,
- llmItems: PropTypes.array.isRequired,
- setBtnText: PropTypes.func.isRequired,
- handleUpdateTool: PropTypes.func.isRequired,
-};
-
-export { SelectLlmProfileModal };
diff --git a/frontend/src/components/custom-tools/settings-modal/SettingsModal.css b/frontend/src/components/custom-tools/settings-modal/SettingsModal.css
new file mode 100644
index 000000000..e155931ce
--- /dev/null
+++ b/frontend/src/components/custom-tools/settings-modal/SettingsModal.css
@@ -0,0 +1,6 @@
+/* Styles for SettingsModal */
+
+.settings-body-pad-top {
+ padding-top: 12px;
+ overflow-y: auto;
+}
diff --git a/frontend/src/components/custom-tools/settings-modal/SettingsModal.jsx b/frontend/src/components/custom-tools/settings-modal/SettingsModal.jsx
new file mode 100644
index 000000000..31d896fda
--- /dev/null
+++ b/frontend/src/components/custom-tools/settings-modal/SettingsModal.jsx
@@ -0,0 +1,141 @@
+import { Col, Menu, Modal, Row, Typography } from "antd";
+import PropTypes from "prop-types";
+
+import SpaceWrapper from "../../widgets/space-wrapper/SpaceWrapper";
+import { getMenuItem } from "../../../helpers/GetStaticData";
+import { useEffect, useState } from "react";
+import { ManageLlmProfiles } from "../manage-llm-profiles/ManageLlmProfiles";
+import { useCustomToolStore } from "../../../store/custom-tool-store";
+import { CustomSynonyms } from "../custom-synonyms/CustomSynonyms";
+import { PreAndPostAmbleModal } from "../pre-and-post-amble-modal/PreAndPostAmbleModal";
+import {
+ CodeOutlined,
+ DiffOutlined,
+ FileTextOutlined,
+ MessageOutlined,
+} from "@ant-design/icons";
+import "./SettingsModal.css";
+
+let SummarizeManager = null;
+try {
+ SummarizeManager =
+ require("../../../plugins/summarize-manager/SummarizeManager").SummarizeManager;
+} catch {
+ // Component will remain null if it is not present.
+}
+function SettingsModal({ open, setOpen, handleUpdateTool }) {
+ const [selectedId, setSelectedId] = useState(1);
+ const [llmItems, setLlmItems] = useState([]);
+ const { llmProfiles } = useCustomToolStore();
+ const [menuItems, setMenuItems] = useState([]);
+ const [components, setComponents] = useState([]);
+
+ useEffect(() => {
+ const items = [
+ getMenuItem("Manage LLM Profiles", 1, <CodeOutlined />),
+ getMenuItem("Manage Grammar", 3, <MessageOutlined />),
+ getMenuItem("Preamble", 4, <DiffOutlined />),
+ getMenuItem("Postamble", 5, <DiffOutlined />),
+ ];
+
+ const listOfComponents = {
+ 1: <ManageLlmProfiles />,
+ 3: <CustomSynonyms />,
+ 4: (
+ <PreAndPostAmbleModal
+ type="PREAMBLE"
+ handleUpdateTool={handleUpdateTool}
+ />
+ ),
+ 5: (
+ <PreAndPostAmbleModal
+ type="POSTAMBLE"
+ handleUpdateTool={handleUpdateTool}
+ />
+ ),
+ };
+
+ if (SummarizeManager) {
+ // Add Summary Manager menu item to the existing list
+ items.splice(
+ 1,
+ 0,
+ getMenuItem("Summary Manager", 2, <FileTextOutlined />)
+ );
+ listOfComponents[2] = (
+ <SummarizeManager
+ llmItems={llmItems}
+ handleUpdateTool={handleUpdateTool}
+ />
+ );
+ }
+
+ setMenuItems(items);
+ setComponents(listOfComponents);
+ }, [llmItems]);
+
+ useEffect(() => {
+ getLlmProfilesDropdown();
+ }, [llmProfiles]);
+
+ const handleSelectItem = (e) => {
+ const id = e.key;
+ setSelectedId(id?.toString());
+ };
+
+ const getLlmProfilesDropdown = () => {
+ const items = [...llmProfiles].map((item) => {
+ return {
+ value: item?.profile_id,
+ label: item?.profile_name,
+ };
+ });
+ setLlmItems(items);
+ };
+
+ return (
+ <Modal
+ open={open}
+ onCancel={() => setOpen(false)}
+ maskClosable={false}
+ centered
+ footer={null}
+ width={1200}
+ >
+ <SpaceWrapper>
+ <div>
+ <Typography.Text className="add-cus-tool-header">
+ Settings
+ </Typography.Text>
+ </div>
+ <Row className="conn-modal-row" style={{ height: "800px" }}>
+ <Col span={4} className="conn-modal-col conn-modal-col-left">
+ <div className="conn-modal-menu conn-modal-form-pad-right">
+ <Menu
+ className="sidebar-menu"
+ style={{ border: 0 }}
+ mode="inline"
+ items={menuItems}
+ onClick={handleSelectItem}
+ selectedKeys={[`${selectedId}`]}
+ />
+ </div>
+ </Col>
+ <Col span={20} className="conn-modal-col">
+ <div className="conn-modal-form-pad-left">
+ {components[selectedId]}
+ </div>
+ </Col>
+ </Row>
+ </SpaceWrapper>
+ </Modal>
+ );
+}
+
+SettingsModal.propTypes = {
+ open: PropTypes.bool.isRequired,
+ setOpen: PropTypes.func.isRequired,
+ handleUpdateTool: PropTypes.func.isRequired,
+};
+
+export { SettingsModal };
diff --git a/frontend/src/components/custom-tools/tool-ide/ToolIde.jsx b/frontend/src/components/custom-tools/tool-ide/ToolIde.jsx
index b9d8a3a26..ba2a20917 100644
--- a/frontend/src/components/custom-tools/tool-ide/ToolIde.jsx
+++ b/frontend/src/components/custom-tools/tool-ide/ToolIde.jsx
@@ -7,24 +7,20 @@ import { IslandLayout } from "../../../layouts/island-layout/IslandLayout";
import { useAlertStore } from "../../../store/alert-store";
import { useCustomToolStore } from "../../../store/custom-tool-store";
import { useSessionStore } from "../../../store/session-store";
-import { AddLlmProfileModal } from "../add-llm-profile-modal/AddLlmProfileModal";
import { CustomSynonymsModal } from "../custom-synonyms-modal/CustomSynonymsModal";
import { DisplayLogs } from "../display-logs/DisplayLogs";
import { DocumentManager } from "../document-manager/DocumentManager";
import { Header } from "../header/Header";
-import { ManageLlmProfilesModal } from "../manage-llm-profiles-modal/ManageLlmProfilesModal";
import { ToolsMain } from "../tools-main/ToolsMain";
import "./ToolIde.css";
import { useExceptionHandler } from "../../../hooks/useExceptionHandler";
+import { SettingsModal } from "../settings-modal/SettingsModal";
function ToolIde() {
const [showLogsModal, setShowLogsModal] = useState(false);
const [activeKey, setActiveKey] = useState([]);
const [openCusSynonymsModal, setOpenCusSynonymsModal] = useState(false);
- const [openManageLlmModal, setOpenManageLlmModal] = useState(false);
- const [openAddLlmModal, setOpenAddLlmModal] = useState(false);
- const [editLlmProfileId, setEditLlmProfileId] = useState(null);
- const [modalTitle, setModalTitle] = useState("");
+ const [openSettings, setOpenSettings] = useState(false);
const {
details,
updateCustomTool,
@@ -177,8 +173,8 @@ function ToolIde() {
<div>
<Header
setOpenCusSynonymsModal={setOpenCusSynonymsModal}
- setOpenManageLlmModal={setOpenManageLlmModal}
handleUpdateTool={handleUpdateTool}
+ setOpenSettings={setOpenSettings}
/>
</div>
<div className="tool-ide-body">
@@ -186,7 +182,7 @@ function ToolIde() {
<Row className="tool-ide-main">
<Col span={12} className="tool-ide-col">
<div className="tool-ide-prompts">
- <ToolsMain setOpenAddLlmModal={setOpenAddLlmModal} />
+ <ToolsMain />
</div>
</Col>
<Col span={12} className="tool-ide-col">
@@ -228,20 +224,10 @@ function ToolIde() {
open={openCusSynonymsModal}
setOpen={setOpenCusSynonymsModal}
/>
- <ManageLlmProfilesModal
- open={openManageLlmModal}
- setOpen={setOpenManageLlmModal}
- setOpenLlm={setOpenAddLlmModal}
- setEditLlmProfileId={setEditLlmProfileId}
- setModalTitle={setModalTitle}
- />
- <AddLlmProfileModal
- open={openAddLlmModal}
- setOpen={setOpenAddLlmModal}
- editLlmProfileId={editLlmProfileId}
- setEditLlmProfileId={setEditLlmProfileId}
- modalTitle={modalTitle}
- setModalTitle={setModalTitle}
+ <SettingsModal
+ open={openSettings}
+ setOpen={setOpenSettings}
+ handleUpdateTool={handleUpdateTool}
/>
</div>
);
diff --git a/frontend/src/components/custom-tools/tools-main/ToolsMain.jsx b/frontend/src/components/custom-tools/tools-main/ToolsMain.jsx
index d081b5d3f..d097b4b85 100644
--- a/frontend/src/components/custom-tools/tools-main/ToolsMain.jsx
+++ b/frontend/src/components/custom-tools/tools-main/ToolsMain.jsx
@@ -1,5 +1,4 @@
import { Tabs } from "antd";
-import PropTypes from "prop-types";
import { useEffect, useState } from "react";
import { promptType } from "../../../helpers/GetStaticData";
@@ -13,7 +12,7 @@ import { Footer } from "../footer/Footer";
import "./ToolsMain.css";
import { useExceptionHandler } from "../../../hooks/useExceptionHandler";
-function ToolsMain({ setOpenAddLlmModal }) {
+function ToolsMain() {
const [activeKey, setActiveKey] = useState("1");
const [prompts, setPrompts] = useState([]);
const [scrollToBottom, setScrollToBottom] = useState(false);
@@ -132,7 +131,6 @@ function ToolsMain({ setOpenAddLlmModal }) {
<div className="tools-main-body">
{activeKey === "1" && (
<DocumentParser
- setOpenAddLlmModal={setOpenAddLlmModal}
addPromptInstance={addPromptInstance}
scrollToBottom={scrollToBottom}
setScrollToBottom={setScrollToBottom}
@@ -149,8 +147,4 @@ function ToolsMain({ setOpenAddLlmModal }) {
);
}
-ToolsMain.propTypes = {
- setOpenAddLlmModal: PropTypes.func.isRequired,
-};
-
export { ToolsMain };
diff --git a/frontend/src/helpers/GetStaticData.js b/frontend/src/helpers/GetStaticData.js
index 86c703ce5..7942e4597 100644
--- a/frontend/src/helpers/GetStaticData.js
+++ b/frontend/src/helpers/GetStaticData.js
@@ -337,6 +337,16 @@ const titleCase = (str) => {
return words.join(" ");
};
+const getMenuItem = (label, key, icon, children, type) => {
+ return {
+ key,
+ icon,
+ children,
+ label,
+ type,
+ };
+};
+
export {
CONNECTOR_TYPE_MAP,
O_AUTH_PROVIDERS,
@@ -368,4 +378,5 @@ export {
displayPromptResult,
getBackendErrorDetail,
titleCase,
+ getMenuItem,
};