ChatALL icon indicating copy to clipboard operation
ChatALL copied to clipboard

Feat: support managing predefined prompts with editing and replacement"

Open qcgm1978 opened this issue 2 years ago • 10 comments
trafficstars

… after editing, it will replace the original prompt. Otherwise, it will create a new prompt.

截屏2023-07-22 20 29 41

Summary by CodeRabbit

  • New Features

    • The edit button is now always visible, enhancing user accessibility.
    • Introduced a new computed property to filter and display prompts based on user selections.
  • Bug Fixes

    • Improved logic for adding prompts, allowing new prompts to be added at the end if no specific index is provided.

qcgm1978 avatar Jul 22 '23 12:07 qcgm1978

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
chatall ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 22, 2023 0:31am

vercel[bot] avatar Jul 22 '23 12:07 vercel[bot]

@tanchekwei Could you give a review? I believe you must have some reason to prevent editing the predefined prompts.

sunner avatar Jul 22 '23 23:07 sunner

@tanchekwei Could you give a review? I believe you must have some reason to prevent editing the predefined prompts.

Added comment.

If a user wants to edit a predefined prompt, currently they can pin a prompt (which will add it to local storage) and then edit it.

tanchekwei avatar Jul 23 '23 01:07 tanchekwei

@sunner, do you think we need to add another button, Duplicate button, for users to duplicate a predefined prompt and let them click the Edit button to modify it? Or, should we go with @qcgm1978’s approach and simply use the current Edit button for both duplicate and edit actions?

If we choose to add a Duplicate button, users will need to click two buttons to edit a predefined prompt: first, they click the Duplicate button, and then they click the Edit button. This approach is clearer.

if we use the Edit button for both actions, users will only need to click it once to edit the prompt. However, the existing edit button already use to edit the current user's prompt, same button with different behaviors may lead to confusion. What do you think?

tanchekwei avatar Jul 23 '23 02:07 tanchekwei

Frankly speaking, I prefer an empty customized prompt library. The owner can choose to insert/edit/delete prompts, and import bulk prompts from other sources.

sunner avatar Jul 23 '23 03:07 sunner

@coderabbitai review

PeterDaveHello avatar Sep 29 '24 10:09 PeterDaveHello

:white_check_mark: Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

coderabbitai[bot] avatar Sep 29 '24 10:09 coderabbitai[bot]

Walkthrough

The changes involve updates to the rendering logic and state management within the application. In PromptModal.vue, the edit button is now always rendered, while the delete button retains its conditional display. Additionally, a new computed property filters prompts based on user-defined titles. In the Vuex store, the editPrompt mutation has been modified to allow adding new prompts at the end of the list if no specific index is provided.

Changes

File Change Summary
src/components/PromptModal.vue The edit button is always rendered; a new computed property userPromptsTitles is added to filter prompts based on user-defined titles.
src/store/index.js The editPrompt mutation now sets index to the length of the state.prompts array if values.index is undefined, allowing for new prompt additions.

Poem

In the meadow where prompts play,
A button shines bright, come what may.
With titles that dance and twirl,
New prompts join the happy swirl.
Hopping along, we cheer and say,
"Let's edit and create, hip-hip-hooray!" 🐇✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 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 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.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

coderabbitai[bot] avatar Sep 29 '24 10:09 coderabbitai[bot]

@qcgm1978 Hi! Just checking if you still want to continue with this project. Let me know if you have other thoughts! 😊

PeterDaveHello avatar Oct 12 '24 15:10 PeterDaveHello

@qcgm1978 Hi! Just checking if you still want to continue with this project. Let me know if you have other thoughts! 😊

I haven't been following the project for a while now, so I don't recall well what the changes here are about, and it's possible the approach back then was inadequate. You should feel more confident to refine it.

qcgm1978 avatar Oct 12 '24 17:10 qcgm1978