Skip to content

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

Fix/prompt-studio-UI {Adding new suggestions} (#73)

Athul961e5a3a8e1c
diff --git a/frontend/src/components/custom-tools/document-manager/DocumentManager.css b/frontend/src/components/custom-tools/document-manager/DocumentManager.css
index 788878b2a..97a507856 100644
--- a/frontend/src/components/custom-tools/document-manager/DocumentManager.css
+++ b/frontend/src/components/custom-tools/document-manager/DocumentManager.css
@@ -32,4 +32,9 @@
.rpv-default-layout__container {
border: 0 !important;
-}
\ No newline at end of file
+}
+
+.doc-main-title{
+ color: darkgray;
+ font-weight: 600;
+}
diff --git a/frontend/src/components/custom-tools/document-manager/DocumentManager.jsx b/frontend/src/components/custom-tools/document-manager/DocumentManager.jsx
index 754589098..850e3dc91 100644
--- a/frontend/src/components/custom-tools/document-manager/DocumentManager.jsx
+++ b/frontend/src/components/custom-tools/document-manager/DocumentManager.jsx
@@ -171,15 +171,20 @@ function DocumentManager({ generateIndex, handleUpdateTool, handleDocChange }) {
/>
</div>
<Space>
+ <div>
+ {selectedDoc ? (
+ <Typography.Text className="doc-main-title" ellipsis>
+ {selectedDoc}
+ </Typography.Text>
+ ) : null}
+ </div>
<div>
<Tooltip title="Manage Documents">
<Button
className="doc-manager-btn"
onClick={() => setOpenManageDocsModal(true)}
>
- <Typography.Text ellipsis>
- {selectedDoc || "No Document Selected"}
- </Typography.Text>
+ <Typography.Text ellipsis>{"Manage Documents"}</Typography.Text>
</Button>
</Tooltip>
</div>
diff --git a/frontend/src/components/custom-tools/document-parser/DocumentParser.jsx b/frontend/src/components/custom-tools/document-parser/DocumentParser.jsx
index 95f1fdcab..2528f1c66 100644
--- a/frontend/src/components/custom-tools/document-parser/DocumentParser.jsx
+++ b/frontend/src/components/custom-tools/document-parser/DocumentParser.jsx
@@ -57,9 +57,27 @@ function DocumentParser({
value = event.target.value;
}
- if (!value && name === "prompt_key") {
+ if (name === "prompt_key") {
// Return if the prompt or the prompt key is empty
- return;
+ if (!value) {
+ return;
+ }
+ if (!isValidJsonKey(value)) {
+ handleUpdateStatus(
+ isUpdateStatus,
+ promptId,
+ promptStudioUpdateStatus.validationError
+ );
+ return;
+ }
+ }
+
+ function isValidJsonKey(key) {
+ // Check for Prompt-Key
+ // Allowed case, contains alphanumeric characters and underscores,
+ // and doesn't start with a number.
+ const regex = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
+ return regex.test(key);
}
const index = promptsAndNotes.findIndex(
@@ -149,7 +167,6 @@ function DocumentParser({
if (!isUpdate) {
return;
}
-
setUpdateStatus({
promptId: promptId,
status: value,
diff --git a/frontend/src/components/custom-tools/editable-text/EditableText.css b/frontend/src/components/custom-tools/editable-text/EditableText.css
index 8cf908e74..9052bb660 100644
--- a/frontend/src/components/custom-tools/editable-text/EditableText.css
+++ b/frontend/src/components/custom-tools/editable-text/EditableText.css
@@ -14,4 +14,8 @@
.edit-text-display-hover:hover {
border: 1px solid #bdbdbd;
border-radius: 4px;
-}
\ No newline at end of file
+}
+
+.input-header-text {
+ font-weight: bold;
+}
diff --git a/frontend/src/components/custom-tools/editable-text/EditableText.jsx b/frontend/src/components/custom-tools/editable-text/EditableText.jsx
index 3e2882d0f..466b40115 100644
--- a/frontend/src/components/custom-tools/editable-text/EditableText.jsx
+++ b/frontend/src/components/custom-tools/editable-text/EditableText.jsx
@@ -5,7 +5,6 @@ import debounce from "lodash/debounce";
import "./EditableText.css";
import { useCustomToolStore } from "../../../store/custom-tool-store";
-
function EditableText({
isEditing,
setIsEditing,
@@ -92,7 +91,7 @@ function EditableText({
return (
<Input
- className="font-size-12 width-100"
+ className="font-size-14 width-100 input-header-text"
value={text}
onChange={handleTextChange}
placeholder="Enter Key"
diff --git a/frontend/src/components/custom-tools/prompt-card/PromptCard.css b/frontend/src/components/custom-tools/prompt-card/PromptCard.css
index 035fd4594..1062c93ad 100644
--- a/frontend/src/components/custom-tools/prompt-card/PromptCard.css
+++ b/frontend/src/components/custom-tools/prompt-card/PromptCard.css
@@ -70,7 +70,7 @@
}
.prompt-card-result {
- padding-top: 12px;
+ padding-top: 12px;
background-color: #FFF8E6;
border-radius: 0px 0px 8px 8px;
}
@@ -112,4 +112,4 @@
.assertion-comp .ant-collapse-content-box {
padding: 0px !important;
-}
\ No newline at end of file
+}
diff --git a/frontend/src/components/custom-tools/prompt-card/PromptCard.jsx b/frontend/src/components/custom-tools/prompt-card/PromptCard.jsx
index 24af3063a..e3fc2b8ab 100644
--- a/frontend/src/components/custom-tools/prompt-card/PromptCard.jsx
+++ b/frontend/src/components/custom-tools/prompt-card/PromptCard.jsx
@@ -610,7 +610,7 @@ function PromptCard({
>
<Space direction="vertical" className="width-100" ref={divRef}>
<Row>
- <Col span={16}>
+ <Col span={12}>
<EditableText
isEditing={isEditingTitle}
setIsEditing={setIsEditingTitle}
@@ -622,7 +622,7 @@ function PromptCard({
placeHolder={updatePlaceHolder}
/>
</Col>
- <Col span={8} className="display-flex-right">
+ <Col span={12} className="display-flex-right">
{isCoverageLoading && (
<Tag
icon={<LoadingOutlined spin />}
@@ -654,6 +654,16 @@ function PromptCard({
Done
</Tag>
)}
+ {updateStatus?.status ===
+ promptStudioUpdateStatus.validationError && (
+ <Tag
+ icon={<CheckCircleOutlined />}
+ color="error"
+ className="display-flex-align-center"
+ >
+ Invalid JSON Key
+ </Tag>
+ )}
</>
)}
<Tooltip title="Edit">
diff --git a/frontend/src/helpers/GetStaticData.js b/frontend/src/helpers/GetStaticData.js
index 6b2701d85..30337cae6 100644
--- a/frontend/src/helpers/GetStaticData.js
+++ b/frontend/src/helpers/GetStaticData.js
@@ -230,6 +230,7 @@ const endpointType = {
const promptStudioUpdateStatus = {
isUpdating: "IS_UPDATING",
done: "DONE",
+ validationError: "VALIDATION_ERROR",
};
const getTimeForLogs = () => {