LLM-Driven Extraction of Unstructured Data — Built for API Deployments & ETL Pipeline Workflows
Python ai-agentsdata-engineeringdocument-aigenerative-aiidpjson-extractionllmmcp-serverocrpdf-extractionprompt-engineeringstructured-output
FIX - UI Improvements & Bug Fixes (#102)
Tahier Hussain2df156dc8936
diff --git a/frontend/src/assets/index.js b/frontend/src/assets/index.jsindex f1279797c..5247b3143 100644--- a/frontend/src/assets/index.js+++ b/frontend/src/assets/index.js@@ -18,6 +18,8 @@ import { ReactComponent as StepIcon } from "./steps.svg";import { ReactComponent as AssertionIcon } from "./assertion.svg";import { ReactComponent as CombinedOutputIcon } from "./combined-output.svg";import { ReactComponent as EmptyPlaceholder } from "./empty.svg";+import { ReactComponent as TextExtractorIcon } from "./text-extractor.svg";+import { ReactComponent as OcrIcon } from "./ocr.svg";export {SunIcon,@@ -40,4 +42,6 @@ export {EmptyPlaceholder,AssertionIcon,CombinedOutputIcon,+ TextExtractorIcon,+ OcrIcon,};diff --git a/frontend/src/assets/ocr.svg b/frontend/src/assets/ocr.svgnew file mode 100644index 000000000..d2dfc41e5--- /dev/null+++ b/frontend/src/assets/ocr.svg@@ -0,0 +1,3 @@+<svg width="17" height="17" viewBox="0 0 17 17" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M10.1474 16.6859C9.82693 16.6859 9.5545 16.5737 9.33015 16.3493C9.10579 16.125 8.99361 15.8525 8.99361 15.532V10.1474C8.99361 9.82692 9.10579 9.55449 9.33015 9.33014C9.5545 9.10578 9.82693 8.9936 10.1474 8.9936H15.532C15.8525 8.9936 16.125 9.10578 16.3493 9.33014C16.5737 9.55449 16.6859 9.82692 16.6859 10.1474V15.532C16.6859 15.8525 16.5737 16.125 16.3493 16.3493C16.125 16.5737 15.8525 16.6859 15.532 16.6859H10.1474ZM10.1474 15.532H15.532V14.9134C15.2115 14.5149 14.82 14.1979 14.3574 13.9623C13.8947 13.7267 13.3889 13.609 12.8397 13.609C12.2906 13.609 11.7847 13.7267 11.3221 13.9623C10.8595 14.1979 10.468 14.5149 10.1474 14.9134V15.532ZM12.8397 12.8397C13.1602 12.8397 13.4327 12.7275 13.657 12.5032C13.8814 12.2788 13.9936 12.0064 13.9936 11.6859C13.9936 11.3654 13.8814 11.0929 13.657 10.8686C13.4327 10.6442 13.1602 10.5321 12.8397 10.5321C12.5192 10.5321 12.2468 10.6442 12.0224 10.8686C11.7981 11.0929 11.6859 11.3654 11.6859 11.6859C11.6859 12.0064 11.7981 12.2788 12.0224 12.5032C12.2468 12.7275 12.5192 12.8397 12.8397 12.8397ZM8.00961 5.50002C7.31625 5.50002 6.72625 5.74334 6.23961 6.22998C5.75297 6.71663 5.50965 7.30664 5.50965 8C5.50965 8.55447 5.66109 9.04164 5.96396 9.46152C6.26685 9.88138 6.66776 10.1805 7.16667 10.3589V8.94873C7.04488 8.83762 6.94659 8.69258 6.8718 8.51362C6.79701 8.33466 6.75961 8.16346 6.75961 8C6.75961 7.65278 6.88114 7.35764 7.12419 7.11458C7.36725 6.87153 7.66239 6.75 8.00961 6.75C8.20405 6.75 8.37901 6.78819 8.53446 6.86458C8.68991 6.94097 8.82319 7.04166 8.9343 7.16666H10.3525C10.1827 6.67308 9.887 6.27191 9.46553 5.96316C9.04405 5.6544 8.55875 5.50002 8.00961 5.50002ZM6.07696 15.9166L5.75965 13.3782C5.53636 13.3034 5.30746 13.1987 5.07294 13.0641C4.83843 12.9295 4.62876 12.7852 4.44392 12.6314L2.09296 13.625L0.169922 10.2917L2.20357 8.75481C2.18433 8.63088 2.17071 8.50641 2.16269 8.38141C2.15468 8.25641 2.15067 8.13195 2.15067 8.00802C2.15067 7.88942 2.15468 7.76896 2.16269 7.64662C2.17071 7.52429 2.18433 7.39048 2.20357 7.24518L0.169922 5.70833L2.09296 2.39106L4.4359 3.37664C4.63676 3.21745 4.85124 3.07188 5.07934 2.93994C5.30745 2.80798 5.53155 2.70193 5.75163 2.62181L6.07696 0.0833511H9.92305L10.2404 2.62983C10.4904 2.72064 10.7166 2.82667 10.9191 2.94793C11.1215 3.0692 11.3259 3.2121 11.532 3.37664L13.907 2.39106L15.8301 5.70833L13.9952 7.10256C14.0005 7.11324 14.0032 7.12392 14.0032 7.1346C14.0032 7.1453 14.0058 7.15598 14.0112 7.16666H12.4679C12.4541 7.09722 12.4415 7.02831 12.4303 6.95994C12.4191 6.89156 12.3996 6.82265 12.3718 6.75321L14.1955 5.375L13.375 3.95833L11.2804 4.84135C11.0016 4.54327 10.6675 4.27991 10.278 4.05129C9.88862 3.82265 9.49465 3.66079 9.09615 3.56571L8.83334 1.33333H7.17948L6.90386 3.55768C6.47864 3.65812 6.08601 3.81196 5.72596 4.01923C5.36592 4.22649 5.02244 4.49359 4.69553 4.82052L2.62501 3.95833L1.80448 5.375L3.60417 6.71635C3.53473 6.91399 3.48612 7.11965 3.45834 7.33333C3.43056 7.54701 3.41667 7.77191 3.41667 8.00802C3.41667 8.22489 3.43056 8.4375 3.45834 8.64583C3.48612 8.85416 3.53205 9.05982 3.59615 9.26281L1.80448 10.625L2.62501 12.0417L4.68751 11.1667C5.02084 11.5085 5.39717 11.7935 5.8165 12.0216C6.23585 12.2497 6.68591 12.4065 7.16667 12.492V15.9166H6.07696Z" fill="#90A4B7"/>+</svg>diff --git a/frontend/src/assets/text-extractor.svg b/frontend/src/assets/text-extractor.svgnew file mode 100644index 000000000..cc15481ac--- /dev/null+++ b/frontend/src/assets/text-extractor.svg@@ -0,0 +1,3 @@+<svg width="17" height="17" viewBox="0 0 17 17" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M11.6523 14.915L13.8734 12.6939V14.5144H14.6106V11.4375H11.5337V12.1747H13.3542L11.133 14.3958L11.6523 14.915ZM2.4231 15.0833C2.00751 15.0833 1.65254 14.9361 1.35821 14.6418C1.06386 14.3475 0.916687 13.9925 0.916687 13.5769V2.4231C0.916687 2.00751 1.06386 1.65254 1.35821 1.35821C1.65254 1.06386 2.00751 0.916687 2.4231 0.916687H13.5769C13.9925 0.916687 14.3475 1.06386 14.6418 1.35821C14.9361 1.65254 15.0833 2.00751 15.0833 2.4231V7.6939C14.8782 7.6063 14.6728 7.53206 14.4671 7.47117C14.2615 7.41026 14.0502 7.36165 13.8333 7.32533V2.4231C13.8333 2.35899 13.8066 2.30022 13.7532 2.24679C13.6998 2.19338 13.641 2.16667 13.5769 2.16667H2.4231C2.35899 2.16667 2.30022 2.19338 2.24679 2.24679C2.19337 2.30022 2.16667 2.35899 2.16667 2.4231V13.5769C2.16667 13.641 2.19337 13.6998 2.24679 13.7532C2.30022 13.8066 2.35899 13.8333 2.4231 13.8333H7.3045C7.33547 14.0641 7.38141 14.2823 7.44231 14.488C7.5032 14.6936 7.57745 14.8921 7.66506 15.0833H2.4231ZM2.16667 13V13.8333V2.16667V7.32533V7.26283V13ZM4.04169 11.8622H7.38944C7.42576 11.6453 7.47971 11.434 7.55129 11.2284C7.62288 11.0227 7.70087 10.8173 7.78527 10.6122H4.04169V11.8622ZM4.04169 8.62498H9.32535C9.68433 8.32051 10.0673 8.06544 10.4744 7.85977C10.8814 7.65412 11.3173 7.50802 11.782 7.42148V7.37502H4.04169V8.62498ZM4.04169 5.38781H11.9583V4.13783H4.04169V5.38781ZM13 16.798C11.9594 16.798 11.0743 16.4332 10.3446 15.7035C9.61487 14.9738 9.25002 14.0887 9.25002 13.0481C9.25002 12.0075 9.61487 11.1223 10.3446 10.3926C11.0743 9.66295 11.9594 9.2981 13 9.2981C14.0406 9.2981 14.9257 9.66295 15.6554 10.3926C16.3851 11.1223 16.75 12.0075 16.75 13.0481C16.75 14.0887 16.3851 14.9738 15.6554 15.7035C14.9257 16.4332 14.0406 16.798 13 16.798Z" fill="#90A4B7"/>+</svg>diff --git a/frontend/src/components/custom-tools/add-llm-profile/AddLlmProfile.jsx b/frontend/src/components/custom-tools/add-llm-profile/AddLlmProfile.jsxindex 17982dd56..057c28882 100644--- a/frontend/src/components/custom-tools/add-llm-profile/AddLlmProfile.jsx+++ b/frontend/src/components/custom-tools/add-llm-profile/AddLlmProfile.jsx@@ -24,7 +24,12 @@ import SpaceWrapper from "../../widgets/space-wrapper/SpaceWrapper";import "./AddLlmProfile.css";import { useExceptionHandler } from "../../../hooks/useExceptionHandler";-function AddLlmProfile({ editLlmProfileId, setEditLlmProfileId, setIsAddLlm }) {+function AddLlmProfile({+ editLlmProfileId,+ setEditLlmProfileId,+ setIsAddLlm,+ handleDefaultLlm,+}) {const [form] = Form.useForm();const [formDetails, setFormDetails] = useState({});const [resetForm, setResetForm] = useState(false);@@ -318,6 +323,12 @@ function AddLlmProfile({ editLlmProfileId, setEditLlmProfileId, setIsAddLlm }) {type: "success",content: "Saved successfully",});++ if (newLlmProfiles?.length === 1) {+ // Set the first LLM profile as default+ handleDefaultLlm(data?.profile_id);+ }+ setIsAddLlm(false);}).catch((err) => {setAlertDetails(handleException(err));@@ -520,6 +531,7 @@ AddLlmProfile.propTypes = {editLlmProfileId: PropTypes.string,setEditLlmProfileId: PropTypes.func.isRequired,setIsAddLlm: PropTypes.func.isRequired,+ handleDefaultLlm: PropTypes.func.isRequired,};export { AddLlmProfile };diff --git a/frontend/src/components/custom-tools/document-manager/DocumentManager.jsx b/frontend/src/components/custom-tools/document-manager/DocumentManager.jsxindex 2a1c7c14f..f0b2379d3 100644--- a/frontend/src/components/custom-tools/document-manager/DocumentManager.jsx+++ b/frontend/src/components/custom-tools/document-manager/DocumentManager.jsx@@ -12,7 +12,7 @@ import { PdfViewer } from "../pdf-viewer/PdfViewer";import { ManageDocsModal } from "../manage-docs-modal/ManageDocsModal";import { useAxiosPrivate } from "../../../hooks/useAxiosPrivate";import { useSessionStore } from "../../../store/session-store";-import { base64toBlob } from "../../../helpers/GetStaticData";+import { base64toBlob, docIndexStatus } from "../../../helpers/GetStaticData";import { DocumentViewer } from "../document-viewer/DocumentViewer";import { TextViewerPre } from "../text-viewer-pre/TextViewerPre";@@ -56,7 +56,10 @@ function DocumentManager({ generateIndex, handleUpdateTool, handleDocChange }) {const [extractTxt, setExtractTxt] = useState("");const [isDocLoading, setIsDocLoading] = useState(false);const [isExtractLoading, setIsExtractLoading] = useState(false);- const { selectedDoc, listOfDocs, disableLlmOrDocChange, details } =+ const [currDocIndexStatus, setCurrDocIndexStatus] = useState(+ docIndexStatus.yet_to_start+ );+ const { selectedDoc, listOfDocs, disableLlmOrDocChange, details, indexDocs } =useCustomToolStore();const { sessionDetails } = useSessionStore();const axiosPrivate = useAxiosPrivate();@@ -69,10 +72,46 @@ function DocumentManager({ generateIndex, handleUpdateTool, handleDocChange }) {});}, [selectedDoc]);+ useEffect(() => {+ if (currDocIndexStatus === docIndexStatus.done) {+ handleFetchContent(viewTypes.extract);+ setCurrDocIndexStatus(docIndexStatus.yet_to_start);+ }+ }, [currDocIndexStatus]);++ useEffect(() => {+ if (docIndexStatus.yet_to_start === currDocIndexStatus) {+ const isIndexing = indexDocs.find(+ (item) => item === selectedDoc?.document_id+ );++ if (isIndexing) {+ setCurrDocIndexStatus(docIndexStatus.indexing);+ }+ return;+ }++ if (docIndexStatus.indexing === currDocIndexStatus) {+ const isIndexing = indexDocs.find(+ (item) => item === selectedDoc?.document_id+ );++ if (!isIndexing) {+ setCurrDocIndexStatus(docIndexStatus.done);+ }+ }+ }, [indexDocs]);+const handleFetchContent = (viewType) => {- if (!selectedDoc?.document_id) {+ if (viewType === viewTypes.original) {setFileUrl("");+ }++ if (viewType === viewTypes.extract) {setExtractTxt("");+ }++ if (!selectedDoc?.document_id) {return;}@@ -221,8 +260,11 @@ function DocumentManager({ generateIndex, handleUpdateTool, handleDocChange }) {<TextViewerPre text={extractTxt} /></DocumentViewer>)}- {SummarizeView && activeKey === 3 && (- <SummarizeView setOpenManageDocsModal={setOpenManageDocsModal} />+ {SummarizeView && activeKey === "3" && (+ <SummarizeView+ setOpenManageDocsModal={setOpenManageDocsModal}+ currDocIndexStatus={currDocIndexStatus}+ />)}<ManageDocsModalopen={openManageDocsModal}diff --git a/frontend/src/components/custom-tools/manage-docs-modal/ManageDocsModal.jsx b/frontend/src/components/custom-tools/manage-docs-modal/ManageDocsModal.jsxindex 4d29ec40f..73d6839b9 100644--- a/frontend/src/components/custom-tools/manage-docs-modal/ManageDocsModal.jsx+++ b/frontend/src/components/custom-tools/manage-docs-modal/ManageDocsModal.jsx@@ -33,7 +33,7 @@ import { SpinnerLoader } from "../../widgets/spinner-loader/SpinnerLoader";let SummarizeStatusTitle = null;try {SummarizeStatusTitle =- require("../../../plugins/summarize-status-title/SummarizeStatusTitle111").SummarizeStatusTitle;+ require("../../../plugins/summarize-status-title/SummarizeStatusTitle").SummarizeStatusTitle;} catch {// The component will remain null if it is not available}diff --git a/frontend/src/components/custom-tools/manage-llm-profiles/ManageLlmProfiles.jsx b/frontend/src/components/custom-tools/manage-llm-profiles/ManageLlmProfiles.jsxindex 909188a5a..f25628123 100644--- a/frontend/src/components/custom-tools/manage-llm-profiles/ManageLlmProfiles.jsx+++ b/frontend/src/components/custom-tools/manage-llm-profiles/ManageLlmProfiles.jsx@@ -181,6 +181,7 @@ function ManageLlmProfiles() {editLlmProfileId={editLlmProfileId}setEditLlmProfileId={setEditLlmProfileId}setIsAddLlm={setIsAddLlm}+ handleDefaultLlm={handleDefaultLlm}/>);}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.jsxindex ca52b0b42..a7af08f1e 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@@ -72,7 +72,7 @@ function OutputForDocModal({const output = data.find((outputValue) => outputValue?.document_manager === item?.document_id);- const isSuccess = output?.output?.length > 0;+ const isSuccess = output?.output || output?.output === 0;const result = {key: item,diff --git a/frontend/src/components/custom-tools/prompt-card/PromptCard.jsx b/frontend/src/components/custom-tools/prompt-card/PromptCard.jsxindex f9bee09f6..70fa0e16e 100644--- a/frontend/src/components/custom-tools/prompt-card/PromptCard.jsx+++ b/frontend/src/components/custom-tools/prompt-card/PromptCard.jsx@@ -308,7 +308,7 @@ function PromptCard({.then((res) => {const data = res?.data;const value = data[promptDetails?.prompt_key];- if (value !== null && String(value)?.length > 0) {+ if (value || value === 0) {setCoverage((prev) => prev + 1);}@@ -394,7 +394,7 @@ function PromptCard({.then((res) => {const data = res?.data;const outputValue = data[promptDetails?.prompt_key];- if (outputValue !== null && String(outputValue)?.length > 0) {+ if (outputValue || outputValue === 0) {setCoverage((prev) => prev + 1);}@@ -583,6 +583,7 @@ function PromptCard({const handleGetCoverageData = (data) => {const ids = [];+ let coverageValue = 0;data.forEach((item) => {const isOutputAdded = ids.findIndex((output) => output?.docId === item?.document_manager@@ -602,10 +603,14 @@ function PromptCard({promptOutputId: item?.prompt_output_id,docId: item?.document_manager,});++ if (item?.output || item?.output === 0) {+ coverageValue++;+ }}});setOutputIds(ids);- setCoverage(ids?.length);+ setCoverage(coverageValue);};const enableEdit = (event) => {diff --git a/frontend/src/components/navigations/side-nav-bar/SideNavBar.jsx b/frontend/src/components/navigations/side-nav-bar/SideNavBar.jsxindex d06f6bbc4..9c1add0ce 100644--- a/frontend/src/components/navigations/side-nav-bar/SideNavBar.jsx+++ b/frontend/src/components/navigations/side-nav-bar/SideNavBar.jsx@@ -15,6 +15,7 @@ import LlmIcon from "../../../assets/llm.svg";import PlatformSettingsIcon from "../../../assets/platform-settings.svg";import task from "../../../assets/task.svg";import VectorDbIcon from "../../../assets/vector-db.svg";+import TextExtractorIcon from "../../../assets/text-extractor.svg";import { useSessionStore } from "../../../store/session-store";const SideNavBar = ({ collapsed }) => {@@ -124,7 +125,7 @@ const SideNavBar = ({ collapsed }) => {id: 3.4,title: "Text Extractor",description: "Setup platform wide access to Text extractor services",- image: EmbeddingIcon,+ image: TextExtractorIcon,path: `/${orgName}/settings/textExtractor`,active: window.location.pathname.startsWith(`/${orgName}/settings/textExtractor`@@ -132,16 +133,6 @@ const SideNavBar = ({ collapsed }) => {},{id: 3.5,- title: "OCR",- description: "Setup platform wide access to OCR services",- image: EmbeddingIcon,- path: `/${orgName}/settings/ocr`,- active: window.location.pathname.startsWith(- `/${orgName}/settings/ocr`- ),- },- {- id: 3.6,title: "Platform",description: "Settings for the platform",image: PlatformSettingsIcon,diff --git a/frontend/src/helpers/GetStaticData.js b/frontend/src/helpers/GetStaticData.jsindex 7942e4597..79ec47c56 100644--- a/frontend/src/helpers/GetStaticData.js+++ b/frontend/src/helpers/GetStaticData.js@@ -347,6 +347,12 @@ const getMenuItem = (label, key, icon, children, type) => {};};+const docIndexStatus = {+ yet_to_start: "YET_TO_START",+ indexing: "INDEXING",+ done: "DONE",+};+export {CONNECTOR_TYPE_MAP,O_AUTH_PROVIDERS,@@ -379,4 +385,5 @@ export {getBackendErrorDetail,titleCase,getMenuItem,+ docIndexStatus,};