LLM-Driven Extraction of Unstructured Data — Built for API Deployments & ETL Pipeline Workflows
Python ai-agentsdata-engineeringdocument-aigenerative-aiidpjson-extractionllmmcp-serverocrpdf-extractionprompt-engineeringstructured-output
UN-2533 [FEAT] Enhance Preamble/Postamble UX: Auto-resize Text Areas and Add Expandable View (#1373)
vishnuszipstack365b1c258a50
diff --git a/frontend/src/components/custom-tools/pre-and-post-amble-modal/PreAndPostAmbleModal.css b/frontend/src/components/custom-tools/pre-and-post-amble-modal/PreAndPostAmbleModal.cssindex c9e15cffb..6ef79f617 100644--- a/frontend/src/components/custom-tools/pre-and-post-amble-modal/PreAndPostAmbleModal.css+++ b/frontend/src/components/custom-tools/pre-and-post-amble-modal/PreAndPostAmbleModal.css@@ -21,3 +21,71 @@border-radius: 0px 0px 10px 10px;padding: 16px;}++/* Text area container and expand button styles */+.text-area-container {+ position: relative;+}++.text-area-wrapper {+ position: relative;+ margin-bottom: 5px;+}++/* Fix for text area resizing issues */+.text-area-wrapper .ant-input-textarea-show-count::after {+ content: none !important; /* Remove character count if present */+}++.expand-button {+ position: absolute;+ top: 5px;+ right: 5px;+ z-index: 2;+ background: rgba(255, 255, 255, 0.8);+ border-radius: 4px;+ padding: 2px;+ display: flex;+ align-items: center;+ justify-content: center;+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);+}++.expand-button:hover {+ background: rgba(240, 240, 240, 0.9);+}++/* Ensure text area retains its size between sessions */+.text-area-wrapper .ant-input {+ transition: height 0.2s;+ min-height: 80px; /* Approx 4 rows */+ max-height: 600px; /* Limit height and enable scrolling */+ overflow-y: auto; /* Enable vertical scrolling */+}++/* Modal styles */+.expanded-modal-body {+ padding: 20px;+}++.expanded-modal-body .ant-modal-body {+ padding: 0;+ overflow-y: auto;+}++++.expanded-textarea {+ width: 100%;+ margin-bottom: 20px;+ height: auto !important; /* Let content determine height */+ min-height: 80vh !important; /* Minimum height */+ overflow-y: auto !important; /* Enable scrolling when needed */+ resize: none !important; /* Prevent manual resizing */+ transition: none !important; /* Disable transitions to prevent jumping */+}++.modal-footer {+ display: flex;+ justify-content: flex-end;+}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.jsxindex faea440c2..cb2f400c7 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,6 +1,7 @@-import { Button, Input, Space, Typography } from "antd";+import { Button, Input, Space, Typography, Modal } from "antd";import PropTypes from "prop-types";-import { useEffect, useState } from "react";+import { useEffect, useState, useRef } from "react";+import { ExpandOutlined } from "@ant-design/icons";import "./PreAndPostAmbleModal.css";import { useAlertStore } from "../../../store/alert-store";@@ -19,6 +20,8 @@ const fieldNames = {function PreAndPostAmbleModal({ type, handleUpdateTool }) {const [title, setTitle] = useState("");const [text, setText] = useState("");+ const [expandModalVisible, setExpandModalVisible] = useState(false);+ const textAreaRef = useRef(null);const { details, updateCustomTool, isPublicSource } = useCustomToolStore();const { setAlertDetails } = useAlertStore();const handleException = useExceptionHandler();@@ -27,26 +30,28 @@ function PreAndPostAmbleModal({ type, handleUpdateTool }) {if (type === fieldNames.preamble) {setTitle("Preamble Settings");setText(details?.preamble || "");- return;- }-- if (type === fieldNames.postamble) {+ } else if (type === fieldNames.postamble) {setTitle("Postamble Settings");setText(details?.postamble || "");}- }, [type]);+ }, [type, details]);const setDefaultPrompt = () => {if (type === fieldNames.preamble) {setText(DefaultPrompts.preamble);- return;- }-- if (type === fieldNames.postamble) {+ } else if (type === fieldNames.postamble) {setText(DefaultPrompts.postamble);}};+ const handleTextChange = (e) => {+ setText(e.target.value);+ };++ const toggleExpandModal = () => {+ setExpandModalVisible(!expandModalVisible);+ };+const handleSave = () => {const body = {};if (type === fieldNames.preamble) {@@ -84,17 +89,29 @@ function PreAndPostAmbleModal({ type, handleUpdateTool }) {</Typography.Text></div><div>- <div>+ <div className="text-area-header"><Typography.Text>Add {title}</Typography.Text></div></div>- <div>- <Input.TextArea- rows={4}- value={text}- onChange={(e) => setText(e.target.value)}- disabled={isPublicSource}- />+ <div className="text-area-container">+ <div className="text-area-wrapper">+ <Input.TextArea+ ref={textAreaRef}+ rows={4}+ value={text}+ onChange={handleTextChange}+ disabled={isPublicSource}+ autoSize={{ minRows: 4 }}+ />+ <Button+ icon={<ExpandOutlined />}+ className="expand-button"+ onClick={toggleExpandModal}+ type="text"+ disabled={isPublicSource}+ title="Expand view"+ />+ </div><Buttonsize="small"type="link"@@ -103,6 +120,29 @@ function PreAndPostAmbleModal({ type, handleUpdateTool }) {>Reset with default prompt</Button>++ <Modal+ title={title}+ open={expandModalVisible}+ onCancel={toggleExpandModal}+ footer={null}+ width="60%"+ className="expanded-modal-body"+ centered={true}+ >+ <Input.TextArea+ value={text}+ onChange={handleTextChange}+ disabled={isPublicSource}+ autoSize={{ minRows: 15 }}+ className="expanded-textarea"+ />+ <div className="modal-footer">+ <Button type="primary" onClick={toggleExpandModal}>+ Close+ </Button>+ </div>+ </Modal></div><div className="display-flex-right"><Space>