Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added disabled view for disabled prompts #657

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,15 @@
}

.prompt-output-llm-bg {
background-color: #DDDDDD;
background-color: #dddddd;
padding: 10px;
}

.prompt-output-title {
font-size: 18px;
}

.card-disabled {
opacity: 0.7;
filter: grayscale(100%);
}
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,9 @@ function PromptCardItems({
}, [llmProfiles, selectedLlmProfileId, enabledProfiles]);

return (
<Card className="prompt-card">
<Card
className={`prompt-card ${!promptDetails?.active && "card-disabled"}`}
>
<div className="prompt-card-div prompt-card-bg-col1 prompt-card-rad">
<Space direction="vertical" className="width-100" ref={divRef}>
<Header
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import CheckableTag from "antd/es/tag/CheckableTag";
import {
displayPromptResult,
formatNumberWithCommas,
formatTimeMinuteSeconds,
getFormattedTotalCost,
} from "../../../helpers/GetStaticData";
import { SpinnerLoader } from "../../widgets/spinner-loader/SpinnerLoader";
Expand Down Expand Up @@ -123,7 +124,7 @@ function PromptOutput({

if (
(singlePassExtractMode || isSimplePromptStudio) &&
(promptDetails?.active || isSimplePromptStudio) &&
isSimplePromptStudio &&
(firstResult?.output ||
firstResult?.output === 0 ||
spsLoading[selectedDoc?.document_id])
Expand Down Expand Up @@ -211,7 +212,7 @@ function PromptOutput({
</Typography.Text>
<Typography.Text className="prompt-cost-item">
Time:
{timers[tokenUsageId] || 0}s
{formatTimeMinuteSeconds(timers[tokenUsageId]) || 0}
</Typography.Text>
<Typography.Text className="prompt-cost-item">
Cost: $
Expand Down
18 changes: 18 additions & 0 deletions frontend/src/helpers/GetStaticData.js
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,23 @@ const formatNumberWithCommas = (number) => {
: formattedIntegerPart;
};

// utils/formatTime.js
const formatTimeMinuteSeconds = (seconds) => {
if (!seconds) {
return `0s`;
}

const mins = Math.floor(seconds / 60);
const secs = seconds % 60;
// Pad single-digit seconds with leading zero
const formattedSeconds = secs < 10 ? `0${secs}` : secs;

if (seconds < 60) {
return `${formattedSeconds}s`;
}
return `${mins}m ${formattedSeconds}s`;
};

export {
CONNECTOR_TYPE_MAP,
O_AUTH_PROVIDERS,
Expand Down Expand Up @@ -563,4 +580,5 @@ export {
getDocIdFromKey,
displayURL,
formatNumberWithCommas,
formatTimeMinuteSeconds,
};
Loading