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

[Ellipsis] Let the user modify the prompt #3

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ellipsis-dev[bot]
Copy link

@ellipsis-dev ellipsis-dev bot commented May 14, 2024

Summary:

⚠️ We couldn't build/test your project to verify our changes. Add a Dockerfile to significantly improve code quality.

Issue: resolves #2

Implementation:

Step 1: Add a new command line option for overriding the default prompt

In the file src/commitm.zsh, modify the code that handles command line arguments to include a new option for the prompt. This should be done in the for loop that checks for command line options. Add a new condition that checks for the new option and sets a variable to the value provided by the user. The new option could be --prompt or -pr for short. Here is a code snippet for reference:

if [[ "$prev_arg" == "--prompt" ]] || [[ "$prev_arg" == "-pr" ]]; then
    prompt="$arg"
    # Reset prev_arg
    prev_arg=""
    continue
fi

This code should be added after the condition that checks for the --prefix option and before the condition that checks for the --execute option.

Step 2: Modify the code that displays the prompt to use the value provided by the user

In the file src/commitm.zsh, modify the show_echo function call in the modify_prompt function to use the value of the variable set by the new command line option if it exists. This should be done by adding a condition that checks if the variable is set and, if it is, replacing the default prompt with the value of the variable. Here is a code snippet for reference:

if [[ -n "$prompt" ]]; then
    show_echo "\n$prompt prompt: \e[1m\e[36m$(cat "$commit_message_temp_file")\e[0m\n"
else
    show_echo "\n$prompt_mod_description prompt: \e[1m\e[36m$(cat "$commit_message_temp_file")\e[0m\n"
fi

This code should replace the existing show_echo function call in the modify_prompt function.

Report:

Step Result Details
1
Add a new command line option for overriding the default promptSuccessfully implemented the feature that allows the user to modify the prompt. The user can now use the --prompt or -pr option to set a custom prompt, and this prompt will be displayed when the commit message is generated.
2
Modify the code that displays the prompt to use the value provided by the userSuccessfully modified the show_echo function call in the modify_prompt function to use the value of the prompt variable if it is set. If the prompt variable is not set, the default prompt is used instead.

Something look wrong?: If this Pull Request doesn't contain the expected changes, add more information to #2. Then, try again. For more information, check the documentation.

src/commitm.zsh Outdated
Comment on lines 148 to 152
if [[ -n "$prompt" ]]; then
show_echo "\n$prompt prompt: \e[1m\e[36m$(cat "$commit_message_temp_file")\e[0m\n"
else
show_echo "\n$prompt_mod_description prompt: \e[1m\e[36m$(cat "$commit_message_temp_file")\e[0m\n"
fi
Copy link
Owner

Choose a reason for hiding this comment

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

@ellipsis-dev this isn't the right way to set the prompt. you don't need to echo the prompt that the user passed. the prompt that the user passes should just be used for the llm call. please fix

Copy link
Author

Choose a reason for hiding this comment

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

@marissamarym, I have addressed your comments in commit 21900ba


You can configure Ellipsis to address comments with a direct commit or a side PR, see docs.

src/commitm.zsh Outdated
@@ -147,7 +155,7 @@ commitm() {
local git_changes=$(cat "$git_output_temp_file")

# Prepare the system prompt with modifications and git changes
local full_system_prompt="$system_prompt$prompt_mod"
local full_system_prompt="$system_prompt$prompt_mod$prompt"
Copy link
Owner

Choose a reason for hiding this comment

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

@ellipsis-dev it should replace the default prompt, not add onto it.

if the user specifies a custom prompt, you may need to add some text at the end to incorporate the prompt mod.

please fix

Copy link
Author

Choose a reason for hiding this comment

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

@marissamarym, I have addressed your comments in commit 20fd9e5


You can configure Ellipsis to address comments with a direct commit or a side PR, see docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Let the user modify the prompt
1 participant