Skip to content

DSE-44371: Swap the Examples step with Prompt step #79

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

Open
wants to merge 1 commit into
base: dev
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
54 changes: 29 additions & 25 deletions app/client/src/pages/DataGenerator/Prompt.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import TextArea from 'antd/es/input/TextArea';
import FileSelectorButton from './FileSelectorButton';
import { useMutation } from '@tanstack/react-query';
import first from 'lodash/first';
import ResetIcon from './ResetIcon';

const { Title } = Typography;

Expand Down Expand Up @@ -254,6 +255,33 @@ const Prompt = () => {
setPrompt={setPrompt}
/>
}
<RestoreDefaultBtn
icon={<ResetIcon />}
type="link"
onClick={() => {
return Modal.warning({
title: 'Restore Default Prompt',
closable: true,
content: <>{'Are you sure you want to restore to the default prompt? Your current prompt will be lost.'}</>,
footer: (
<ModalButtonGroup gap={8} justify='end'>
<Button onClick={() => Modal.destroyAll()}>{'Cancel'}</Button>
<Button
onClick={() => {
form.setFieldValue('custom_prompt', defaultPromptRef.current)
Modal.destroyAll()
}}
type='primary'
>
{'Confirm'}
</Button>
</ModalButtonGroup>
),
maskClosable: true,
})
}}>
{'Restore'}
</RestoreDefaultBtn>
</Flex>
</div>
}
Expand All @@ -263,31 +291,7 @@ const Prompt = () => {
>
<StyledTextArea autoSize placeholder={'Enter a prompt'}/>
</StyledPromptFormItem>
<RestoreDefaultBtn
onClick={() => {
return Modal.warning({
title: 'Restore Default Prompt',
closable: true,
content: <>{'Are you sure you want to restore to the default prompt? Your current prompt will be lost.'}</>,
footer: (
<ModalButtonGroup gap={8} justify='end'>
<Button onClick={() => Modal.destroyAll()}>{'Cancel'}</Button>
<Button
onClick={() => {
form.setFieldValue('custom_prompt', defaultPromptRef.current)
Modal.destroyAll()
}}
type='primary'
>
{'Confirm'}
</Button>
</ModalButtonGroup>
),
maskClosable: true,
})
}}>
{'Restore'}
</RestoreDefaultBtn>


</div>
{((workflow_type === WorkflowType.CUSTOM_DATA_GENERATION && !isEmpty(doc_paths)) ||
Expand Down
21 changes: 21 additions & 0 deletions app/client/src/pages/DataGenerator/ResetIcon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React from 'react';

// eslint-disable-next-line @typescript-eslint/no-explicit-any
const ResetIcon = (props: any) =>
/*#__PURE__*/ React.createElement(
"svg",
{
viewBox: "0 0 24 24",
fill: "none",
width: "1em",
height: "1em",
className: "cdp-icon-ai-assistant",
...props,
},
/*#__PURE__*/ React.createElement("path", {
d: "M11.013 10.99h-7.99V3h1.998v3.39c1.646-2.048 4.163-3.367 6.991-3.367 4.956 0 8.988 4.032 8.988 8.988 0 4.957-4.032 8.99-8.988 8.99-3.905 0-7.227-2.508-8.464-5.993h2.157c1.124 2.357 3.525 3.995 6.307 3.995 3.855 0 6.99-3.137 6.99-6.992 0-3.854-3.135-6.99-6.99-6.99-2.772 0-5.164 1.626-6.294 3.971h5.295v1.997z",
fill: "currentColor",
}),
);

export default ResetIcon;
2 changes: 1 addition & 1 deletion app/client/src/pages/Evaluator/FreeFromEvaluationTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
import { themeMaterial } from "ag-grid-community";
import get from 'lodash/get';
import { getColorCode } from './util';
import { Badge, Popover, Tooltip } from 'antd';
import { Badge, Popover } from 'antd';
import styled from 'styled-components';

interface Props {
Expand Down