Skip to content

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

Fix/prompt-studio grammar bug fix (#61)

Athul9b47b1a9b77e
diff --git a/frontend/src/components/custom-tools/custom-synonyms/CustomSynonyms.jsx b/frontend/src/components/custom-tools/custom-synonyms/CustomSynonyms.jsx
index a8efb0bb8..6370090b9 100644
--- a/frontend/src/components/custom-tools/custom-synonyms/CustomSynonyms.jsx
+++ b/frontend/src/components/custom-tools/custom-synonyms/CustomSynonyms.jsx
@@ -142,7 +142,14 @@ function CustomSynonyms({ setOpen }) {
const handleSave = () => {
const promptGrammar = {};
[...synonyms].forEach((item) => {
- promptGrammar[item?.word] = item?.synonyms || [];
+ if (
+ !item?.word ||
+ !item?.synonyms?.length ||
+ item.word in promptGrammar
+ ) {
+ return;
+ }
+ promptGrammar[item.word] = item.synonyms || [];
});
if (promptGrammar && !isEmpty(promptGrammar)) {
const body = {
diff --git a/frontend/src/components/custom-tools/document-parser/DocumentParser.jsx b/frontend/src/components/custom-tools/document-parser/DocumentParser.jsx
index c99a6c96a..95f1fdcab 100644
--- a/frontend/src/components/custom-tools/document-parser/DocumentParser.jsx
+++ b/frontend/src/components/custom-tools/document-parser/DocumentParser.jsx
@@ -206,6 +206,7 @@ function DocumentParser({
handleDelete={handleDelete}
setOpenAddLlmModal={setOpenAddLlmModal}
updateStatus={updateStatus}
+ updatePlaceHolder="Enter Prompt"
/>
)}
{item.prompt_type === promptType.notes && (
@@ -214,6 +215,7 @@ function DocumentParser({
handleChange={handleChange}
handleDelete={handleDelete}
updateStatus={updateStatus}
+ updatePlaceHolder="Enter Notes"
/>
)}
<div ref={bottomRef} className="doc-parser-pad-bottom" />
diff --git a/frontend/src/components/custom-tools/editable-text/EditableText.jsx b/frontend/src/components/custom-tools/editable-text/EditableText.jsx
index 6a4e568bd..56c777e6b 100644
--- a/frontend/src/components/custom-tools/editable-text/EditableText.jsx
+++ b/frontend/src/components/custom-tools/editable-text/EditableText.jsx
@@ -15,6 +15,7 @@ function EditableText({
defaultText,
handleChange,
isTextarea,
+ placeHolder,
}) {
const name = isTextarea ? "prompt" : "prompt_key";
const [triggerHandleChange, setTriggerHandleChange] = useState(false);
@@ -74,7 +75,7 @@ function EditableText({
className="font-size-12 width-100"
value={text}
onChange={handleTextChange}
- placeholder="Enter Prompt"
+ placeholder={placeHolder}
name={name}
size="small"
style={{ backgroundColor: "transparent" }}
@@ -118,6 +119,7 @@ EditableText.propTypes = {
defaultText: PropTypes.string.isRequired,
handleChange: PropTypes.func.isRequired,
isTextarea: PropTypes.bool,
+ placeHolder: PropTypes.string,
};
export { EditableText };
diff --git a/frontend/src/components/custom-tools/notes-card/NotesCard.jsx b/frontend/src/components/custom-tools/notes-card/NotesCard.jsx
index 8f1a1e9b1..b6409b750 100644
--- a/frontend/src/components/custom-tools/notes-card/NotesCard.jsx
+++ b/frontend/src/components/custom-tools/notes-card/NotesCard.jsx
@@ -13,7 +13,13 @@ import { useState } from "react";
import { ConfirmModal } from "../../widgets/confirm-modal/ConfirmModal";
import { promptStudioUpdateStatus } from "../../../helpers/GetStaticData";
-function NotesCard({ details, handleChange, handleDelete, updateStatus }) {
+function NotesCard({
+ details,
+ handleChange,
+ handleDelete,
+ updateStatus,
+ updatePlaceHolder,
+}) {
const [promptKey, setPromptKey] = useState("");
const [promptText, setPromptText] = useState("");
const [isEditingTitle, setIsEditingTitle] = useState(false);
@@ -38,6 +44,7 @@ function NotesCard({ details, handleChange, handleDelete, updateStatus }) {
promptId={details?.prompt_id}
defaultText={details?.prompt_key}
handleChange={handleChange}
+ placeHolder={updatePlaceHolder}
/>
</Col>
<Col span={6} className="display-flex-right">
@@ -95,6 +102,7 @@ function NotesCard({ details, handleChange, handleDelete, updateStatus }) {
defaultText={details?.prompt}
handleChange={handleChange}
isTextarea={true}
+ placeHolder={updatePlaceHolder}
/>
</Space>
</Card>
@@ -106,6 +114,7 @@ NotesCard.propTypes = {
handleChange: PropTypes.func.isRequired,
handleDelete: PropTypes.func.isRequired,
updateStatus: PropTypes.object.isRequired,
+ updatePlaceHolder: PropTypes.string,
};
export { NotesCard };
diff --git a/frontend/src/components/custom-tools/prompt-card/PromptCard.jsx b/frontend/src/components/custom-tools/prompt-card/PromptCard.jsx
index ce527e894..24af3063a 100644
--- a/frontend/src/components/custom-tools/prompt-card/PromptCard.jsx
+++ b/frontend/src/components/custom-tools/prompt-card/PromptCard.jsx
@@ -73,6 +73,7 @@ function PromptCard({
handleChange,
handleDelete,
updateStatus,
+ updatePlaceHolder,
}) {
const [enforceTypeList, setEnforceTypeList] = useState([]);
const [page, setPage] = useState(0);
@@ -618,6 +619,7 @@ function PromptCard({
promptId={promptDetails?.prompt_id}
defaultText={promptDetails?.prompt_key}
handleChange={handleChange}
+ placeHolder={updatePlaceHolder}
/>
</Col>
<Col span={8} className="display-flex-right">
@@ -720,6 +722,7 @@ function PromptCard({
defaultText={promptDetails.prompt}
handleChange={handleChange}
isTextarea={true}
+ placeHolder={updatePlaceHolder}
/>
</Space>
</div>
@@ -867,6 +870,7 @@ PromptCard.propTypes = {
handleChange: PropTypes.func.isRequired,
handleDelete: PropTypes.func.isRequired,
updateStatus: PropTypes.object.isRequired,
+ updatePlaceHolder: PropTypes.string,
};
export { PromptCard };