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

feat: Dummy Generate Prompt Button #39964

Merged
merged 3 commits into from
Mar 31, 2025
Merged

feat: Dummy Generate Prompt Button #39964

merged 3 commits into from
Mar 31, 2025

Conversation

hetunandu
Copy link
Member

@hetunandu hetunandu commented Mar 28, 2025

Description

https://github.com/appsmithorg/appsmith-ee/pull/6813

Automation

/ok-to-test tags="@tag.Sanity"

🔍 Cypress test results

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/14126942963
Commit: 8fc65a5
Cypress dashboard.
Tags: @tag.Sanity
Spec:


Fri, 28 Mar 2025 11:09:57 UTC

Communication

Should the DevRel and Marketing teams inform users about this change?

  • Yes
  • No

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.

@hetunandu hetunandu requested a review from KelvinOm March 28, 2025 10:09
Copy link
Contributor

coderabbitai bot commented Mar 28, 2025

Walkthrough

This pull request introduces a new React functional component, GeneratePromptButton, which currently returns an empty <div>. Additionally, the FormTemplateControl file is updated to define a constant SYSTEM_INSTRUCTIONS_FIELD for accessing a specific form field, and a new function onGeneratedPrompt is implemented to update the form. The GeneratePromptButton is integrated within the FormTemplate layout, receiving existingPrompt and onSubmit props for prompt generation.

Changes

File Path Summary
app/client/.../GeneratePromptButton.tsx Added GeneratePromptButton component that returns a <div />.
app/client/.../FormTemplateControl.tsx Added SYSTEM_INSTRUCTIONS_FIELD constant, onGeneratedPrompt function, and integrated <GeneratePromptButton> into the component.
app/client/.../GeneratePromptButton.tsx Exported GeneratePromptButton component from the ce/components/GeneratePromptButton module.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant FormTemplate as Form
    participant Button as GeneratePromptButton
    User->>Button: Click GeneratePromptButton
    Button->>Form: Invoke onSubmit (triggers onGeneratedPrompt)
    Form-->>Button: Update form with generated prompt
Loading

Possibly related PRs

  • fix: New query button does not show up issue fixed #36766: The changes in the main PR, which introduce the GeneratePromptButton component, are related to the retrieved PR as both involve the integration of the GeneratePromptButton component within different contexts, specifically in the FormTemplateControl component.
  • fix: fix for js visual spec snapshots #39154: The changes in the main PR, which introduce the GeneratePromptButton component, are related to the retrieved PR as the latter includes the integration of the same GeneratePromptButton component within the FormTemplate component.
  • chore: Adding permission check for the plus button in tabs list #39694: The changes in the main PR, which introduce the GeneratePromptButton component, are related to the retrieved PR as the latter modifies the FormTemplate component to include the GeneratePromptButton, directly connecting the two through the use of the same component.

Suggested labels

Templates Product, Widgets & Accelerators Pod

Suggested reviewers

  • ankitakinger
  • albinAppsmith

Poem

In our code garden a new button blooms,
Guiding prompts where innovation looms.
Constants and callbacks in rhythmic play,
Craft a fresh path in the digital fray.
Cheers to each change that brightens the day!


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@hetunandu hetunandu added the ok-to-test Required label for CI label Mar 28, 2025
@github-actions github-actions bot added the Enhancement New feature or request label Mar 28, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (2)
app/client/src/ce/components/GeneratePromptButton.tsx (1)

1-5: Documentation needed for placeholder implementation

This appears to be a placeholder implementation that will be overridden in the EE version. Consider adding a comment to clarify this is intentional and will be expanded upon in the EE implementation.

import React from "react";

+/**
+ * CE placeholder for the GeneratePromptButton component.
+ * This implementation will be overridden by the EE version.
+ */
export const GeneratePromptButton = () => {
  return <div />;
};
app/client/src/components/formControls/FormTemplateControl.tsx (1)

81-83: Add documentation for the AI prompt fields

Consider adding a comment explaining the purpose of this constant and how it relates to the AI prompt generation functionality.

+/**
+ * Path to the system instructions field in the form data
+ * This is used for AI chat assistant prompt generation
+ */
const SYSTEM_INSTRUCTIONS_FIELD =
  "actionConfiguration.formData.aiChatAssistant.input.instructions";
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 300e7d7 and f3bad5a.

📒 Files selected for processing (2)
  • app/client/src/ce/components/GeneratePromptButton.tsx (1 hunks)
  • app/client/src/components/formControls/FormTemplateControl.tsx (4 hunks)
🧰 Additional context used
🧬 Code Definitions (1)
app/client/src/components/formControls/FormTemplateControl.tsx (1)
app/client/src/ce/components/GeneratePromptButton.tsx (1)
  • GeneratePromptButton (3-5)
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: perform-test / rts-build / build
  • GitHub Check: perform-test / client-build / client-build
  • GitHub Check: perform-test / server-build / server-unit-tests
  • GitHub Check: client-unit-tests / client-unit-tests
  • GitHub Check: client-lint / client-lint
  • GitHub Check: client-check-cyclic-deps / check-cyclic-dependencies
  • GitHub Check: client-build / client-build
  • GitHub Check: client-prettier / prettier-check
🔇 Additional comments (2)
app/client/src/components/formControls/FormTemplateControl.tsx (2)

13-13: Verify import path for consistency

The component is imported from "ee/components/GeneratePromptButton" but defined in "ce/components/GeneratePromptButton.tsx". Ensure this follows your established CE/EE override pattern.


99-101: LGTM: Clear callback implementation

The callback for handling generated prompts is well-implemented, correctly updating the form with the new prompt value.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
app/client/src/components/formControls/FormTemplateControl.tsx (1)

81-82: Consider adding a comment explaining the purpose of this field path

The path string is quite long and its purpose isn't immediately clear. A comment would help other developers understand what this field represents.

+// Path to the system instructions field in the AI chat assistant configuration
const SYSTEM_INSTRUCTIONS_FIELD =
  "actionConfiguration.formData.aiChatAssistant.input.instructions";
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 300e7d7 and f3bad5a.

📒 Files selected for processing (2)
  • app/client/src/ce/components/GeneratePromptButton.tsx (1 hunks)
  • app/client/src/components/formControls/FormTemplateControl.tsx (4 hunks)
🧰 Additional context used
🧬 Code Definitions (1)
app/client/src/components/formControls/FormTemplateControl.tsx (1)
app/client/src/ce/components/GeneratePromptButton.tsx (1)
  • GeneratePromptButton (3-5)
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: perform-test / rts-build / build
  • GitHub Check: perform-test / client-build / client-build
  • GitHub Check: perform-test / server-build / server-unit-tests
  • GitHub Check: client-unit-tests / client-unit-tests
  • GitHub Check: client-lint / client-lint
  • GitHub Check: client-check-cyclic-deps / check-cyclic-dependencies
  • GitHub Check: client-build / client-build
  • GitHub Check: client-prettier / prettier-check
🔇 Additional comments (3)
app/client/src/components/formControls/FormTemplateControl.tsx (3)

97-97: Default value should be consistent with other form defaults

Make sure the empty string default is consistent with how other form values are initialized.


99-101: Function implementation looks correct

The function correctly updates the form property with the generated prompt.


126-129: Placeholder component with real props

The GeneratePromptButton is properly placed within the component hierarchy, but its implementation currently doesn't use these props. Ensure that this placeholder is replaced with a functional implementation in a follow-up PR.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
app/client/src/ce/components/GeneratePromptButton.tsx (1)

8-12: Consider enhancing the stub implementation.

While the stub implementation with an empty div is functional for CE version, consider:

  1. Adding JSDoc comments to describe the component's purpose and expected behavior in EE
  2. Using Fragment (<></>) instead of <div> for a zero-DOM-footprint stub
// Implementation is in ee
// eslint-disable-next-line @typescript-eslint/no-unused-vars
+/**
+ * A button component that generates AI prompts based on existing content.
+ * Actual implementation provided in Enterprise Edition.
+ */
export const GeneratePromptButton = (props: GeneratePromptButtonProps) => {
-  return <div />;
+  return <></>;
};
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro (Legacy)

📥 Commits

Reviewing files that changed from the base of the PR and between f3bad5a and 8fc65a5.

📒 Files selected for processing (2)
  • app/client/src/ce/components/GeneratePromptButton.tsx (1 hunks)
  • app/client/src/ee/components/GeneratePromptButton.tsx (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • app/client/src/ee/components/GeneratePromptButton.tsx
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: perform-test / client-build / client-build
  • GitHub Check: perform-test / rts-build / build
  • GitHub Check: perform-test / server-build / server-unit-tests
  • GitHub Check: client-check-cyclic-deps / check-cyclic-dependencies
  • GitHub Check: client-unit-tests / client-unit-tests
  • GitHub Check: client-build / client-build
  • GitHub Check: client-lint / client-lint
  • GitHub Check: client-prettier / prettier-check
🔇 Additional comments (1)
app/client/src/ce/components/GeneratePromptButton.tsx (1)

1-6: Clean interface definition with proper typing.

The GeneratePromptButtonProps interface is well-defined with appropriate types. Using a TypeScript interface for props is a good practice for maintaining type safety.

@hetunandu hetunandu merged commit 0ac87db into release Mar 31, 2025
45 checks passed
@hetunandu hetunandu deleted the feat/prompt-generation branch March 31, 2025 06:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request ok-to-test Required label for CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants