14def get_gpt_prompt(diff):
15 """Get the prompt for GPT."""
16
17 query = "# Write a commit message for the following diff. Use conventional commit style. Add bullet points in the body.\n"18 query += "# Start diff\n"
19 query += diff
20 query += "\n# End diff\n"
1# First, get a diff from the repo. For now, just use the
2# current working directory.
3# Then check whether the interactive option is set.
4# If yes, get all files that have been changed and prompt the user with a multiselection, 5# Afterwards, create a new diff with only the selected files.
6
7from pathlib import Path
33 ),
34 body: bool = typer.Option(True, help="Whether to add a commit body"),
35 choices: int = typer.Option(1, help="The number of choices to return"),
36 commit_type: str = typer.Option(None, help="The commit type. If empty, it will be inferred"), 37 dry_run: bool = typer.Option(False, help="Whether to print the query and exit", is_flag=True),
38 pick_files: bool = typer.Option(False, help="Whether to pick the files interactively", is_flag=True),
39):
35 choices: int = typer.Option(1, help="The number of choices to return"),
36 commit_type: str = typer.Option(None, help="The commit type. If empty, it will be inferred"),
37 dry_run: bool = typer.Option(False, help="Whether to print the query and exit", is_flag=True),
38 pick_files: bool = typer.Option(False, help="Whether to pick the files interactively", is_flag=True), 39):
40 """Generate commit messages from GPT-2 with openai.com"""
41 openai.api_key = os.getenv("OPENAI_API_KEY")
34 body: bool = typer.Option(True, help="Whether to add a commit body"),
35 choices: int = typer.Option(1, help="The number of choices to return"),
36 commit_type: str = typer.Option(None, help="The commit type. If empty, it will be inferred"),
37 dry_run: bool = typer.Option(False, help="Whether to print the query and exit", is_flag=True), 38 pick_files: bool = typer.Option(False, help="Whether to pick the files interactively", is_flag=True),
39):
40 """Generate commit messages from GPT-2 with openai.com"""
Line length greater than configured max_line_length
detected, defaults to 79 character. This limit can be configured docs