Skip to content

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

Feature / Implemented new design (#75)

jagadeeswaran-zipstacke9000ff7a860
diff --git a/frontend/src/components/agency/cards-list/CardsList.jsx b/frontend/src/components/agency/cards-list/CardsList.jsx
index ceae2ab8e..f13478388 100644
--- a/frontend/src/components/agency/cards-list/CardsList.jsx
+++ b/frontend/src/components/agency/cards-list/CardsList.jsx
@@ -4,7 +4,6 @@ import PropTypes from "prop-types";
import { useRef } from "react";
import { useDrag, useDrop } from "react-dnd";
-import { handleException } from "../../../helpers/GetStaticData";
import { useAxiosPrivate } from "../../../hooks/useAxiosPrivate";
import { useAlertStore } from "../../../store/alert-store";
import { useSessionStore } from "../../../store/session-store";
@@ -13,6 +12,7 @@ import { useWorkflowStore } from "../../../store/workflow-store";
import { ConfirmModal } from "../../widgets/confirm-modal/ConfirmModal";
import "../step-card/StepCard.css";
import "./CardList.css";
+import { useExceptionHandler } from "../../../hooks/useExceptionHandler";
import { ToolIcon } from "../tool-icon/ToolIcon";
const CardsList = ({ step, index, activeTool, moveItem }) => {
@@ -23,6 +23,7 @@ const CardsList = ({ step, index, activeTool, moveItem }) => {
const { deleteToolInstance } = useWorkflowStore();
const { setAlertDetails } = useAlertStore();
const axiosPrivate = useAxiosPrivate();
+ const handleException = useExceptionHandler();
const handleClick = (id, toolId, index) => {
const toolSettings = { id, tool_id: toolId };
setToolSettings(toolSettings);
diff --git a/frontend/src/components/agency/ds-settings-card/DsSettingsCard.jsx b/frontend/src/components/agency/ds-settings-card/DsSettingsCard.jsx
index f4d2659b1..9e7d12c4d 100644
--- a/frontend/src/components/agency/ds-settings-card/DsSettingsCard.jsx
+++ b/frontend/src/components/agency/ds-settings-card/DsSettingsCard.jsx
@@ -17,14 +17,14 @@ import {
} from "antd";
import PropTypes from "prop-types";
import { useEffect, useState } from "react";
-
-import { handleException, titleCase } from "../../../helpers/GetStaticData";
+import { titleCase } from "../../../helpers/GetStaticData";
import { useAxiosPrivate } from "../../../hooks/useAxiosPrivate";
import { useAlertStore } from "../../../store/alert-store";
import { useSessionStore } from "../../../store/session-store";
import { useWorkflowStore } from "../../../store/workflow-store";
import SpaceWrapper from "../../widgets/space-wrapper/SpaceWrapper";
import { ConfigureConnectorModal } from "../configure-connector-modal/ConfigureConnectorModal";
+import { useExceptionHandler } from "../../../hooks/useExceptionHandler";
const tooltip = {
input: "Data Source Settings",
@@ -66,6 +66,7 @@ function DsSettingsCard({ type, endpointDetails, message }) {
const { updateWorkflow } = useWorkflowStore();
const { setAlertDetails } = useAlertStore();
const axiosPrivate = useAxiosPrivate();
+ const handleException = useExceptionHandler();
const icons = {
input: <ImportOutlined className="ds-set-icon-size" />,
diff --git a/frontend/src/components/agency/prompt/Prompt.jsx b/frontend/src/components/agency/prompt/Prompt.jsx
index f0e0d34b1..3f7a8d058 100644
--- a/frontend/src/components/agency/prompt/Prompt.jsx
+++ b/frontend/src/components/agency/prompt/Prompt.jsx
@@ -2,13 +2,13 @@ import { EditOutlined, MinusOutlined } from "@ant-design/icons";
import { Button, Input, Typography } from "antd";
import { useState } from "react";
-import { handleException } from "../../../helpers/GetStaticData";
import { useAxiosPrivate } from "../../../hooks/useAxiosPrivate";
import { useAlertStore } from "../../../store/alert-store";
import { useSessionStore } from "../../../store/session-store";
import { useWorkflowStore } from "../../../store/workflow-store";
import { CustomButton } from "../../widgets/custom-button/CustomButton";
import "./Prompt.css";
+import { useExceptionHandler } from "../../../hooks/useExceptionHandler";
function Prompt() {
const [isPromptOpen, setIsPromptOpen] = useState(false);
@@ -16,6 +16,7 @@ function Prompt() {
const { prompt, isLoading, details, updateWorkflow } = useWorkflowStore();
const { sessionDetails } = useSessionStore();
const { setAlertDetails } = useAlertStore();
+ const handleException = useExceptionHandler();
const handlePromptChange = (e) => {
const promptText = e.target.value;
diff --git a/frontend/src/components/agency/steps/Steps.jsx b/frontend/src/components/agency/steps/Steps.jsx
index 8969cfe95..ef14fd5a0 100644
--- a/frontend/src/components/agency/steps/Steps.jsx
+++ b/frontend/src/components/agency/steps/Steps.jsx
@@ -4,10 +4,7 @@ import { useEffect } from "react";
import { DndProvider } from "react-dnd";
import { HTML5Backend } from "react-dnd-html5-backend";
-import {
- handleException,
- sourceTypes,
-} from "../../../helpers/GetStaticData.js";
+import { sourceTypes } from "../../../helpers/GetStaticData.js";
import { useAxiosPrivate } from "../../../hooks/useAxiosPrivate";
import { useAlertStore } from "../../../store/alert-store";
import { useSessionStore } from "../../../store/session-store";
@@ -16,6 +13,7 @@ import { SpinnerLoader } from "../../widgets/spinner-loader/SpinnerLoader.jsx";
import { DsSettingsCard } from "../ds-settings-card/DsSettingsCard.jsx";
import { StepCard } from "../step-card/StepCard.jsx";
import "./Steps.css";
+import { useExceptionHandler } from "../../../hooks/useExceptionHandler.jsx";
function Steps({ steps, setSteps, activeToolId, sourceMsg, destinationMsg }) {
const workflowStore = useWorkflowStore();
@@ -32,6 +30,7 @@ function Steps({ steps, setSteps, activeToolId, sourceMsg, destinationMsg }) {
const { sessionDetails } = useSessionStore();
const axiosPrivate = useAxiosPrivate();
const { setAlertDetails } = useAlertStore();
+ const handleException = useExceptionHandler();
useEffect(() => {
getWfEndpointDetails();
diff --git a/frontend/src/components/agency/tool-settings/ToolSettings.jsx b/frontend/src/components/agency/tool-settings/ToolSettings.jsx
index 7bbb75710..fc23419b8 100644
--- a/frontend/src/components/agency/tool-settings/ToolSettings.jsx
+++ b/frontend/src/components/agency/tool-settings/ToolSettings.jsx
@@ -1,7 +1,6 @@
import PropTypes from "prop-types";
import { createRef, useEffect, useState } from "react";
-import { handleException } from "../../../helpers/GetStaticData.js";
import { useAxiosPrivate } from "../../../hooks/useAxiosPrivate";
import { RjsfFormLayout } from "../../../layouts/rjsf-form-layout/RjsfFormLayout.jsx";
import { useAlertStore } from "../../../store/alert-store";
@@ -10,6 +9,7 @@ import { useToolSettingsStore } from "../../../store/tool-settings";
import { useWorkflowStore } from "../../../store/workflow-store";
import { CustomButton } from "../../widgets/custom-button/CustomButton.jsx";
import "./ToolSettings.css";
+import { useExceptionHandler } from "../../../hooks/useExceptionHandler.jsx";
function ToolSettings({ spec, isSpecLoading }) {
const formRef = createRef(null);
@@ -19,6 +19,7 @@ function ToolSettings({ spec, isSpecLoading }) {
const { toolSettings } = useToolSettingsStore();
const { updateMetadata, getMetadata, isLoading } = useWorkflowStore();
const axiosPrivate = useAxiosPrivate();
+ const handleException = useExceptionHandler();
useEffect(() => {
// Set existing metadata
diff --git a/frontend/src/components/agency/tools/Tools.jsx b/frontend/src/components/agency/tools/Tools.jsx
index b7d860c79..2b95494bd 100644
--- a/frontend/src/components/agency/tools/Tools.jsx
+++ b/frontend/src/components/agency/tools/Tools.jsx
@@ -1,15 +1,14 @@
import debounce from "lodash/debounce";
import { useCallback, useEffect, useState } from "react";
-
import { SearchOutlined } from "@ant-design/icons";
import { Input } from "antd";
import "./Tools.css";
-import { handleException } from "../../../helpers/GetStaticData";
import { useAxiosPrivate } from "../../../hooks/useAxiosPrivate";
import { useAlertStore } from "../../../store/alert-store";
import { useSessionStore } from "../../../store/session-store";
import { ListOfTools } from "../list-of-tools/ListOfTools";
+import { useExceptionHandler } from "../../../hooks/useExceptionHandler";
function Tools() {
const [listOfTools, setListOfTools] = useState([]);
@@ -19,6 +18,7 @@ function Tools() {
const { setAlertDetails } = useAlertStore();
const { sessionDetails } = useSessionStore();
const axiosPrivate = useAxiosPrivate();
+ const handleException = useExceptionHandler();
useEffect(() => {
setLoading(true);
diff --git a/frontend/src/components/custom-tools/add-custom-tool-form-modal/AddCustomToolFormModal.jsx b/frontend/src/components/custom-tools/add-custom-tool-form-modal/AddCustomToolFormModal.jsx
index 509559755..16aecfa65 100644
--- a/frontend/src/components/custom-tools/add-custom-tool-form-modal/AddCustomToolFormModal.jsx
+++ b/frontend/src/components/custom-tools/add-custom-tool-form-modal/AddCustomToolFormModal.jsx
@@ -3,13 +3,11 @@ import { Form, Input, Modal, Popover, Button } from "antd";
import PropTypes from "prop-types";
import EmojiPicker from "emoji-picker-react";
-import {
- handleException,
- getBackendErrorDetail,
-} from "../../../helpers/GetStaticData";
+import { getBackendErrorDetail } from "../../../helpers/GetStaticData";
import { useAlertStore } from "../../../store/alert-store";
import "./AddCustomToolFormModal.css";
+import { useExceptionHandler } from "../../../hooks/useExceptionHandler";
const defaultFromDetails = {
tool_name: "",
author: "",
@@ -27,6 +25,7 @@ function AddCustomToolFormModal({
const [form] = Form.useForm();
const [isLoading, setIsLoading] = useState(false);
const { setAlertDetails } = useAlertStore();
+ const handleException = useExceptionHandler();
const [showEmojiPicker, setShowEmojiPicker] = useState(false);
const [formDetails, setFormDetails] = useState(
isEdit ? { ...editItem } : { ...defaultFromDetails }
diff --git a/frontend/src/components/custom-tools/add-llm-profile-modal/AddLlmProfileModal.jsx b/frontend/src/components/custom-tools/add-llm-profile-modal/AddLlmProfileModal.jsx
index 8a4609ac6..39ec3661a 100644
--- a/frontend/src/components/custom-tools/add-llm-profile-modal/AddLlmProfileModal.jsx
+++ b/frontend/src/components/custom-tools/add-llm-profile-modal/AddLlmProfileModal.jsx
@@ -15,10 +15,7 @@ import {
import PropTypes from "prop-types";
import { useEffect, useState } from "react";
-import {
- getBackendErrorDetail,
- handleException,
-} from "../../../helpers/GetStaticData";
+import { getBackendErrorDetail } from "../../../helpers/GetStaticData";
import { useAxiosPrivate } from "../../../hooks/useAxiosPrivate";
import { useAlertStore } from "../../../store/alert-store";
import { useCustomToolStore } from "../../../store/custom-tool-store";
@@ -26,6 +23,7 @@ import { useSessionStore } from "../../../store/session-store";
import { CustomButton } from "../../widgets/custom-button/CustomButton";
import SpaceWrapper from "../../widgets/space-wrapper/SpaceWrapper";
import "./AddLlmProfileModal.css";
+import { useExceptionHandler } from "../../../hooks/useExceptionHandler";
function AddLlmProfileModal({
open,
@@ -52,6 +50,7 @@ function AddLlmProfileModal({
const { setAlertDetails } = useAlertStore();
const axiosPrivate = useAxiosPrivate();
const { token } = theme.useToken();
+ const handleException = useExceptionHandler();
const panelStyle = {
marginBottom: 16,
};
diff --git a/frontend/src/components/custom-tools/combined-output/CombinedOutput.jsx b/frontend/src/components/custom-tools/combined-output/CombinedOutput.jsx
index 181993bcf..ed011562a 100644
--- a/frontend/src/components/custom-tools/combined-output/CombinedOutput.jsx
+++ b/frontend/src/components/custom-tools/combined-output/CombinedOutput.jsx
@@ -8,13 +8,14 @@ import "prismjs/themes/prism.css";
import { useEffect, useState } from "react";
import PropTypes from "prop-types";
-import { handleException, promptType } from "../../../helpers/GetStaticData";
+import { promptType } from "../../../helpers/GetStaticData";
import { useAxiosPrivate } from "../../../hooks/useAxiosPrivate";
import { useAlertStore } from "../../../store/alert-store";
import { useCustomToolStore } from "../../../store/custom-tool-store";
import { useSessionStore } from "../../../store/session-store";
import { SpinnerLoader } from "../../widgets/spinner-loader/SpinnerLoader";
import "./CombinedOutput.css";
+import { useExceptionHandler } from "../../../hooks/useExceptionHandler";
const outputTypes = {
json: "JSON",
@@ -32,6 +33,7 @@ function CombinedOutput({ docId, setFilledFields }) {
const { sessionDetails } = useSessionStore();
const { setAlertDetails } = useAlertStore();
const axiosPrivate = useAxiosPrivate();
+ const handleException = useExceptionHandler();
useEffect(() => {
if (!docId) {
diff --git a/frontend/src/components/custom-tools/custom-synonyms/CustomSynonyms.jsx b/frontend/src/components/custom-tools/custom-synonyms/CustomSynonyms.jsx
index 6370090b9..e35307556 100644
--- a/frontend/src/components/custom-tools/custom-synonyms/CustomSynonyms.jsx
+++ b/frontend/src/components/custom-tools/custom-synonyms/CustomSynonyms.jsx
@@ -3,7 +3,6 @@ import { Button, Input, Select, Space, Table, Typography } from "antd";
import PropTypes from "prop-types";
import { useEffect, useState } from "react";
-import { handleException } from "../../../helpers/GetStaticData";
import { useAxiosPrivate } from "../../../hooks/useAxiosPrivate";
import { useAlertStore } from "../../../store/alert-store";
import { useCustomToolStore } from "../../../store/custom-tool-store";
@@ -12,6 +11,7 @@ import { ConfirmModal } from "../../widgets/confirm-modal/ConfirmModal";
import { CustomButton } from "../../widgets/custom-button/CustomButton";
import SpaceWrapper from "../../widgets/space-wrapper/SpaceWrapper";
import "./CustomSynonyms.css";
+import { useExceptionHandler } from "../../../hooks/useExceptionHandler";
const columns = [
{
@@ -41,6 +41,7 @@ function CustomSynonyms({ setOpen }) {
const { details, updateCustomTool } = useCustomToolStore();
const { setAlertDetails } = useAlertStore();
const axiosPrivate = useAxiosPrivate();
+ const handleException = useExceptionHandler();
useEffect(() => {
const promptGrammar = details?.prompt_grammer;
diff --git a/frontend/src/components/custom-tools/document-parser/DocumentParser.jsx b/frontend/src/components/custom-tools/document-parser/DocumentParser.jsx
index 2528f1c66..e36271699 100644
--- a/frontend/src/components/custom-tools/document-parser/DocumentParser.jsx
+++ b/frontend/src/components/custom-tools/document-parser/DocumentParser.jsx
@@ -3,7 +3,6 @@ import { useEffect, useRef, useState } from "react";
import "./DocumentParser.css";
import {
- handleException,
promptStudioUpdateStatus,
promptType,
} from "../../../helpers/GetStaticData";
@@ -14,6 +13,7 @@ import { useSessionStore } from "../../../store/session-store";
import { EmptyState } from "../../widgets/empty-state/EmptyState";
import { NotesCard } from "../notes-card/NotesCard";
import { PromptCard } from "../prompt-card/PromptCard";
+import { useExceptionHandler } from "../../../hooks/useExceptionHandler";
function DocumentParser({
setOpenAddLlmModal,
@@ -30,6 +30,7 @@ function DocumentParser({
const { sessionDetails } = useSessionStore();
const { setAlertDetails } = useAlertStore();
const axiosPrivate = useAxiosPrivate();
+ const handleException = useExceptionHandler();
useEffect(() => {
if (scrollToBottom) {
diff --git a/frontend/src/components/custom-tools/header/Header.jsx b/frontend/src/components/custom-tools/header/Header.jsx
index 7b80b7892..b9bb05587 100644
--- a/frontend/src/components/custom-tools/header/Header.jsx
+++ b/frontend/src/components/custom-tools/header/Header.jsx
@@ -13,7 +13,6 @@ import { useEffect, useState } from "react";
import { useNavigate } from "react-router-dom";
import "./Header.css";
-import { handleException } from "../../../helpers/GetStaticData";
import { useAxiosPrivate } from "../../../hooks/useAxiosPrivate";
import { useAlertStore } from "../../../store/alert-store";
import { useCustomToolStore } from "../../../store/custom-tool-store";
@@ -21,6 +20,7 @@ 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;
@@ -47,6 +47,7 @@ function Header({
const { setAlertDetails } = useAlertStore();
const axiosPrivate = useAxiosPrivate();
const navigate = useNavigate();
+ const handleException = useExceptionHandler();
useEffect(() => {
getLlmProfilesDropdown();
diff --git a/frontend/src/components/custom-tools/list-of-tools/ListOfTools.jsx b/frontend/src/components/custom-tools/list-of-tools/ListOfTools.jsx
index 7f2779c79..6a4a1b839 100644
--- a/frontend/src/components/custom-tools/list-of-tools/ListOfTools.jsx
+++ b/frontend/src/components/custom-tools/list-of-tools/ListOfTools.jsx
@@ -7,9 +7,9 @@ import { useSessionStore } from "../../../store/session-store";
import { CustomButton } from "../../widgets/custom-button/CustomButton";
import { AddCustomToolFormModal } from "../add-custom-tool-form-modal/AddCustomToolFormModal";
import { ViewTools } from "../view-tools/ViewTools";
-import { handleException } from "../../../helpers/GetStaticData";
-import { ToolNavBar } from "../../navigations/tool-nav-bar/ToolNavBar";
import "./ListOfTools.css";
+import { useExceptionHandler } from "../../../hooks/useExceptionHandler";
+import { ToolNavBar } from "../../navigations/tool-nav-bar/ToolNavBar";
function ListOfTools() {
const [isListLoading, setIsListLoading] = useState(false);
@@ -20,7 +20,8 @@ function ListOfTools() {
const axiosPrivate = useAxiosPrivate();
const [listOfTools, setListOfTools] = useState([]);
- const [filteredListOfTools, setFilteredListOfTools] = useState(listOfTools);
+ const [filteredListOfTools, setFilteredListOfTools] = useState([]);
+ const handleException = useExceptionHandler();
const [isEdit, setIsEdit] = useState(false);
useEffect(() => {
@@ -130,6 +131,10 @@ function ListOfTools() {
(filterToll) => filterToll?.tool_id !== tool.tool_id
);
setListOfTools(tools);
+ setAlertDetails({
+ type: "success",
+ console: "Deleted successfully ",
+ });
})
.catch((err) => {
setAlertDetails({
diff --git a/frontend/src/components/custom-tools/manage-docs-modal/ManageDocsModal.jsx b/frontend/src/components/custom-tools/manage-docs-modal/ManageDocsModal.jsx
index 077b73f0c..14122ae4d 100644
--- a/frontend/src/components/custom-tools/manage-docs-modal/ManageDocsModal.jsx
+++ b/frontend/src/components/custom-tools/manage-docs-modal/ManageDocsModal.jsx
@@ -21,7 +21,6 @@ import {
import PropTypes from "prop-types";
import { useEffect, useState } from "react";
-import { handleException } from "../../../helpers/GetStaticData";
import { useAxiosPrivate } from "../../../hooks/useAxiosPrivate";
import { useAlertStore } from "../../../store/alert-store";
import { useCustomToolStore } from "../../../store/custom-tool-store";
@@ -30,6 +29,7 @@ import { ConfirmModal } from "../../widgets/confirm-modal/ConfirmModal";
import { EmptyState } from "../../widgets/empty-state/EmptyState";
import SpaceWrapper from "../../widgets/space-wrapper/SpaceWrapper";
import "./ManageDocsModal.css";
+import { useExceptionHandler } from "../../../hooks/useExceptionHandler";
import { SpinnerLoader } from "../../widgets/spinner-loader/SpinnerLoader";
const indexTypes = {
@@ -66,6 +66,7 @@ function ManageDocsModal({
indexDocs,
} = useCustomToolStore();
const axiosPrivate = useAxiosPrivate();
+ const handleException = useExceptionHandler();
const successIndex = (
<Typography.Text>
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 08bed93b5..48b076dbc 100644
--- a/frontend/src/components/custom-tools/manage-llm-profiles/ManageLlmProfiles.jsx
+++ b/frontend/src/components/custom-tools/manage-llm-profiles/ManageLlmProfiles.jsx
@@ -3,7 +3,6 @@ import { Button, Radio, Space, Table, Typography } from "antd";
import PropTypes from "prop-types";
import { useEffect, useState } from "react";
-import { handleException } from "../../../helpers/GetStaticData";
import { useAxiosPrivate } from "../../../hooks/useAxiosPrivate";
import { useAlertStore } from "../../../store/alert-store";
import { useCustomToolStore } from "../../../store/custom-tool-store";
@@ -12,6 +11,7 @@ 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";
const columns = [
{
@@ -70,6 +70,7 @@ function ManageLlmProfiles({
const { details, defaultLlmProfile, updateCustomTool, llmProfiles } =
useCustomToolStore();
const { setAlertDetails } = useAlertStore();
+ const handleException = useExceptionHandler();
const handleDefaultLlm = (profileId) => {
const body = {
diff --git a/frontend/src/components/custom-tools/output-analyzer-card/OutputAnalyzerCard.jsx b/frontend/src/components/custom-tools/output-analyzer-card/OutputAnalyzerCard.jsx
index de61075d7..9e1b67f6d 100644
--- a/frontend/src/components/custom-tools/output-analyzer-card/OutputAnalyzerCard.jsx
+++ b/frontend/src/components/custom-tools/output-analyzer-card/OutputAnalyzerCard.jsx
@@ -1,7 +1,8 @@
import { Col, Divider, Flex, Row, Space, Typography } from "antd";
import PropTypes from "prop-types";
import { useEffect, useState } from "react";
-import { base64toBlob, handleException } from "../../../helpers/GetStaticData";
+
+import { base64toBlob } from "../../../helpers/GetStaticData";
import { useAlertStore } from "../../../store/alert-store";
import { useAxiosPrivate } from "../../../hooks/useAxiosPrivate";
import { PdfViewer } from "../pdf-viewer/PdfViewer";
@@ -9,6 +10,7 @@ import { useSessionStore } from "../../../store/session-store";
import { useCustomToolStore } from "../../../store/custom-tool-store";
import { CombinedOutput } from "../combined-output/CombinedOutput";
import { DocumentViewer } from "../document-viewer/DocumentViewer";
+import { useExceptionHandler } from "../../../hooks/useExceptionHandler";
function OutputAnalyzerCard({ doc, totalFields }) {
const [fileUrl, setFileUrl] = useState("");
@@ -18,6 +20,7 @@ function OutputAnalyzerCard({ doc, totalFields }) {
const { sessionDetails } = useSessionStore();
const { setAlertDetails } = useAlertStore();
const axiosPrivate = useAxiosPrivate();
+ const handleException = useExceptionHandler();
useEffect(() => {
if (!doc) {
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 a43130ba7..0d083fa5b 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,13 +1,12 @@
import { Button, Input, Modal, Space, Typography } from "antd";
import PropTypes from "prop-types";
-
import { useEffect, useState } from "react";
import "./PreAndPostAmbleModal.css";
-import { handleException } from "../../../helpers/GetStaticData";
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";
const fieldNames = {
preamble: "PREAMBLE",
@@ -19,6 +18,7 @@ function PreAndPostAmbleModal({ isOpen, closeModal, type, handleUpdateTool }) {
const [text, setText] = useState("");
const { details, updateCustomTool } = useCustomToolStore();
const { setAlertDetails } = useAlertStore();
+ const handleException = useExceptionHandler();
useEffect(() => {
if (!isOpen) {
diff --git a/frontend/src/components/custom-tools/prompt-card/PromptCard.jsx b/frontend/src/components/custom-tools/prompt-card/PromptCard.jsx
index 633de4d87..d9a280ad3 100644
--- a/frontend/src/components/custom-tools/prompt-card/PromptCard.jsx
+++ b/frontend/src/components/custom-tools/prompt-card/PromptCard.jsx
@@ -32,7 +32,6 @@ import { useCallback, useEffect, useRef, useState } from "react";
import { AssertionIcon } from "../../../assets";
import {
displayPromptResult,
- handleException,
promptStudioUpdateStatus,
} from "../../../helpers/GetStaticData";
import { useAxiosPrivate } from "../../../hooks/useAxiosPrivate";
@@ -45,6 +44,7 @@ import { SpinnerLoader } from "../../widgets/spinner-loader/SpinnerLoader";
import { EditableText } from "../editable-text/EditableText";
import { OutputForDocModal } from "../output-for-doc-modal/OutputForDocModal";
import "./PromptCard.css";
+import { useExceptionHandler } from "../../../hooks/useExceptionHandler";
let EvalBtn = null;
let EvalMetrics = null;
@@ -108,6 +108,7 @@ function PromptCard({
const { sessionDetails } = useSessionStore();
const { setAlertDetails } = useAlertStore();
const axiosPrivate = useAxiosPrivate();
+ const handleException = useExceptionHandler();
useEffect(() => {
if (promptDetails?.is_assert) {
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
index 0b9b76965..909f4583e 100644
--- a/frontend/src/components/custom-tools/select-llm-profile-modal/SelectLlmProfileModal.jsx
+++ b/frontend/src/components/custom-tools/select-llm-profile-modal/SelectLlmProfileModal.jsx
@@ -14,9 +14,9 @@ import { useCallback, useEffect, useState } from "react";
import debounce from "lodash/debounce";
import { useCustomToolStore } from "../../../store/custom-tool-store";
-import { handleException } from "../../../helpers/GetStaticData";
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",
@@ -39,6 +39,7 @@ function SelectLlmProfileModal({
const [isLoading, setIsLoading] = useState(false);
const { details, updateCustomTool } = useCustomToolStore();
const { setAlertDetails } = useAlertStore();
+ const handleException = useExceptionHandler();
useEffect(() => {
setPrompt(details?.summarize_prompt);
diff --git a/frontend/src/components/custom-tools/tool-ide/ToolIde.jsx b/frontend/src/components/custom-tools/tool-ide/ToolIde.jsx
index 429ceb4cc..b9d8a3a26 100644
--- a/frontend/src/components/custom-tools/tool-ide/ToolIde.jsx
+++ b/frontend/src/components/custom-tools/tool-ide/ToolIde.jsx
@@ -2,7 +2,6 @@ import { FullscreenExitOutlined, FullscreenOutlined } from "@ant-design/icons";
import { Col, Collapse, Modal, Row } from "antd";
import { useState } from "react";
-import { handleException } from "../../../helpers/GetStaticData";
import { useAxiosPrivate } from "../../../hooks/useAxiosPrivate";
import { IslandLayout } from "../../../layouts/island-layout/IslandLayout";
import { useAlertStore } from "../../../store/alert-store";
@@ -16,6 +15,7 @@ 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";
function ToolIde() {
const [showLogsModal, setShowLogsModal] = useState(false);
@@ -36,6 +36,7 @@ function ToolIde() {
const { sessionDetails } = useSessionStore();
const { setAlertDetails } = useAlertStore();
const axiosPrivate = useAxiosPrivate();
+ const handleException = useExceptionHandler();
const openLogsModal = () => {
setShowLogsModal(true);
diff --git a/frontend/src/components/custom-tools/tools-main/ToolsMain.jsx b/frontend/src/components/custom-tools/tools-main/ToolsMain.jsx
index bb4b38637..d081b5d3f 100644
--- a/frontend/src/components/custom-tools/tools-main/ToolsMain.jsx
+++ b/frontend/src/components/custom-tools/tools-main/ToolsMain.jsx
@@ -2,7 +2,7 @@ import { Tabs } from "antd";
import PropTypes from "prop-types";
import { useEffect, useState } from "react";
-import { handleException, promptType } from "../../../helpers/GetStaticData";
+import { promptType } from "../../../helpers/GetStaticData";
import { useAxiosPrivate } from "../../../hooks/useAxiosPrivate";
import { useAlertStore } from "../../../store/alert-store";
import { useCustomToolStore } from "../../../store/custom-tool-store";
@@ -11,6 +11,7 @@ import { CombinedOutput } from "../combined-output/CombinedOutput";
import { DocumentParser } from "../document-parser/DocumentParser";
import { Footer } from "../footer/Footer";
import "./ToolsMain.css";
+import { useExceptionHandler } from "../../../hooks/useExceptionHandler";
function ToolsMain({ setOpenAddLlmModal }) {
const [activeKey, setActiveKey] = useState("1");
@@ -26,6 +27,7 @@ function ToolsMain({ setOpenAddLlmModal }) {
} = useCustomToolStore();
const { setAlertDetails } = useAlertStore();
const axiosPrivate = useAxiosPrivate();
+ const handleException = useExceptionHandler();
const items = [
{
diff --git a/frontend/src/components/custom-tools/view-tools/ViewTools.jsx b/frontend/src/components/custom-tools/view-tools/ViewTools.jsx
index 9bfb26ec2..c8f47b0d2 100644
--- a/frontend/src/components/custom-tools/view-tools/ViewTools.jsx
+++ b/frontend/src/components/custom-tools/view-tools/ViewTools.jsx
@@ -19,6 +19,7 @@ function ViewTools({
iconProp,
idProp,
centered,
+ isClickable = true,
}) {
if (isLoading) {
return <SpinnerLoader />;
@@ -54,6 +55,7 @@ function ViewTools({
titleProp={titleProp}
idProp={idProp}
centered={centered}
+ isClickable={isClickable}
/>
);
}
@@ -70,6 +72,7 @@ ViewTools.propTypes = {
iconProp: PropTypes.string,
idProp: PropTypes.string.isRequired,
centered: PropTypes.bool,
+ isClickable: PropTypes.bool,
};
export { ViewTools };
diff --git a/frontend/src/components/deployments/api-deployment/ApiDeployment.jsx b/frontend/src/components/deployments/api-deployment/ApiDeployment.jsx
index 9aacc95ff..15c1c7465 100644
--- a/frontend/src/components/deployments/api-deployment/ApiDeployment.jsx
+++ b/frontend/src/components/deployments/api-deployment/ApiDeployment.jsx
@@ -10,7 +10,7 @@ import { Button, Dropdown, Space, Switch, Tooltip, Typography } from "antd";
import { useEffect, useState } from "react";
import { useNavigate } from "react-router-dom";
-import { getBaseUrl, handleException } from "../../../helpers/GetStaticData";
+import { getBaseUrl } from "../../../helpers/GetStaticData";
import { useAlertStore } from "../../../store/alert-store";
import { useSessionStore } from "../../../store/session-store";
import { workflowService } from "../../workflows/workflow/workflow-service.js";
@@ -20,6 +20,7 @@ import { DisplayCode } from "../display-code/DisplayCode";
import { Layout } from "../layout/Layout";
import { ManageKeys } from "../manage-keys/ManageKeys";
import { apiDeploymentsService } from "./api-deployments-service";
+import { useExceptionHandler } from "../../../hooks/useExceptionHandler.jsx";
function ApiDeployment() {
const { sessionDetails } = useSessionStore();
@@ -37,6 +38,7 @@ function ApiDeployment() {
const [apiKeys, setApiKeys] = useState([]);
const [isEdit, setIsEdit] = useState(false);
const [workflowEndpointList, setWorkflowEndpointList] = useState([]);
+ const handleException = useExceptionHandler();
useEffect(() => {
getApiDeploymentList();
diff --git a/frontend/src/components/deployments/create-api-deployment-modal/CreateApiDeploymentModal.jsx b/frontend/src/components/deployments/create-api-deployment-modal/CreateApiDeploymentModal.jsx
index ef3433c53..81f47106c 100644
--- a/frontend/src/components/deployments/create-api-deployment-modal/CreateApiDeploymentModal.jsx
+++ b/frontend/src/components/deployments/create-api-deployment-modal/CreateApiDeploymentModal.jsx
@@ -2,12 +2,10 @@ import { Form, Input, Modal, Select } from "antd";
import PropTypes from "prop-types";
import { useEffect, useState } from "react";
-import {
- getBackendErrorDetail,
- handleException,
-} from "../../../helpers/GetStaticData.js";
+import { getBackendErrorDetail } from "../../../helpers/GetStaticData.js";
import { useAlertStore } from "../../../store/alert-store";
import { apiDeploymentsService } from "../../deployments/api-deployment/api-deployments-service.js";
+import { useExceptionHandler } from "../../../hooks/useExceptionHandler.jsx";
import { useWorkflowStore } from "../../../store/workflow-store.js";
const defaultFromDetails = {
@@ -32,6 +30,7 @@ const CreateApiDeploymentModal = ({
const { updateWorkflow } = workflowStore;
const apiDeploymentsApiService = apiDeploymentsService();
const { setAlertDetails } = useAlertStore();
+ const handleException = useExceptionHandler();
const { Option } = Select;
const [formDetails, setFormDetails] = useState(
diff --git a/frontend/src/components/deployments/manage-keys/ManageKeys.jsx b/frontend/src/components/deployments/manage-keys/ManageKeys.jsx
index dbca6c30a..c9c05cf28 100644
--- a/frontend/src/components/deployments/manage-keys/ManageKeys.jsx
+++ b/frontend/src/components/deployments/manage-keys/ManageKeys.jsx
@@ -8,7 +8,6 @@ import { Input, Modal, Space, Switch, Table, Tooltip, Typography } from "antd";
import PropTypes from "prop-types";
import { useEffect, useState } from "react";
-import { handleException } from "../../../helpers/GetStaticData.js";
import { useAxiosPrivate } from "../../../hooks/useAxiosPrivate";
import { useAlertStore } from "../../../store/alert-store";
import { useSessionStore } from "../../../store/session-store";
@@ -18,6 +17,7 @@ import SpaceWrapper from "../../widgets/space-wrapper/SpaceWrapper.jsx";
import { SpinnerLoader } from "../../widgets/spinner-loader/SpinnerLoader.jsx";
import { DeleteModal } from "../delete-modal/DeleteModal.jsx";
import "./ManageKeys.css";
+import { useExceptionHandler } from "../../../hooks/useExceptionHandler.jsx";
const ManageKeys = ({
isDialogOpen,
@@ -29,6 +29,7 @@ const ManageKeys = ({
const apiDeploymentsApiService = apiDeploymentsService();
const { sessionDetails } = useSessionStore();
const axiosPrivate = useAxiosPrivate();
+ const handleException = useExceptionHandler();
const [isTableLoading, setIsTableLoading] = useState(false);
const { setAlertDetails } = useAlertStore();
const [isNewKey, setIsNewKey] = useState(false);
diff --git a/frontend/src/components/helpers/custom-tools/CustomToolsHelper.js b/frontend/src/components/helpers/custom-tools/CustomToolsHelper.js
index 6844aaf7b..e57c6644f 100644
--- a/frontend/src/components/helpers/custom-tools/CustomToolsHelper.js
+++ b/frontend/src/components/helpers/custom-tools/CustomToolsHelper.js
@@ -1,13 +1,13 @@
import { useEffect, useState } from "react";
import { Outlet, useNavigate, useParams } from "react-router-dom";
-import { handleException } from "../../../helpers/GetStaticData";
import { useAxiosPrivate } from "../../../hooks/useAxiosPrivate";
import { useAlertStore } from "../../../store/alert-store";
import { useCustomToolStore } from "../../../store/custom-tool-store";
import { useSessionStore } from "../../../store/session-store";
import { SpinnerLoader } from "../../widgets/spinner-loader/SpinnerLoader";
import { SocketMessages } from "../socket-messages/SocketMessages";
+import { useExceptionHandler } from "../../../hooks/useExceptionHandler";
function CustomToolsHelper() {
const [isLoading, setIsLoading] = useState(true);
@@ -18,6 +18,7 @@ function CustomToolsHelper() {
const { setAlertDetails } = useAlertStore();
const navigate = useNavigate();
const axiosPrivate = useAxiosPrivate();
+ const handleException = useExceptionHandler();
useEffect(() => {
const updatedCusTool = {
diff --git a/frontend/src/components/helpers/project/ProjectHelper.js b/frontend/src/components/helpers/project/ProjectHelper.js
index f55aafef0..260d005d4 100644
--- a/frontend/src/components/helpers/project/ProjectHelper.js
+++ b/frontend/src/components/helpers/project/ProjectHelper.js
@@ -1,10 +1,7 @@
import { useEffect, useState } from "react";
import { Outlet, useNavigate, useParams } from "react-router-dom";
-import {
- handleException,
- workflowStatus,
-} from "../../../helpers/GetStaticData";
+import { workflowStatus } from "../../../helpers/GetStaticData";
import { useAxiosPrivate } from "../../../hooks/useAxiosPrivate";
import { MenuLayout } from "../../../layouts/menu-layout/MenuLayout";
import { useAlertStore } from "../../../store/alert-store";
@@ -12,6 +9,7 @@ import { useSessionStore } from "../../../store/session-store";
import { useToolSettingsStore } from "../../../store/tool-settings";
import { useWorkflowStore } from "../../../store/workflow-store";
import { SpinnerLoader } from "../../widgets/spinner-loader/SpinnerLoader.jsx";
+import { useExceptionHandler } from "../../../hooks/useExceptionHandler.jsx";
function ProjectHelper() {
const { id } = useParams();
@@ -22,6 +20,7 @@ function ProjectHelper() {
const axiosPrivate = useAxiosPrivate();
const [isWfLoading, setWfLoading] = useState(true);
const navigate = useNavigate();
+ const handleException = useExceptionHandler();
useEffect(() => {
return () => {
diff --git a/frontend/src/components/helpers/socket-messages/SocketMessages.js b/frontend/src/components/helpers/socket-messages/SocketMessages.js
index b0ad3ab36..4549d5e68 100644
--- a/frontend/src/components/helpers/socket-messages/SocketMessages.js
+++ b/frontend/src/components/helpers/socket-messages/SocketMessages.js
@@ -1,11 +1,11 @@
import PropTypes from "prop-types";
import { useContext, useEffect } from "react";
-import { handleException } from "../../../helpers/GetStaticData";
import { SocketContext } from "../../../helpers/SocketContext";
import { useAlertStore } from "../../../store/alert-store";
import { useSocketLogsStore } from "../../../store/socket-logs-store";
import { useSocketMessagesStore } from "../../../store/socket-messages-store";
+import { useExceptionHandler } from "../../../hooks/useExceptionHandler";
function SocketMessages({ logId }) {
const {
pushStagedMessage,
@@ -17,6 +17,7 @@ function SocketMessages({ logId }) {
const { pushLogMessages } = useSocketLogsStore();
const socket = useContext(SocketContext);
const { setAlertDetails } = useAlertStore();
+ const handleException = useExceptionHandler();
const onMessage = (data) => {
try {
diff --git a/frontend/src/components/input-output/add-source-modal/AddSourceModal.jsx b/frontend/src/components/input-output/add-source-modal/AddSourceModal.jsx
index b896bd257..00ddccc98 100644
--- a/frontend/src/components/input-output/add-source-modal/AddSourceModal.jsx
+++ b/frontend/src/components/input-output/add-source-modal/AddSourceModal.jsx
@@ -2,12 +2,13 @@ import { Modal } from "antd";
import PropTypes from "prop-types";
import { useEffect, useState } from "react";
-import { handleException, sourceTypes } from "../../../helpers/GetStaticData";
+import { sourceTypes } from "../../../helpers/GetStaticData";
import { useAxiosPrivate } from "../../../hooks/useAxiosPrivate";
import { useAlertStore } from "../../../store/alert-store";
import { useSessionStore } from "../../../store/session-store";
import { AddSource } from "../add-source/AddSource";
import { ListOfSources } from "../list-of-sources/ListOfSources";
+import { useExceptionHandler } from "../../../hooks/useExceptionHandler";
function AddSourceModal({
open,
@@ -23,6 +24,7 @@ function AddSourceModal({
const { sessionDetails } = useSessionStore();
const { setAlertDetails } = useAlertStore();
const axiosPrivate = useAxiosPrivate();
+ const handleException = useExceptionHandler();
useEffect(() => {
const addOrEdit = editItemId?.length ? "Edit" : "Add";
diff --git a/frontend/src/components/input-output/add-source/AddSource.jsx b/frontend/src/components/input-output/add-source/AddSource.jsx
index 05b1b92bd..189a76b66 100644
--- a/frontend/src/components/input-output/add-source/AddSource.jsx
+++ b/frontend/src/components/input-output/add-source/AddSource.jsx
@@ -2,12 +2,13 @@ import { Typography } from "antd";
import PropTypes from "prop-types";
import { useEffect, useState } from "react";
-import { handleException, sourceTypes } from "../../../helpers/GetStaticData";
+import { sourceTypes } from "../../../helpers/GetStaticData";
import { useAxiosPrivate } from "../../../hooks/useAxiosPrivate";
import { useAlertStore } from "../../../store/alert-store";
import { useSessionStore } from "../../../store/session-store";
import { EmptyState } from "../../widgets/empty-state/EmptyState";
import { ConfigureDs } from "../configure-ds/ConfigureDs";
+import { useExceptionHandler } from "../../../hooks/useExceptionHandler";
function AddSource({
selectedSourceId,
@@ -26,6 +27,7 @@ function AddSource({
const { sessionDetails } = useSessionStore();
const { setAlertDetails } = useAlertStore();
const axiosPrivate = useAxiosPrivate();
+ const handleException = useExceptionHandler();
useEffect(() => {
if (!selectedSourceId) {
diff --git a/frontend/src/components/input-output/configure-ds/ConfigureDs.jsx b/frontend/src/components/input-output/configure-ds/ConfigureDs.jsx
index 9618f7c7a..6be1bc4e8 100644
--- a/frontend/src/components/input-output/configure-ds/ConfigureDs.jsx
+++ b/frontend/src/components/input-output/configure-ds/ConfigureDs.jsx
@@ -3,10 +3,7 @@ import PropTypes from "prop-types";
import { createRef, useEffect, useState } from "react";
import { useParams } from "react-router-dom";
-import {
- handleException,
- sourceTypes,
-} from "../../../helpers/GetStaticData.js";
+import { sourceTypes } from "../../../helpers/GetStaticData.js";
import { useAxiosPrivate } from "../../../hooks/useAxiosPrivate";
import { RjsfFormLayout } from "../../../layouts/rjsf-form-layout/RjsfFormLayout.jsx";
import { useAlertStore } from "../../../store/alert-store";
@@ -14,6 +11,7 @@ import { useSessionStore } from "../../../store/session-store";
import { OAuthDs } from "../../oauth-ds/oauth-ds/OAuthDs.jsx";
import { CustomButton } from "../../widgets/custom-button/CustomButton.jsx";
import "./ConfigureDs.css";
+import { useExceptionHandler } from "../../../hooks/useExceptionHandler.jsx";
function ConfigureDs({
spec,
@@ -40,6 +38,7 @@ function ConfigureDs({
const [status, setStatus] = useState("");
const { sessionDetails } = useSessionStore();
const { setAlertDetails } = useAlertStore();
+ const handleException = useExceptionHandler();
const { id } = useParams();
@@ -212,15 +211,17 @@ function ConfigureDs({
const data = res?.data;
if (sourceTypes.connectors.includes(type)) {
handleUpdate({ connector_instance: data?.id });
- setAlertDetails({
- type: "success",
- content: "Successfully added connector",
- });
return;
}
if (data) {
addNewItem(data, !!editItemId);
}
+ setAlertDetails({
+ type: "success",
+ content: `Successfully ${
+ method === "POST" ? "added" : "updated"
+ } connector`,
+ });
setOpen(false);
})
.catch((err) => {
diff --git a/frontend/src/components/input-output/input-output/InputOutput.jsx b/frontend/src/components/input-output/input-output/InputOutput.jsx
index 2d899fdd0..a8059ce0f 100644
--- a/frontend/src/components/input-output/input-output/InputOutput.jsx
+++ b/frontend/src/components/input-output/input-output/InputOutput.jsx
@@ -2,10 +2,7 @@ import { Col, Image, Row } from "antd";
import { useEffect, useState } from "react";
import { useLocation, useParams } from "react-router-dom";
-import {
- CONNECTOR_TYPE_MAP,
- handleException,
-} from "../../../helpers/GetStaticData.js";
+import { CONNECTOR_TYPE_MAP } from "../../../helpers/GetStaticData.js";
import { useAxiosPrivate } from "../../../hooks/useAxiosPrivate";
import { useAlertStore } from "../../../store/alert-store";
import { useSessionStore } from "../../../store/session-store";
@@ -13,6 +10,7 @@ import { AddSourceModal } from "../add-source-modal/AddSourceModal.jsx";
import { ManageFiles } from "../manage-files/ManageFiles.jsx";
import { Sidebar } from "../sidebar/Sidebar.jsx";
import "./InputOutput.css";
+import { useExceptionHandler } from "../../../hooks/useExceptionHandler.jsx";
const INPUT = "input";
const OUTPUT = "output";
@@ -27,6 +25,7 @@ function InputOutput() {
const { setAlertDetails } = useAlertStore();
const { id } = useParams();
const axiosPrivate = useAxiosPrivate();
+ const handleException = useExceptionHandler();
const location = useLocation();
const currentPath = location.pathname;
diff --git a/frontend/src/components/input-output/list-of-sources/ListOfSources.jsx b/frontend/src/components/input-output/list-of-sources/ListOfSources.jsx
index f2413fcca..98a8b05b3 100644
--- a/frontend/src/components/input-output/list-of-sources/ListOfSources.jsx
+++ b/frontend/src/components/input-output/list-of-sources/ListOfSources.jsx
@@ -4,13 +4,14 @@ import debounce from "lodash/debounce";
import PropTypes from "prop-types";
import { useCallback, useEffect, useState } from "react";
-import { handleException, sourceTypes } from "../../../helpers/GetStaticData";
+import { sourceTypes } from "../../../helpers/GetStaticData";
import { useAxiosPrivate } from "../../../hooks/useAxiosPrivate";
import { useAlertStore } from "../../../store/alert-store";
import { useSessionStore } from "../../../store/session-store";
import { SpinnerLoader } from "../../widgets/spinner-loader/SpinnerLoader";
import { DataSourceCard } from "../data-source-card/DataSourceCard";
import "./ListOfSources.css";
+import { useExceptionHandler } from "../../../hooks/useExceptionHandler";
function ListOfSources({ setSelectedSourceId, type }) {
const [sourcesList, setSourcesList] = useState([]);
@@ -20,6 +21,7 @@ function ListOfSources({ setSelectedSourceId, type }) {
const { sessionDetails } = useSessionStore();
const { setAlertDetails } = useAlertStore();
const axiosPrivate = useAxiosPrivate();
+ const handleException = useExceptionHandler();
useEffect(() => {
if (searchText?.length === 0) {
diff --git a/frontend/src/components/oauth-ds/oauth-ds/OAuthDs.jsx b/frontend/src/components/oauth-ds/oauth-ds/OAuthDs.jsx
index 1477b1460..65e0c868b 100644
--- a/frontend/src/components/oauth-ds/oauth-ds/OAuthDs.jsx
+++ b/frontend/src/components/oauth-ds/oauth-ds/OAuthDs.jsx
@@ -2,17 +2,15 @@ import { Typography } from "antd";
import PropTypes from "prop-types";
import { useEffect, useState } from "react";
-import {
- O_AUTH_PROVIDERS,
- getBaseUrl,
- handleException,
-} from "../../../helpers/GetStaticData";
+import { O_AUTH_PROVIDERS, getBaseUrl } from "../../../helpers/GetStaticData";
import { useAxiosPrivate } from "../../../hooks/useAxiosPrivate.js";
import { useAlertStore } from "../../../store/alert-store";
import GoogleOAuthButton from "../google/GoogleOAuthButton.jsx";
+import { useExceptionHandler } from "../../../hooks/useExceptionHandler.jsx";
function OAuthDs({ oAuthProvider, setCacheKey, setStatus }) {
const axiosPrivate = useAxiosPrivate();
const { setAlertDetails } = useAlertStore();
+ const handleException = useExceptionHandler();
const [oauthStatus, setOAuthStatus] = useState(
localStorage.getItem("oauth-status")
diff --git a/frontend/src/components/pipelines-or-deployments/etl-task-deploy/EtlTaskDeploy.jsx b/frontend/src/components/pipelines-or-deployments/etl-task-deploy/EtlTaskDeploy.jsx
index 54c20df3b..b01b13c8a 100644
--- a/frontend/src/components/pipelines-or-deployments/etl-task-deploy/EtlTaskDeploy.jsx
+++ b/frontend/src/components/pipelines-or-deployments/etl-task-deploy/EtlTaskDeploy.jsx
@@ -5,7 +5,6 @@ import { isValidCron } from "cron-validator";
import PropTypes from "prop-types";
import { useEffect, useState } from "react";
-import { handleException } from "../../../helpers/GetStaticData.js";
import { useAxiosPrivate } from "../../../hooks/useAxiosPrivate.js";
import { useAlertStore } from "../../../store/alert-store";
import { useSessionStore } from "../../../store/session-store";
@@ -14,6 +13,7 @@ import SpaceWrapper from "../../widgets/space-wrapper/SpaceWrapper.jsx";
import { SpinnerLoader } from "../../widgets/spinner-loader/SpinnerLoader.jsx";
import { workflowService } from "../../workflows/workflow/workflow-service.js";
import "./EtlTaskDeploy.css";
+import { useExceptionHandler } from "../../../hooks/useExceptionHandler.jsx";
import { useWorkflowStore } from "../../../store/workflow-store.js";
const days = [
@@ -46,6 +46,7 @@ const EtlTaskDeploy = ({
const { setAlertDetails } = useAlertStore();
const axiosPrivate = useAxiosPrivate();
const workflowApiService = workflowService();
+ const handleException = useExceptionHandler();
const { Option } = Select;
const [workflowList, setWorkflowList] = useState([]);
diff --git a/frontend/src/components/pipelines-or-deployments/pipelines/Pipelines.jsx b/frontend/src/components/pipelines-or-deployments/pipelines/Pipelines.jsx
index 89360ecc2..9cedeaebd 100644
--- a/frontend/src/components/pipelines-or-deployments/pipelines/Pipelines.jsx
+++ b/frontend/src/components/pipelines-or-deployments/pipelines/Pipelines.jsx
@@ -11,10 +11,7 @@ import { Dropdown, Image, Space, Switch, Typography } from "antd";
import PropTypes from "prop-types";
import { useEffect, useState } from "react";
-import {
- deploymentsStaticContent,
- handleException,
-} from "../../../helpers/GetStaticData";
+import { deploymentsStaticContent } from "../../../helpers/GetStaticData";
import { useAxiosPrivate } from "../../../hooks/useAxiosPrivate.js";
import { useAlertStore } from "../../../store/alert-store.js";
import { useSessionStore } from "../../../store/session-store.js";
@@ -24,7 +21,7 @@ import { SpinnerLoader } from "../../widgets/spinner-loader/SpinnerLoader.jsx";
import { DeleteModal } from "../delete-modal/DeleteModal.jsx";
import { EtlTaskDeploy } from "../etl-task-deploy/EtlTaskDeploy.jsx";
import "./Pipelines.css";
-import { formattedDateTime } from "../../../helpers/GetStaticData";
+import { useExceptionHandler } from "../../../hooks/useExceptionHandler.jsx";
function Pipelines({ type }) {
const [tableData, setTableData] = useState([]);
@@ -36,6 +33,7 @@ function Pipelines({ type }) {
const { sessionDetails } = useSessionStore();
const { setAlertDetails } = useAlertStore();
const axiosPrivate = useAxiosPrivate();
+ const handleException = useExceptionHandler();
useEffect(() => {
getPipelineList();
@@ -389,7 +387,7 @@ function Pipelines({ type }) {
render: (_, record) => (
<div>
<Typography.Text className="p-or-d-typography" strong>
- {formattedDateTime(record?.last_run_time)}
+ {record?.last_run_time}
</Typography.Text>
</div>
),
diff --git a/frontend/src/components/settings/default-triad/DefaultTriad.jsx b/frontend/src/components/settings/default-triad/DefaultTriad.jsx
index ae01a92e1..fcf64bc54 100644
--- a/frontend/src/components/settings/default-triad/DefaultTriad.jsx
+++ b/frontend/src/components/settings/default-triad/DefaultTriad.jsx
@@ -3,7 +3,6 @@ import { Button, Select, Typography } from "antd";
import { useEffect, useState } from "react";
import { useNavigate } from "react-router-dom";
-import { handleException } from "../../../helpers/GetStaticData.js";
import { useAxiosPrivate } from "../../../hooks/useAxiosPrivate";
import { IslandLayout } from "../../../layouts/island-layout/IslandLayout.jsx";
import { useAlertStore } from "../../../store/alert-store";
@@ -11,6 +10,7 @@ import { useSessionStore } from "../../../store/session-store";
import { CustomButton } from "../../widgets/custom-button/CustomButton.jsx";
import SpaceWrapper from "../../widgets/space-wrapper/SpaceWrapper.jsx";
import "./DefaultTriad.css";
+import { useExceptionHandler } from "../../../hooks/useExceptionHandler.jsx";
const { Option } = Select;
@@ -19,6 +19,7 @@ function DefaultTriad() {
const { sessionDetails } = useSessionStore();
const axiosPrivate = useAxiosPrivate();
const { setAlertDetails } = useAlertStore();
+ const handleException = useExceptionHandler();
const [adaptorsList, setAdaptorsList] = useState([]);
const [currentLLMDefault, setCurrentLLMDefault] = useState();
diff --git a/frontend/src/components/settings/invite/InviteEditUser.jsx b/frontend/src/components/settings/invite/InviteEditUser.jsx
index 106c3c756..034518fd7 100644
--- a/frontend/src/components/settings/invite/InviteEditUser.jsx
+++ b/frontend/src/components/settings/invite/InviteEditUser.jsx
@@ -2,7 +2,6 @@ import { Form, Input, Select } from "antd";
import { useEffect, useState } from "react";
import { useLocation, useNavigate } from "react-router-dom";
-import { handleException } from "../../../helpers/GetStaticData.js";
import { useAxiosPrivate } from "../../../hooks/useAxiosPrivate";
import { IslandLayout } from "../../../layouts/island-layout/IslandLayout.jsx";
import { useAlertStore } from "../../../store/alert-store";
@@ -11,6 +10,7 @@ import { CustomButton } from "../../widgets/custom-button/CustomButton.jsx";
import { SpinnerLoader } from "../../widgets/spinner-loader/SpinnerLoader.jsx";
import { TopBar } from "../../widgets/top-bar/TopBar.jsx";
import "./InviteEditUser.css";
+import { useExceptionHandler } from "../../../hooks/useExceptionHandler.jsx";
function InviteEditUser() {
const axiosPrivate = useAxiosPrivate();
@@ -18,6 +18,7 @@ function InviteEditUser() {
const { setAlertDetails } = useAlertStore();
const location = useLocation();
const navigate = useNavigate();
+ const handleException = useExceptionHandler();
const [userRoles, setUserRoles] = useState();
const [loading, setLoading] = useState(true);
const [submitLoading, setSubmitLoading] = useState(false);
diff --git a/frontend/src/components/settings/platform/PlatformSettings.jsx b/frontend/src/components/settings/platform/PlatformSettings.jsx
index c58164e88..e2313948c 100644
--- a/frontend/src/components/settings/platform/PlatformSettings.jsx
+++ b/frontend/src/components/settings/platform/PlatformSettings.jsx
@@ -7,13 +7,13 @@ import { Button, Col, Divider, Input, Radio, Row, Typography } from "antd";
import { useEffect, useState } from "react";
import { useNavigate } from "react-router-dom";
-import { handleException } from "../../../helpers/GetStaticData.js";
import { useAxiosPrivate } from "../../../hooks/useAxiosPrivate";
import { IslandLayout } from "../../../layouts/island-layout/IslandLayout.jsx";
import { useAlertStore } from "../../../store/alert-store";
import { useSessionStore } from "../../../store/session-store";
import { ConfirmModal } from "../../widgets/confirm-modal/ConfirmModal.jsx";
import "./PlatformSettings.css";
+import { useExceptionHandler } from "../../../hooks/useExceptionHandler.jsx";
const defaultKeys = [
{
@@ -39,6 +39,7 @@ function PlatformSettings() {
const { setAlertDetails } = useAlertStore();
const axiosPrivate = useAxiosPrivate();
const navigate = useNavigate();
+ const handleException = useExceptionHandler();
useEffect(() => {
const requestOptions = {
diff --git a/frontend/src/components/settings/users/Users.jsx b/frontend/src/components/settings/users/Users.jsx
index af55368cc..af50c1f70 100644
--- a/frontend/src/components/settings/users/Users.jsx
+++ b/frontend/src/components/settings/users/Users.jsx
@@ -10,7 +10,6 @@ import { useEffect, useState } from "react";
import { useNavigate } from "react-router-dom";
import "./Users.css";
-import { handleException } from "../../../helpers/GetStaticData.js";
import { useAxiosPrivate } from "../../../hooks/useAxiosPrivate";
import { IslandLayout } from "../../../layouts/island-layout/IslandLayout.jsx";
import { useAlertStore } from "../../../store/alert-store";
@@ -18,11 +17,13 @@ import { useSessionStore } from "../../../store/session-store";
import { CustomButton } from "../../widgets/custom-button/CustomButton.jsx";
import { SpinnerLoader } from "../../widgets/spinner-loader/SpinnerLoader.jsx";
import { TopBar } from "../../widgets/top-bar/TopBar.jsx";
+import { useExceptionHandler } from "../../../hooks/useExceptionHandler.jsx";
function Users() {
const axiosPrivate = useAxiosPrivate();
const { sessionDetails } = useSessionStore();
const navigate = useNavigate();
+ const handleException = useExceptionHandler();
const [userList, setUserList] = useState([]);
const [filteredUserList, setFilteredUserList] = useState(userList);
diff --git a/frontend/src/components/tool-settings/tool-settings/ToolSettings.jsx b/frontend/src/components/tool-settings/tool-settings/ToolSettings.jsx
index 1f6357fbb..2bdfd9eed 100644
--- a/frontend/src/components/tool-settings/tool-settings/ToolSettings.jsx
+++ b/frontend/src/components/tool-settings/tool-settings/ToolSettings.jsx
@@ -8,11 +8,11 @@ import "./ToolSettings.css";
import { useEffect, useState } from "react";
-import { handleException } from "../../../helpers/GetStaticData";
import { useAxiosPrivate } from "../../../hooks/useAxiosPrivate";
import { useAlertStore } from "../../../store/alert-store";
import { useSessionStore } from "../../../store/session-store";
import { CustomButton } from "../../widgets/custom-button/CustomButton";
+import { useExceptionHandler } from "../../../hooks/useExceptionHandler";
import { ToolNavBar } from "../../navigations/tool-nav-bar/ToolNavBar";
import { ViewTools } from "../../custom-tools/view-tools/ViewTools";
@@ -40,6 +40,7 @@ function ToolSettings({ type }) {
const { sessionDetails } = useSessionStore();
const { setAlertDetails } = useAlertStore();
const axiosPrivate = useAxiosPrivate();
+ const handleException = useExceptionHandler();
useEffect(() => {
setTableRows([]);
@@ -83,10 +84,10 @@ function ToolSettings({ type }) {
}
};
- const handleDelete = (id) => {
+ const handleDelete = (adapter) => {
const requestOptions = {
method: "DELETE",
- url: `/api/v1/unstract/${sessionDetails?.orgId}/adapter/${id}/`,
+ url: `/api/v1/unstract/${sessionDetails?.orgId}/adapter/${adapter.id}/`,
headers: {
"X-CSRFToken": sessionDetails?.csrfToken,
},
@@ -95,7 +96,7 @@ function ToolSettings({ type }) {
setIsLoading(true);
axiosPrivate(requestOptions)
.then((res) => {
- const filteredList = tableRows.filter((row) => row?.id !== id);
+ const filteredList = tableRows.filter((row) => row?.id !== adapter.id);
setTableRows(filteredList);
setAlertDetails({
type: "success",
@@ -140,6 +141,7 @@ function ToolSettings({ type }) {
iconProp="icon"
isEmpty={!tableRows?.length}
centered
+ isClickable={false}
/>
</div>
</div>
diff --git a/frontend/src/components/widgets/list-view/ListView.css b/frontend/src/components/widgets/list-view/ListView.css
index 5ccad55c5..27d939316 100644
--- a/frontend/src/components/widgets/list-view/ListView.css
+++ b/frontend/src/components/widgets/list-view/ListView.css
@@ -18,6 +18,7 @@
padding: 10px 0 !important;
height: 85px;
z-index: 1;
+ overflow: hidden;
}
.action-icon-buttons {
@@ -42,12 +43,13 @@
-webkit-box-orient: vertical;
}
-.cover-img {
- width: 120px;
- display: inline-flex;
-}
-
.list-view-divider {
border-inline-start: solid rgba(5, 5, 5, 0.13);
height: 20px;
}
+
+.cover-img .fit-cover {
+ width: 120px;
+ height: 90px;
+ object-fit: contain;
+}
diff --git a/frontend/src/components/widgets/list-view/ListView.jsx b/frontend/src/components/widgets/list-view/ListView.jsx
index 921df99d3..bf38ad50a 100644
--- a/frontend/src/components/widgets/list-view/ListView.jsx
+++ b/frontend/src/components/widgets/list-view/ListView.jsx
@@ -17,11 +17,12 @@ function ListView({
iconProp,
idProp,
centered,
+ isClickable = true,
}) {
const navigate = useNavigate();
- const handleDeleteClick = (event, toolId) => {
+ const handleDeleteClick = (event, tool) => {
event.stopPropagation(); // Stop propagation to prevent list item click
- handleDelete(toolId);
+ handleDelete(event, tool);
};
const renderTitle = (record) => {
@@ -55,7 +56,9 @@ function ListView({
return (
<List.Item
key={item?.id}
- onClick={() => navigate(`${item[idProp]}`)}
+ onClick={() => {
+ isClickable && navigate(`${item[idProp]}`);
+ }}
className={`cur-pointer ${centered ? "centered" : ""}`}
extra={
<div onClick={(event) => event.stopPropagation()} role="none">
@@ -102,6 +105,7 @@ ListView.propTypes = {
iconProp: PropTypes.string,
idProp: PropTypes.string.isRequired,
centered: PropTypes.bool,
+ isClickable: PropTypes.bool,
};
export { ListView };
diff --git a/frontend/src/components/workflows/workflow/Workflows.jsx b/frontend/src/components/workflows/workflow/Workflows.jsx
index 831383ffa..87c7eb759 100644
--- a/frontend/src/components/workflows/workflow/Workflows.jsx
+++ b/frontend/src/components/workflows/workflow/Workflows.jsx
@@ -5,7 +5,6 @@ import PropTypes from "prop-types";
import { useEffect, useRef, useState } from "react";
import { useLocation, useNavigate } from "react-router-dom";
-import { handleException } from "../../../helpers/GetStaticData.js";
import { useAlertStore } from "../../../store/alert-store";
import { useSessionStore } from "../../../store/session-store";
import { useWorkflowStore } from "../../../store/workflow-store";
@@ -15,6 +14,7 @@ import { LazyLoader } from "../../widgets/lazy-loader/LazyLoader.jsx";
import { SpinnerLoader } from "../../widgets/spinner-loader/SpinnerLoader.jsx";
import "./Workflows.css";
import { workflowService } from "./workflow-service";
+import { useExceptionHandler } from "../../../hooks/useExceptionHandler.jsx";
import { ToolNavBar } from "../../navigations/tool-nav-bar/ToolNavBar.jsx";
import { ViewTools } from "../../custom-tools/view-tools/ViewTools.jsx";
@@ -29,6 +29,7 @@ function Workflows() {
const navigate = useNavigate();
const location = useLocation();
const projectApiService = workflowService();
+ const handleException = useExceptionHandler();
const [projectList, setProjectList] = useState();
const [editingProject, setEditProject] = useState();
@@ -89,6 +90,10 @@ function Workflows() {
} else {
openProject(res.data);
}
+ setAlertDetails({
+ type: "success",
+ content: "Workflow updated successfully",
+ });
getProjectList();
})
.catch((err) => {
diff --git a/frontend/src/helpers/GetStaticData.js b/frontend/src/helpers/GetStaticData.js
index 30337cae6..86c703ce5 100644
--- a/frontend/src/helpers/GetStaticData.js
+++ b/frontend/src/helpers/GetStaticData.js
@@ -245,36 +245,6 @@ const getTimeForLogs = () => {
return formattedDate;
};
-const handleException = (err, errMessage, setBackendErrors = undefined) => {
- if (err?.response?.data?.type === "validation_error") {
- // Handle validation errors
- if (setBackendErrors) {
- setBackendErrors(err?.response?.data);
- } else {
- return {
- type: "error",
- content: errMessage || "Something went wrong",
- };
- }
- }
-
- if (["client_error", "server_error"].includes(err?.response?.data?.type)) {
- // Handle client_error, server_error
- return {
- type: "error",
- content:
- err?.response?.data?.errors[0].detail ||
- errMessage ||
- "Something went wrong",
- };
- }
-
- return {
- type: "error",
- content: errMessage || err?.message,
- };
-};
-
const base64toBlob = (data) => {
const bytes = atob(data);
let length = bytes.length;
@@ -381,7 +351,6 @@ export {
getOrgNameFromPathname,
getReadableDateAndTime,
getTimeForLogs,
- handleException,
listOfAppDeployments,
onboardCompleted,
promptStudioUpdateStatus,
diff --git a/frontend/src/hooks/useExceptionHandler.jsx b/frontend/src/hooks/useExceptionHandler.jsx
new file mode 100644
index 000000000..4fd924175
--- /dev/null
+++ b/frontend/src/hooks/useExceptionHandler.jsx
@@ -0,0 +1,36 @@
+import { useNavigate } from "react-router-dom";
+
+const useExceptionHandler = (err, errMessage) => {
+ const navigate = useNavigate();
+
+ if (err?.response?.data?.type === "validation_error") {
+ // Handle validation errors
+ } else if (err?.response?.data?.type === "subscription_error") {
+ navigate("/trial");
+ return {
+ type: "error",
+ content:
+ err?.response?.data?.errors[0].detail ||
+ errMessage ||
+ "Something went wrong",
+ };
+ } else if (
+ ["client_error", "server_error"].includes(err?.response?.data?.type)
+ ) {
+ // Handle client_error, server_error
+ return {
+ type: "error",
+ content:
+ err?.response?.data?.errors[0].detail ||
+ errMessage ||
+ "Something went wrong",
+ };
+ } else {
+ return {
+ type: "error",
+ content: err?.message,
+ };
+ }
+};
+
+export { useExceptionHandler };