Skip to content

Commit 175c288

Browse files
[Fix] Table output component for record type (#753)
fixed table output component for record type Co-authored-by: vishnuszipstack <117254672+vishnuszipstack@users.noreply.github.com>
1 parent bac1a78 commit 175c288

2 files changed

Lines changed: 13 additions & 8 deletions

File tree

frontend/src/components/custom-tools/prompt-card/PromptOutput.jsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import { SpinnerLoader } from "../../widgets/spinner-loader/SpinnerLoader";
2626
import { TokenUsage } from "../token-usage/TokenUsage";
2727
import { useWindowDimensions } from "../../../hooks/useWindowDimensions";
2828
import { useCustomToolStore } from "../../../store/custom-tool-store";
29-
import { TABLE_ENFORCE_TYPE } from "./constants";
29+
import { TABLE_ENFORCE_TYPE, RECORD_ENFORCE_TYPE } from "./constants";
3030
import { CopyPromptOutputBtn } from "./CopyPromptOutputBtn";
3131
import { useAlertStore } from "../../../store/alert-store";
3232
import { PromptOutputExpandBtn } from "./PromptOutputExpandBtn";
@@ -78,6 +78,8 @@ function PromptOutput({
7878
} = useCustomToolStore();
7979
const { setAlertDetails } = useAlertStore();
8080
const { generatePromptOutputKey } = usePromptOutput();
81+
const isTableExtraction =
82+
enforceType === TABLE_ENFORCE_TYPE || enforceType === RECORD_ENFORCE_TYPE;
8183

8284
const tooltipContent = (adapterConf) => (
8385
<div>
@@ -100,7 +102,7 @@ function PromptOutput({
100102
const getColSpan = () => (componentWidth < 1200 ? 24 : 6);
101103

102104
const copyOutputToClipboard = (text) => {
103-
if (!text || text === "undefined" || enforceType === TABLE_ENFORCE_TYPE) {
105+
if (!text || text === "undefined" || isTableExtraction) {
104106
return;
105107
}
106108

@@ -152,7 +154,7 @@ function PromptOutput({
152154
)}
153155
<div className="prompt-profile-run">
154156
<CopyPromptOutputBtn
155-
isDisabled={enforceType === TABLE_ENFORCE_TYPE}
157+
isDisabled={isTableExtraction}
156158
copyToClipboard={() =>
157159
copyOutputToClipboard(displayPromptResult(promptOutput, true))
158160
}
@@ -323,7 +325,7 @@ function PromptOutput({
323325
<>
324326
<Divider className="prompt-card-divider" />
325327
<div className={"prompt-card-result prompt-card-div"}>
326-
{enforceType === TABLE_ENFORCE_TYPE ? (
328+
{isTableExtraction ? (
327329
<div />
328330
) : (
329331
<>
@@ -374,7 +376,7 @@ function PromptOutput({
374376
</Button>
375377
</Tooltip>
376378
<CopyPromptOutputBtn
377-
isDisabled={enforceType === TABLE_ENFORCE_TYPE}
379+
isDisabled={isTableExtraction}
378380
copyToClipboard={() =>
379381
copyOutputToClipboard(
380382
displayPromptResult(promptOutputData?.output, true)
@@ -390,7 +392,7 @@ function PromptOutput({
390392
/>
391393
</div>
392394
</div>
393-
{enforceType === TABLE_ENFORCE_TYPE && TableOutput && (
395+
{isTableExtraction && TableOutput && (
394396
<TableOutput output={promptOutputData?.output} />
395397
)}
396398
</>

frontend/src/components/custom-tools/prompt-card/PromptOutputsModal.jsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { Col, Image, Modal, Row, Typography } from "antd";
22
import PropTypes from "prop-types";
3+
34
import { DisplayPromptResult } from "./DisplayPromptResult";
4-
import { TABLE_ENFORCE_TYPE } from "./constants";
5+
import { TABLE_ENFORCE_TYPE, RECORD_ENFORCE_TYPE } from "./constants";
56
import SpaceWrapper from "../../widgets/space-wrapper/SpaceWrapper";
67
import { useCustomToolStore } from "../../../store/custom-tool-store";
78
import usePromptOutput from "../../../hooks/usePromptOutput";
@@ -78,7 +79,9 @@ function PromptOutputsModal({
7879
)}
7980
</div>
8081
<div className="flex-1 overflow-y-auto pad-top-10">
81-
{enforceType === TABLE_ENFORCE_TYPE && TableOutput ? (
82+
{(enforceType === TABLE_ENFORCE_TYPE ||
83+
enforceType === RECORD_ENFORCE_TYPE) &&
84+
TableOutput ? (
8285
<TableOutput
8386
output={promptOutputData?.output}
8487
pagination={10}

0 commit comments

Comments
 (0)