Skip to content

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

UN-2568 [FIX] Improved application stability and user interface (#1495)

jagadeeswaran-zipstack94125079b350
diff --git a/frontend/src/components/agency/agency/Agency.css b/frontend/src/components/agency/agency/Agency.css
index f5c0425c6..a6a8da764 100644
--- a/frontend/src/components/agency/agency/Agency.css
+++ b/frontend/src/components/agency/agency/Agency.css
@@ -255,7 +255,7 @@
.select-tool-btn {
width: 100%;
- height: 40px;
+ height: 32px;
border-style: dashed;
border-color: #d9d9d9;
color: #8c8c8c;
diff --git a/frontend/src/components/agency/agency/Agency.jsx b/frontend/src/components/agency/agency/Agency.jsx
index 0e7fe06aa..d2b49935d 100644
--- a/frontend/src/components/agency/agency/Agency.jsx
+++ b/frontend/src/components/agency/agency/Agency.jsx
@@ -259,7 +259,12 @@ function Agency() {
})
.catch((err) => {
if (!signal?.aborted) {
- setAlertDetails(handleException(err, "Failed to get exported tools"));
+ setAlertDetails(
+ handleException(
+ err,
+ "Failed to get exported Prompt Studio projects"
+ )
+ );
}
throw err;
});
@@ -965,11 +970,13 @@ function Agency() {
type: "success",
content:
details?.tool_instances?.length > 0
- ? "Tool replaced successfully"
- : "Tool added successfully",
+ ? "Prompt Studio project replaced successfully"
+ : "Prompt Studio project added successfully",
});
} catch (err) {
- setAlertDetails(handleException(err, "Failed to update tool"));
+ setAlertDetails(
+ handleException(err, "Failed to update Prompt Studio project")
+ );
}
}
};
@@ -1151,8 +1158,8 @@ function Agency() {
<Col span={12}>
<WorkflowCard
number={selectedTool ? "✓" : "3"}
- title="Select Exported Tool"
- description="Choose an exported tool for processing your data"
+ title="Select Exported Prompt Studio project"
+ description="Choose an exported Prompt Studio project for processing your data"
customContent={
<div className="workflow-card-content">
<div className="tool-selection-display">
@@ -1168,7 +1175,7 @@ function Agency() {
onClick={() => setShowToolSelectionSidebar(true)}
size="small"
>
- Change Tool
+ Change Prompt Studio project
</Button>
</div>
) : (
@@ -1177,7 +1184,7 @@ function Agency() {
onClick={() => setShowToolSelectionSidebar(true)}
className="select-tool-btn"
>
- Select Tool
+ Select Prompt Studio project
</Button>
)}
</div>
diff --git a/frontend/src/components/agency/tool-selection-sidebar/ToolSelectionSidebar.jsx b/frontend/src/components/agency/tool-selection-sidebar/ToolSelectionSidebar.jsx
index c441bb376..f29b3f70a 100644
--- a/frontend/src/components/agency/tool-selection-sidebar/ToolSelectionSidebar.jsx
+++ b/frontend/src/components/agency/tool-selection-sidebar/ToolSelectionSidebar.jsx
@@ -61,9 +61,11 @@ function ToolSelectionSidebar({
<div className="tool-selection-sidebar-overlay">
<div className="tool-selection-sidebar">
<div className="tool-selection-header">
- <Typography.Title level={4}>Select Exported Tool</Typography.Title>
+ <Typography.Title level={4}>
+ Select Exported Prompt Studio project
+ </Typography.Title>
<Input
- placeholder="Search tools..."
+ placeholder="Search Prompt Studio project..."
prefix={<SearchOutlined />}
value={searchTerm}
onChange={(e) => setSearchTerm(e.target.value)}
@@ -132,7 +134,7 @@ function ToolSelectionSidebar({
onClick={handleSave}
disabled={!tempSelectedTool}
>
- {hasChanges ? "Save Changes" : "Select Tool"}
+ {hasChanges ? "Save Changes" : "Select Prompt Studio project"}
</Button>
</div>
</div>
diff --git a/frontend/src/components/custom-tools/pdf-viewer/PdfViewer.jsx b/frontend/src/components/custom-tools/pdf-viewer/PdfViewer.jsx
index a728657fd..117bfc0e5 100644
--- a/frontend/src/components/custom-tools/pdf-viewer/PdfViewer.jsx
+++ b/frontend/src/components/custom-tools/pdf-viewer/PdfViewer.jsx
@@ -21,11 +21,12 @@ function PdfViewer({ fileUrl, highlightData }) {
const { jumpToPage } = pageNavigationPluginInstance;
const parentRef = useRef(null);
function removeZerosAndDeleteIfAllZero(highlightData) {
- return highlightData?.filter((innerArray) => {
- return (
- Array.isArray(innerArray) && innerArray.some((value) => value !== 0)
- );
- });
+ if (Array.isArray(highlightData))
+ return highlightData?.filter((innerArray) => {
+ return (
+ Array.isArray(innerArray) && innerArray?.some((value) => value !== 0)
+ );
+ });
}
const processHighlightData = highlightData
diff --git a/frontend/src/components/deployments/create-api-deployment-from-prompt-studio/CreateApiDeploymentFromPromptStudio.css b/frontend/src/components/deployments/create-api-deployment-from-prompt-studio/CreateApiDeploymentFromPromptStudio.css
index 23192bebc..b53e436ef 100644
--- a/frontend/src/components/deployments/create-api-deployment-from-prompt-studio/CreateApiDeploymentFromPromptStudio.css
+++ b/frontend/src/components/deployments/create-api-deployment-from-prompt-studio/CreateApiDeploymentFromPromptStudio.css
@@ -42,7 +42,10 @@
text-align: left;
}
-.create-api-deployment-from-prompt-studio-modal .success-content .ant-typography h4 {
+.create-api-deployment-from-prompt-studio-modal
+ .success-content
+ .ant-typography
+ h4 {
text-align: center;
margin-bottom: 24px;
color: #52c41a;
@@ -54,7 +57,9 @@
font-weight: 500;
}
-.create-api-deployment-from-prompt-studio-modal .success-content .ant-btn:hover {
+.create-api-deployment-from-prompt-studio-modal
+ .success-content
+ .ant-btn:hover {
transform: translateY(-1px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
transition: all 0.3s ease;
@@ -76,3 +81,26 @@
text-align: center;
margin-top: 16px;
}
+
+/* Form textarea styles for Display Name and API Name */
+.create-api-deployment-from-prompt-studio-modal .ant-form-item-control-input textarea[maxlength="30"],
+.create-api-deployment-from-prompt-studio-modal .ant-form-item-control-input textarea[maxlength="100"] {
+ font-family: monospace;
+ word-break: break-all;
+ line-height: 1.5;
+}
+
+/* Character counter styles for textareas with showCount */
+.create-api-deployment-from-prompt-studio-modal .ant-input-textarea-show-count::after {
+ position: static;
+ display: block;
+ text-align: right;
+ margin-top: 4px;
+ color: rgba(0, 0, 0, 0.45);
+ font-size: 12px;
+}
+
+/* Ensure proper spacing for auto-sized textareas */
+.create-api-deployment-from-prompt-studio-modal .ant-input-textarea {
+ margin-bottom: 0;
+}
diff --git a/frontend/src/components/deployments/create-api-deployment-from-prompt-studio/CreateApiDeploymentFromPromptStudio.jsx b/frontend/src/components/deployments/create-api-deployment-from-prompt-studio/CreateApiDeploymentFromPromptStudio.jsx
index be51f11ee..acf78dc21 100644
--- a/frontend/src/components/deployments/create-api-deployment-from-prompt-studio/CreateApiDeploymentFromPromptStudio.jsx
+++ b/frontend/src/components/deployments/create-api-deployment-from-prompt-studio/CreateApiDeploymentFromPromptStudio.jsx
@@ -70,8 +70,9 @@ const CreateApiDeploymentFromPromptStudio = ({
const timestamp = Date.now();
const baseApiName = toolDetails.tool_name
.toLowerCase()
- .replace(/\s+/g, "_");
- const uniqueApiName = `${baseApiName}_${timestamp}`;
+ .replace(/\s+/g, "_")
+ .substring(0, 15); // Limit base name to 15 chars to leave room for timestamp
+ const uniqueApiName = `${baseApiName}_${timestamp}`.substring(0, 30); // Ensure total doesn't exceed 30
// Set default deployment details based on tool details
const defaultValues = {
@@ -237,6 +238,7 @@ const CreateApiDeploymentFromPromptStudio = ({
const cleanupCreatedResources = async (createdResources) => {
const cleanupPromises = [];
+ const cleanupResults = { success: [], failed: [] };
// Clean up API deployment if created
if (createdResources.apiDeploymentId) {
@@ -247,9 +249,13 @@ const CreateApiDeploymentFromPromptStudio = ({
headers: {
"X-CSRFToken": sessionDetails?.csrfToken,
},
- }).catch(() => {
- // Silently handle cleanup failures to avoid additional errors
})
+ .then(() => {
+ cleanupResults.success.push("API deployment");
+ })
+ .catch(() => {
+ cleanupResults.failed.push("API deployment");
+ })
);
}
@@ -262,9 +268,13 @@ const CreateApiDeploymentFromPromptStudio = ({
headers: {
"X-CSRFToken": sessionDetails?.csrfToken,
},
- }).catch(() => {
- // Silently handle cleanup failures to avoid additional errors
})
+ .then(() => {
+ cleanupResults.success.push("Tool instance");
+ })
+ .catch(() => {
+ cleanupResults.failed.push("Tool instance");
+ })
);
}
@@ -273,17 +283,35 @@ const CreateApiDeploymentFromPromptStudio = ({
cleanupPromises.push(
workflowApiService
.deleteProject(createdResources.workflowId)
+ .then(() => {
+ cleanupResults.success.push("Workflow");
+ })
.catch(() => {
- // Silently handle cleanup failures to avoid additional errors
+ cleanupResults.failed.push("Workflow");
})
);
}
// Wait for all cleanup operations to complete
await Promise.allSettled(cleanupPromises);
+
+ // Log cleanup results for debugging
+ if (cleanupResults.failed.length > 0) {
+ console.warn(
+ "Some resources could not be cleaned up:",
+ cleanupResults.failed
+ );
+ }
+
+ return cleanupResults;
};
const createApiDeployment = async () => {
+ // Prevent duplicate submissions
+ if (isLoading) {
+ return;
+ }
+
try {
setPostHogCustomEvent("intent_create_api_deployment_from_prompt_studio", {
info: "Creating API deployment from prompt studio",
@@ -296,6 +324,7 @@ const CreateApiDeploymentFromPromptStudio = ({
}
setIsLoading(true);
+ setBackendErrors(null); // Clear any previous errors
// Track created resources for cleanup
const createdResources = {
@@ -321,7 +350,9 @@ const CreateApiDeploymentFromPromptStudio = ({
});
// Step 2: Create workflow with unique name based on API deployment name
- const workflowName = `${deploymentDetails.api_name}_workflow`;
+ // Add timestamp to ensure uniqueness even if API name is reused
+ const timestamp = Date.now();
+ const workflowName = `${deploymentDetails.api_name}_workflow_${timestamp}`;
const workflowResponse = await workflowApiService.editProject(
workflowName,
`Workflow for ${deploymentDetails.display_name} API deployment`,
@@ -377,16 +408,9 @@ const CreateApiDeploymentFromPromptStudio = ({
});
// Step 6: Create API deployment
- // Get the latest form values to ensure we have the most up-to-date data
- const currentFormValues = form.getFieldsValue();
- const finalDeploymentDetails = {
- ...deploymentDetails,
- ...currentFormValues,
- };
-
const apiDeploymentResponse =
await apiDeploymentsApiService.createApiDeployment({
- ...finalDeploymentDetails,
+ ...deploymentDetails,
workflow: workflowId,
});
@@ -402,12 +426,36 @@ const CreateApiDeploymentFromPromptStudio = ({
// Cleanup created resources on failure
await cleanupCreatedResources(createdResources);
- if (err.response?.data?.errors) {
+ // Show error message to user
+ let errorMessage = "Failed to create API deployment";
+ const errorDetails = err?.response?.data?.errors;
+
+ if (errorDetails) {
setBackendErrors(err.response.data);
- } else {
- setAlertDetails(
- handleException(err, "Failed to create API deployment")
+ // Extract specific error messages for better user feedback
+ if (errorDetails.length > 0) {
+ const errorDetails = errorDetails
+ .map((e) => `${e.attr}: ${e.detail}`)
+ .join(", ");
+ errorMessage = `API deployment creation failed: ${errorDetails}`;
+ }
+ }
+
+ // Always show an alert for API deployment failures
+ setAlertDetails({
+ type: "error",
+ content: errorMessage,
+ });
+
+ // If we're on step 2 and have backend errors for deployment fields,
+ // go back to step 1 to show the errors
+ if (errorDetails && currentStep === 1) {
+ const hasDeploymentFieldErrors = errorDetails.some((error) =>
+ ["api_name", "display_name", "description"].includes(error?.attr)
);
+ if (hasDeploymentFieldErrors) {
+ setCurrentStep(0);
+ }
}
} finally {
setIsLoading(false);
@@ -634,7 +682,13 @@ const CreateApiDeploymentFromPromptStudio = ({
<Form.Item
label="Display Name"
name="display_name"
- rules={[{ required: true, message: "Please enter a display name" }]}
+ rules={[
+ { required: true, message: "Please enter a display name" },
+ {
+ max: 30,
+ message: "Maximum 30 characters allowed",
+ },
+ ]}
validateStatus={
getBackendErrorDetail("display_name", backendErrors)
? "error"
@@ -642,7 +696,12 @@ const CreateApiDeploymentFromPromptStudio = ({
}
help={getBackendErrorDetail("display_name", backendErrors)}
>
- <Input placeholder="Enter display name for the API" />
+ <Input.TextArea
+ placeholder="Enter display name for the API"
+ maxLength={30}
+ showCount
+ autoSize={{ minRows: 1, maxRows: 2 }}
+ />
</Form.Item>
<Form.Item
@@ -670,8 +729,8 @@ const CreateApiDeploymentFromPromptStudio = ({
"Only letters, numbers, hyphen and underscores are allowed",
},
{
- pattern: /^.{1,30}$/,
- message: "Maximum 30 characters only allowed",
+ max: 30,
+ message: "Maximum 30 characters allowed",
},
]}
validateStatus={
@@ -679,7 +738,13 @@ const CreateApiDeploymentFromPromptStudio = ({
}
help={getBackendErrorDetail("api_name", backendErrors)}
>
- <Input placeholder="Enter API name (used in URL)" />
+ <Input.TextArea
+ placeholder="Enter API name (used in URL)"
+ maxLength={30}
+ showCount
+ autoSize={{ minRows: 1, maxRows: 2 }}
+ style={{ resize: "none" }}
+ />
</Form.Item>
</Form>
)}
diff --git a/frontend/src/components/navigations/top-nav-bar/TopNavBar.css b/frontend/src/components/navigations/top-nav-bar/TopNavBar.css
index 8e724fec8..dc6bdabb2 100644
--- a/frontend/src/components/navigations/top-nav-bar/TopNavBar.css
+++ b/frontend/src/components/navigations/top-nav-bar/TopNavBar.css
@@ -31,7 +31,7 @@
background: inherit;
box-shadow: none;
text-align: left;
- padding: 0;
+ padding: 5px 12px;
height: auto;
border-radius: 0;
border-color: transparent;
@@ -75,3 +75,7 @@
display: flex;
align-items: center;
}
+
+.user-profile-menu > .ant-dropdown-menu-item {
+ padding: 0 !important;
+}
diff --git a/frontend/src/components/navigations/top-nav-bar/TopNavBar.jsx b/frontend/src/components/navigations/top-nav-bar/TopNavBar.jsx
index f2edbcf00..3c0c69138 100644
--- a/frontend/src/components/navigations/top-nav-bar/TopNavBar.jsx
+++ b/frontend/src/components/navigations/top-nav-bar/TopNavBar.jsx
@@ -186,7 +186,7 @@ function TopNavBar({ isSimpleLayout, topNavBarOptions }) {
if (pathSegments[1].includes("/approve")) {
setReviewPageHeader("Approve");
} else if (pathSegments[1].includes("/download_and_sync")) {
- setReviewPageHeader("Download and syncmanager");
+ setReviewPageHeader("Download and Sync Manager");
} else {
setReviewPageHeader("Review");
}
@@ -258,6 +258,7 @@ function TopNavBar({ isSimpleLayout, topNavBarOptions }) {
onClick={() => navigate(`/${orgName}/profile`)}
className="logout-button"
disabled={shouldDisableRouting}
+ type="text"
>
<UserOutlined /> Profile
</Button>
@@ -297,6 +298,7 @@ function TopNavBar({ isSimpleLayout, topNavBarOptions }) {
onClick={() => navigate(`/${orgName}/review`)}
className="logout-button"
disabled={shouldDisableRouting}
+ type="text"
>
<FileProtectOutlined /> Review
</Button>
@@ -313,6 +315,7 @@ function TopNavBar({ isSimpleLayout, topNavBarOptions }) {
onClick={() => navigate(`/${orgName}/review/approve`)}
className="logout-button"
disabled={shouldDisableRouting}
+ type="text"
>
<LikeOutlined /> Approve
</Button>
@@ -326,6 +329,7 @@ function TopNavBar({ isSimpleLayout, topNavBarOptions }) {
onClick={() => navigate(`/${orgName}/review/download_and_sync`)}
className="logout-button"
disabled={shouldDisableRouting}
+ type="text"
>
<DownloadOutlined /> Download and Sync Manager
</Button>
@@ -360,7 +364,12 @@ function TopNavBar({ isSimpleLayout, topNavBarOptions }) {
menuItems.push({
key: "2",
label: (
- <Button onClick={handleClick} icon={icon} className="logout-button">
+ <Button
+ onClick={handleClick}
+ icon={icon}
+ className="logout-button"
+ type="text"
+ >
{label}
</Button>
),
@@ -440,7 +449,12 @@ function TopNavBar({ isSimpleLayout, topNavBarOptions }) {
<Space>
{topNavBarOptions}
{isUnstract && TrialDaysInfo && <TrialDaysInfo />}
- <Dropdown menu={{ items }} placement="bottomLeft" arrow>
+ <Dropdown
+ menu={{ items, className: "user-profile-menu" }}
+ placement="bottomLeft"
+ arrow
+ className="top-navbar-dp"
+ >
<div className="top-navbar-dp">
{sessionDetails?.picture ? (
<Image