feat: Dummy Generate Prompt Button (#39964)
## Description https://github.com/appsmithorg/appsmith-ee/pull/6813 ## Automation /ok-to-test tags="@tag.Sanity" ### 🔍 Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/14126942963> > Commit: 8fc65a57e1a3daa89cd44e43a5e399fbb26c9b6c > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=14126942963&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.Sanity` > Spec: > <hr>Fri, 28 Mar 2025 11:09:57 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a prompt generation button in the form interface, allowing users to view the current prompt and update it interactively. - Added a new component, `GeneratePromptButton`, to facilitate prompt generation based on existing instructions. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
parent
0da21be439
commit
0ac87dbfe2
12
app/client/src/ce/components/GeneratePromptButton.tsx
Normal file
12
app/client/src/ce/components/GeneratePromptButton.tsx
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import React from "react";
|
||||
|
||||
export interface GeneratePromptButtonProps {
|
||||
existingPrompt: string;
|
||||
onSubmit: (prompt: string) => void;
|
||||
}
|
||||
|
||||
// Implementation is in ee
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
export const GeneratePromptButton = (props: GeneratePromptButtonProps) => {
|
||||
return <div />;
|
||||
};
|
||||
|
|
@ -10,6 +10,7 @@ import { connect } from "react-redux";
|
|||
import { get, omit } from "lodash";
|
||||
import type { AppState } from "ee/reducers";
|
||||
import type { Action } from "entities/Action";
|
||||
import { GeneratePromptButton } from "ee/components/GeneratePromptButton";
|
||||
|
||||
const StyledButton = styled((props: ButtonProps & { isActive: boolean }) => (
|
||||
<Button {...omit(props, ["isActive"])} />
|
||||
|
|
@ -77,6 +78,9 @@ type FormTemplateProps = FormTemplatePartialProps &
|
|||
ReduxDispatchProps &
|
||||
ReduxStateProps;
|
||||
|
||||
const SYSTEM_INSTRUCTIONS_FIELD =
|
||||
"actionConfiguration.formData.aiChatAssistant.input.instructions";
|
||||
|
||||
export function FormTemplate(props: FormTemplateProps) {
|
||||
const { formName, formValues, options, updateFormProperty } = props;
|
||||
|
||||
|
|
@ -90,6 +94,12 @@ export function FormTemplate(props: FormTemplateProps) {
|
|||
});
|
||||
};
|
||||
|
||||
const existingPrompt = get(formValues, SYSTEM_INSTRUCTIONS_FIELD, "");
|
||||
|
||||
const onGeneratedPrompt = (prompt: string) => {
|
||||
updateFormProperty(formName, SYSTEM_INSTRUCTIONS_FIELD, prompt);
|
||||
};
|
||||
|
||||
const onClick = (option: FormTemplateOption) => {
|
||||
// Updates the form values with the option value
|
||||
const { value } = option;
|
||||
|
|
@ -113,6 +123,10 @@ export function FormTemplate(props: FormTemplateProps) {
|
|||
{option.label}
|
||||
</StyledButton>
|
||||
))}
|
||||
<GeneratePromptButton
|
||||
existingPrompt={existingPrompt}
|
||||
onSubmit={onGeneratedPrompt}
|
||||
/>
|
||||
</Flex>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
1
app/client/src/ee/components/GeneratePromptButton.tsx
Normal file
1
app/client/src/ee/components/GeneratePromptButton.tsx
Normal file
|
|
@ -0,0 +1 @@
|
|||
export { GeneratePromptButton } from "ce/components/GeneratePromptButton";
|
||||
Loading…
Reference in New Issue
Block a user