Skip to content

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

FIX: Rearranged Prompt Card Buttons and Floating Copy Button for Better UX (#799)

Tahier Hussainb005ad453c09
diff --git a/frontend/src/components/custom-tools/prompt-card/PromptCard.css b/frontend/src/components/custom-tools/prompt-card/PromptCard.css
index eddc4d1a5..44fa1ab8c 100644
--- a/frontend/src/components/custom-tools/prompt-card/PromptCard.css
+++ b/frontend/src/components/custom-tools/prompt-card/PromptCard.css
@@ -75,11 +75,8 @@
.prompt-card-result {
padding-top: 12px;
+ position: relative;
background-color: #fff8e6;
- display: flex;
- justify-content: space-between;
- align-items: center;
- width: -webkit-fill-available;
}
.prompt-card-result .ant-typography {
@@ -128,15 +125,29 @@
.llm-info {
display: flex;
align-items: center;
+ justify-content: space-between;
}
-.prompt-card-llm-title {
- margin: 0 0 0 10px !important;
+.llm-info-left {
+ display: flex;
+ align-items: center;
+ flex: 1 1 auto;
+ overflow: hidden;
+}
+
+.llm-info-right {
+ flex-shrink: 0;
}
.prompt-card-llm-icon {
- display: flex;
- justify-content: center;
+ flex-shrink: 0;
+}
+
+.prompt-card-llm-title {
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ margin-left: 8px;
}
.prompt-cost-item {
@@ -146,13 +157,10 @@
.prompt-info {
display: flex;
+ align-items: center;
justify-content: space-between;
}
-.llm-info-container > * {
- margin-left: 10px;
-}
-
.prompt-card-llm-container {
border-right: 1px solid #0000000f;
width: fill-available !important;
@@ -169,20 +177,28 @@
}
.collapsed-output {
- max-height: 20px; /* Adjust height as necessary */
+ max-height: 20px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.expanded-output {
- max-height: 250px; /* Adjust height as necessary */
+ max-height: 250px;
overflow-y: auto;
}
.prompt-profile-run {
- align-self: flex-end;
- margin-left: 10px;
+ position: absolute;
+ top: 10px;
+ right: 10px;
+ opacity: 0;
+ transition: opacity 0.3s;
+}
+
+/* Show the copy button when hovering over the parent div */
+.prompt-card-result:hover .prompt-profile-run {
+ opacity: 1;
}
.index-output-tab {
@@ -220,13 +236,24 @@
.prompt-output-llm-bg {
background-color: #dddddd;
padding: 10px;
+ display: flex;
+ align-items: center;
}
.prompt-output-title {
font-size: 18px;
}
-/* PromptCard.css */
+.prompt-output-icon-enabled {
+ color: #52c41a;
+ margin-left: 5px;
+}
+
+.prompt-output-icon-disabled {
+ color: #babbbc;
+ margin-left: 5px;
+}
+
.chunk-highlight {
background-color: yellow;
}
diff --git a/frontend/src/components/custom-tools/prompt-card/PromptOutput.jsx b/frontend/src/components/custom-tools/prompt-card/PromptOutput.jsx
index 962c95132..7f766d800 100644
--- a/frontend/src/components/custom-tools/prompt-card/PromptOutput.jsx
+++ b/frontend/src/components/custom-tools/prompt-card/PromptOutput.jsx
@@ -209,16 +209,55 @@ function PromptOutput({
<Divider className="prompt-card-divider" />
<Space direction="vertical" className="prompt-card-llm-layout">
<div className="llm-info">
- <Image
- src={profile?.icon}
- width={15}
- height={15}
- preview={false}
- className="prompt-card-llm-icon"
- />
- <Typography.Text className="prompt-card-llm-title">
- {profile?.conf?.LLM}
- </Typography.Text>
+ <div className="llm-info-left">
+ <Image
+ src={profile?.icon}
+ width={15}
+ height={15}
+ preview={false}
+ className="prompt-card-llm-icon"
+ />
+ <Typography.Text
+ className="prompt-card-llm-title"
+ ellipsis={{ tooltip: profile?.conf?.LLM }}
+ >
+ {profile?.conf?.LLM}
+ </Typography.Text>
+ </div>
+ <div className="llm-info-right">
+ <Space>
+ <Tooltip title={tooltipContent(profile?.conf)}>
+ <InfoCircleOutlined className="prompt-card-actions-head" />
+ </Tooltip>
+ <Tooltip title="Chunk used">
+ <DatabaseOutlined
+ onClick={() => {
+ setIsIndexOpen(true);
+ setOpenIndexProfile(promptOutputData?.context);
+ }}
+ className="prompt-card-actions-head"
+ />
+ </Tooltip>
+ {ChallengeModal && (
+ <ChallengeModal
+ challengeData={
+ promptOutputData?.challengeData || {}
+ }
+ context={promptOutputData?.context || ""}
+ tokenUsage={promptOutputData?.tokenUsage || {}}
+ />
+ )}
+ {isNotSingleLlmProfile && (
+ <Tooltip title="Select Default">
+ <Radio
+ checked={profileId === selectedLlmProfileId}
+ onChange={() => handleSelectDefaultLLM(profileId)}
+ disabled={isPublicSource}
+ />
+ </Tooltip>
+ )}
+ </Space>
+ </div>
</div>
<div className="prompt-cost">
<Typography.Text className="prompt-cost-item">
@@ -244,82 +283,29 @@ function PromptOutput({
</Typography.Text>
</div>
<div className="prompt-info">
- <CheckableTag
- checked={isChecked}
- onChange={(checked) =>
- handleTagChange(checked, profileId)
- }
- disabled={isPublicSource}
- className={isChecked ? "checked" : "unchecked"}
- >
- {isChecked ? (
- <span>
- Enabled
- <CheckCircleOutlined
- style={{
- color: "#52c41a",
- marginLeft: "5px",
- }}
- />
- </span>
- ) : (
- <span>
- Disabled
- <ExclamationCircleFilled
- style={{
- color: "#BABBBC",
- marginLeft: "5px",
- }}
- />
- </span>
- )}
- </CheckableTag>
- <div className="llm-info-container">
- <Tooltip title={tooltipContent(profile?.conf)}>
- <InfoCircleOutlined className="prompt-card-actions-head" />
- </Tooltip>
- <Tooltip title="Chunk used">
- <DatabaseOutlined
- onClick={() => {
- setIsIndexOpen(true);
- setOpenIndexProfile(promptOutputData?.context);
- }}
- className="prompt-card-actions-head"
- />
- </Tooltip>
- {ChallengeModal && (
- <ChallengeModal
- challengeData={promptOutputData?.challengeData || {}}
- context={promptOutputData?.context || ""}
- tokenUsage={promptOutputData?.tokenUsage || {}}
- />
- )}
- {isNotSingleLlmProfile && (
- <Radio
- checked={profileId === selectedLlmProfileId}
- onChange={() => handleSelectDefaultLLM(profileId)}
- disabled={isPublicSource}
- >
- Default
- </Radio>
- )}
+ <div>
+ <CheckableTag
+ checked={isChecked}
+ onChange={(checked) =>
+ handleTagChange(checked, profileId)
+ }
+ disabled={isPublicSource}
+ className={isChecked ? "checked" : "unchecked"}
+ >
+ {isChecked ? (
+ <span>
+ Enabled
+ <CheckCircleOutlined className="prompt-output-icon-enabled" />
+ </span>
+ ) : (
+ <span>
+ Disabled
+ <ExclamationCircleFilled className="prompt-output-icon-disabled" />
+ </span>
+ )}
+ </CheckableTag>
</div>
- </div>
- </Space>
- <>
- <Divider className="prompt-card-divider" />
- <div className={"prompt-card-result prompt-card-div"}>
- {isTableExtraction ? (
- <div />
- ) : (
- <DisplayPromptResult
- output={promptOutputData?.output}
- profileId={profileId}
- docId={selectedDoc?.document_id}
- promptRunStatus={promptRunStatus}
- />
- )}
- <div className="prompt-profile-run">
+ <div>
<Tooltip title="Run LLM for current document">
<Button
size="small"
@@ -356,14 +342,6 @@ function PromptOutput({
<PlayCircleFilled className="prompt-card-actions-head" />
</Button>
</Tooltip>
- <CopyPromptOutputBtn
- isDisabled={isTableExtraction}
- copyToClipboard={() =>
- copyOutputToClipboard(
- displayPromptResult(promptOutputData?.output, true)
- )
- }
- />
<PromptOutputExpandBtn
promptId={promptDetails?.prompt_id}
llmProfiles={llmProfileDetails}
@@ -374,9 +352,36 @@ function PromptOutput({
/>
</div>
</div>
- {isTableExtraction && TableOutput && (
- <TableOutput output={promptOutputData?.output} />
- )}
+ </Space>
+ <>
+ <Divider className="prompt-card-divider" />
+ <div className="prompt-card-result prompt-card-div">
+ {isTableExtraction && TableOutput ? (
+ <TableOutput output={promptOutputData?.output} />
+ ) : (
+ <>
+ <DisplayPromptResult
+ output={promptOutputData?.output}
+ profileId={profileId}
+ docId={selectedDoc?.document_id}
+ promptRunStatus={promptRunStatus}
+ />
+ <div className="prompt-profile-run">
+ <CopyPromptOutputBtn
+ isDisabled={isTableExtraction}
+ copyToClipboard={() =>
+ copyOutputToClipboard(
+ displayPromptResult(
+ promptOutputData?.output,
+ true
+ )
+ )
+ }
+ />
+ </div>
+ </>
+ )}
+ </div>
</>
</Col>
</motion.div>
diff --git a/frontend/src/components/custom-tools/prompt-card/PromptOutputsModal.jsx b/frontend/src/components/custom-tools/prompt-card/PromptOutputsModal.jsx
index 939277735..4fdce45b7 100644
--- a/frontend/src/components/custom-tools/prompt-card/PromptOutputsModal.jsx
+++ b/frontend/src/components/custom-tools/prompt-card/PromptOutputsModal.jsx
@@ -66,7 +66,7 @@ function PromptOutputsModal({
<div className="flex-dir-col">
<div>
{displayLlmProfile && (
- <div className="llm-info prompt-output-llm-bg">
+ <div className="prompt-output-llm-bg">
<Image
src={profile?.icon}
width={15}