Skip to content

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

Prompt Studio Improvements (#505)

jagadeeswaran-zipstack3f01d13d9d1b
diff --git a/frontend/src/components/custom-tools/header-title/HeaderTitle.jsx b/frontend/src/components/custom-tools/header-title/HeaderTitle.jsx
index d5db9cab6..cdee23ef8 100644
--- a/frontend/src/components/custom-tools/header-title/HeaderTitle.jsx
+++ b/frontend/src/components/custom-tools/header-title/HeaderTitle.jsx
@@ -22,8 +22,10 @@ function HeaderTitle() {
<ArrowLeftOutlined />
</Button>
</div>
- <div className="custom-tools-name">
- <Typography.Text strong>{details?.tool_name}</Typography.Text>
+ <div>
+ <Typography.Text className="custom-tools-name" strong>
+ {details?.tool_name}
+ </Typography.Text>
<Button size="small" type="text" disabled>
<EditOutlined />
</Button>
diff --git a/frontend/src/components/custom-tools/header/Header.css b/frontend/src/components/custom-tools/header/Header.css
index f990c7087..157d974da 100644
--- a/frontend/src/components/custom-tools/header/Header.css
+++ b/frontend/src/components/custom-tools/header/Header.css
@@ -1,35 +1,36 @@
/* Styles for Header */
.custom-tools-header-layout {
- padding: 8px;
- background-color: #F5F7F9;
- display: flex;
- align-items: center;
+ padding: 8px;
+ background-color: #f5f7f9;
+ display: flex;
+ align-items: center;
}
.custom-tools-header-btns {
- display: flex;
- justify-content: space-between;
- margin-left: auto;
+ display: flex;
+ justify-content: space-between;
+ margin-left: auto;
}
.custom-tools-header-btns > div {
- padding: 0px 5px;
+ padding: 0px 5px;
}
.custom-tools-name {
- padding: 0px 8px;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
+ padding: 0px 8px;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ font-size: 16px;
}
.custom-tools-header-v-divider {
- border-right: 1px #D9D9D9 solid;
- padding: 0;
- margin: 0px 5px;
+ border-right: 1px #d9d9d9 solid;
+ padding: 0;
+ margin: 0px 5px;
}
.select-llm-pro-header {
- padding-top: 12px;
+ padding-top: 12px;
}
diff --git a/frontend/src/components/custom-tools/prompt-card/Header.jsx b/frontend/src/components/custom-tools/prompt-card/Header.jsx
index 41826f5df..6af40b3fd 100644
--- a/frontend/src/components/custom-tools/prompt-card/Header.jsx
+++ b/frontend/src/components/custom-tools/prompt-card/Header.jsx
@@ -1,14 +1,14 @@
import {
CheckCircleOutlined,
DeleteOutlined,
- EditOutlined,
LoadingOutlined,
+ MoreOutlined,
PlayCircleFilled,
PlayCircleOutlined,
SyncOutlined,
} from "@ant-design/icons";
import { useState } from "react";
-import { Button, Checkbox, Col, Divider, Row, Tag, Tooltip } from "antd";
+import { Button, Checkbox, Col, Dropdown, Row, Tag, Tooltip } from "antd";
import PropTypes from "prop-types";
import { promptStudioUpdateStatus } from "../../../helpers/GetStaticData";
@@ -30,7 +30,6 @@ function Header({
isCoverageLoading,
isEditingTitle,
setIsEditingTitle,
- enableEdit,
expandCard,
setExpandCard,
enabledProfiles,
@@ -61,6 +60,33 @@ function Header({
);
};
+ const items = [
+ {
+ label: (
+ <Checkbox checked={isDisablePrompt} onChange={handleDisablePrompt}>
+ {isDisablePrompt ? "Enabled" : "Disabled"}
+ </Checkbox>
+ ),
+ key: "enable",
+ },
+ {
+ label: (
+ <ConfirmModal
+ handleConfirm={() => handleDelete(promptDetails?.prompt_id)}
+ content="The prompt will be permanently deleted."
+ >
+ <DeleteOutlined /> Delete
+ </ConfirmModal>
+ ),
+ key: "delete",
+ disabled:
+ disableLlmOrDocChange?.includes(promptDetails?.prompt_id) ||
+ isSinglePassExtractLoading ||
+ indexDocs?.includes(selectedDoc?.document_id) ||
+ isPublicSource,
+ },
+ ];
+
return (
<Row>
<Col span={12}>
@@ -121,23 +147,6 @@ function Header({
)}
</>
)}
- <ExpandCardBtn expandCard={expandCard} setExpandCard={setExpandCard} />
- <Tooltip title="Edit">
- <Button
- size="small"
- type="text"
- className="prompt-card-action-button"
- onClick={enableEdit}
- disabled={
- disableLlmOrDocChange.includes(promptDetails?.prompt_id) ||
- isSinglePassExtractLoading ||
- indexDocs.includes(selectedDoc?.document_id) ||
- isPublicSource
- }
- >
- <EditOutlined className="prompt-card-actions-head" />
- </Button>
- </Tooltip>
{!singlePassExtractMode && (
<>
<Tooltip title="Run">
@@ -180,34 +189,17 @@ function Header({
</Tooltip>
</>
)}
- <Tooltip title={isDisablePrompt ? "Disable Prompt" : "Enable Prompt"}>
- <Checkbox
- checked={isDisablePrompt}
+ <Dropdown menu={{ items }} trigger={["click"]} placement="bottomLeft">
+ <Button
+ size="small"
+ type="text"
className="prompt-card-action-button"
- onChange={handleDisablePrompt}
- />
- </Tooltip>
- <Divider type="vertical" className="header-delete-divider" />
- <ConfirmModal
- handleConfirm={() => handleDelete(promptDetails?.prompt_id)}
- content="The prompt will be permanently deleted."
- >
- <Tooltip title="Delete">
- <Button
- size="small"
- type="text"
- className="prompt-card-action-button"
- disabled={
- disableLlmOrDocChange?.includes(promptDetails?.prompt_id) ||
- isSinglePassExtractLoading ||
- indexDocs?.includes(selectedDoc?.document_id) ||
- isPublicSource
- }
- >
- <DeleteOutlined className="prompt-card-actions-head" />
- </Button>
- </Tooltip>
- </ConfirmModal>
+ >
+ <MoreOutlined className="prompt-card-actions-head" />
+ </Button>
+ </Dropdown>
+
+ <ExpandCardBtn expandCard={expandCard} setExpandCard={setExpandCard} />
</Col>
</Row>
);
@@ -226,7 +218,6 @@ Header.propTypes = {
isCoverageLoading: PropTypes.bool.isRequired,
isEditingTitle: PropTypes.bool.isRequired,
setIsEditingTitle: PropTypes.func.isRequired,
- enableEdit: PropTypes.func.isRequired,
expandCard: PropTypes.bool.isRequired,
setExpandCard: PropTypes.func.isRequired,
enabledProfiles: PropTypes.array.isRequired,
diff --git a/frontend/src/components/custom-tools/prompt-card/PromptCardItems.jsx b/frontend/src/components/custom-tools/prompt-card/PromptCardItems.jsx
index 5fd5ff0ec..b8d147164 100644
--- a/frontend/src/components/custom-tools/prompt-card/PromptCardItems.jsx
+++ b/frontend/src/components/custom-tools/prompt-card/PromptCardItems.jsx
@@ -94,27 +94,27 @@ function PromptCardItems({
const [isIndexOpen, setIsIndexOpen] = useState(false);
const { width: windowWidth } = useWindowDimensions();
const componentWidth = windowWidth * 0.4;
-
+ const isNotSingleLlmProfile = llmProfiles.length > 1;
const divRef = useRef(null);
-
- const enableEdit = (event) => {
- event.stopPropagation();
- setExpandCard(true);
- setIsEditingTitle(true);
- setIsEditingPrompt(true);
- };
const getModelOrAdapterId = (profile, adapters) => {
const result = { conf: {} };
- const keys = ["vector_store", "embedding_model", "llm", "x2text"];
+ const keys = [
+ { key: "llm", label: "LLM" },
+ { key: "embedding_model", label: "Embedding Model" },
+ { key: "vector_store", label: "Vector Store" },
+ { key: "x2text", label: "Text Extractor" },
+ ];
keys.forEach((key) => {
- const adapterName = profile[key];
+ const adapterName = profile[key.key];
const adapter = adapters?.find(
(adapter) => adapter?.adapter_name === adapterName
);
if (adapter) {
- result.conf[key] = adapter?.model || adapter?.adapter_id?.split("|")[0];
+ result.conf[key.label] =
+ adapter?.model || adapter?.adapter_id?.split("|")[0];
if (adapter?.adapter_type === "LLM") result.icon = adapter?.icon;
+ result.conf["Profile Name"] = profile?.profile_name;
}
});
return result;
@@ -263,7 +263,6 @@ function PromptCardItems({
isCoverageLoading={isCoverageLoading}
isEditingTitle={isEditingTitle}
setIsEditingTitle={setIsEditingTitle}
- enableEdit={enableEdit}
expandCard={expandCard}
setExpandCard={setExpandCard}
enabledProfiles={enabledProfiles}
@@ -453,26 +452,30 @@ function PromptCardItems({
<Tooltip title={tooltipContent(profile?.conf)}>
<InfoCircleOutlined />
</Tooltip>
- <DatabaseOutlined
- onClick={() => {
- setIsIndexOpen(true);
- setOpenIndexProfile(
- result.find(
- (r) => r?.profileManager === profileId
- )?.context
- );
- }}
- className="prompt-card-actions-head"
- />
- <Radio
- checked={profileId === selectedLlmProfileId}
- onChange={() =>
- handleSelectDefaultLLM(profileId)
- }
- disabled={isPublicSource}
- >
- Default
- </Radio>
+ <Tooltip title="Chunck used">
+ <DatabaseOutlined
+ onClick={() => {
+ setIsIndexOpen(true);
+ setOpenIndexProfile(
+ result.find(
+ (r) => r?.profileManager === profileId
+ )?.context
+ );
+ }}
+ className="prompt-card-actions-head"
+ />
+ </Tooltip>
+ {isNotSingleLlmProfile && (
+ <Radio
+ checked={profileId === selectedLlmProfileId}
+ onChange={() =>
+ handleSelectDefaultLLM(profileId)
+ }
+ disabled={isPublicSource}
+ >
+ Default
+ </Radio>
+ )}
</div>
</div>
</Space>
@@ -522,36 +525,42 @@ function PromptCardItems({
</Typography.Paragraph>
)}
<div className="prompt-profile-run">
- <Tooltip title="Run">
- <Button
- size="small"
- type="text"
- className="prompt-card-action-button"
- onClick={() => handleRun(profileId, false)}
- disabled={
- isRunLoading[
- `${selectedDoc?.document_id}_${profileId}`
- ] || isPublicSource
- }
- >
- <PlayCircleOutlined className="prompt-card-actions-head" />
- </Button>
- </Tooltip>
- <Tooltip title="Run All">
- <Button
- size="small"
- type="text"
- className="prompt-card-action-button"
- onClick={() => handleRun(profileId, true)}
- disabled={
- isRunLoading[
- `${selectedDoc?.document_id}_${profileId}`
- ] || isPublicSource
- }
- >
- <PlayCircleFilled className="prompt-card-actions-head" />
- </Button>
- </Tooltip>
+ {isNotSingleLlmProfile && (
+ <>
+ <Tooltip title="Run">
+ <Button
+ size="small"
+ type="text"
+ className="prompt-card-action-button"
+ onClick={() =>
+ handleRun(profileId, false)
+ }
+ disabled={
+ isRunLoading[
+ `${selectedDoc?.document_id}_${profileId}`
+ ] || isPublicSource
+ }
+ >
+ <PlayCircleOutlined className="prompt-card-actions-head" />
+ </Button>
+ </Tooltip>
+ <Tooltip title="Run All">
+ <Button
+ size="small"
+ type="text"
+ className="prompt-card-action-button"
+ onClick={() => handleRun(profileId, true)}
+ disabled={
+ isRunLoading[
+ `${selectedDoc?.document_id}_${profileId}`
+ ] || isPublicSource
+ }
+ >
+ <PlayCircleFilled className="prompt-card-actions-head" />
+ </Button>
+ </Tooltip>
+ </>
+ )}
<Tooltip title="Expand">
<Button
size="small"