Skip to content

Commit

Permalink
adding functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
Ted Fulk committed Oct 31, 2023
1 parent 81d7f30 commit 5992370
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
4 changes: 2 additions & 2 deletions py_do_you_even_diff_bro/commandments.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import Dict

from models import BroMode
from utils import StrEnum
from py_do_you_even_diff_bro.models import BroMode
from py_do_you_even_diff_bro.utils import StrEnum

SUMMARY_BRO_PROMPT = "Summarize the git diff below in a concise, 1-2 sentence description of the changes made. It will be used as the git commit message. Focus on high-level changes not code level details."

Expand Down
19 changes: 12 additions & 7 deletions py_do_you_even_diff_bro/main.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
from typing import List, Optional

import typer
from rich.console import Console
from rich.table import Table
from typing_extensions import Annotated

from py_do_you_even_diff_bro.commandments import SUMMARY_BRO_PROMPT, get_diff_prompt
from py_do_you_even_diff_bro.constants import (
PROGRAMMING_FILE_EXTENSIONS,
DETAILED_BROGRAMMER_DESCRIPTION,
PROGRAMMING_FILE_EXTENSIONS,
)
from py_do_you_even_diff_bro.git import get_git_diff
from py_do_you_even_diff_bro.llm import prompt
from py_do_you_even_diff_bro.models import BroMode
from py_do_you_even_diff_bro.git import get_git_diff
from py_do_you_even_diff_bro.commandments import get_diff_prompt, SUMMARY_BRO_PROMPT

app = typer.Typer(help=DETAILED_BROGRAMMER_DESCRIPTION)
console = Console()
Expand All @@ -36,8 +39,10 @@ def determine_bro_mode(chill: bool, mid: bool, chad: bool, model: str) -> BroMod
user_input = input(
"Chad mode is engaged. It is suggested to use 'gpt-4' model for optimal results. Do you want to switch to 'gpt-4'? (y/n): "
)
if user_input.lower() in ["yes", "y"]:
model = "gpt-4"
if user_input.lower() not in ["yes", "y"]:
model = input(
"Enter the model you want to use (e.g., 'gpt-3.5-turbo'): "
)
return bro_mode, model


Expand All @@ -59,7 +64,7 @@ def run_diff(
summarize: bool,
):
print(
f"Building prompt for diffbro in bromode: '{bro_mode}' mode on GPT model '{model}'"
f"Building prompt for diffbro in bromode: '{bro_mode.name.lower()}' mode on GPT model '{model}'"
f"{f' with custom prompt: {custom_prompt}' if custom_prompt else ''}"
f"{f' Will generate diff summary.' if summarize else ''}"
)
Expand Down Expand Up @@ -94,7 +99,7 @@ def main(
chad: bool = typer.Option(
False, help="Get a chad, sr-level engineer, intense diffbro PR review"
),
model: str = typer.Option("gpt-4", help="GPT model use 'gpt-3.5-turbo' or 'gpt-4'"),
model: Annotated[Optional[str], typer.Argument()] = "gpt-4",
only: List[str] = typer.Option(
PROGRAMMING_FILE_EXTENSIONS, help="Only include files with these extensions"
),
Expand Down
1 change: 1 addition & 0 deletions py_do_you_even_diff_bro/models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from pydantic import BaseModel

from py_do_you_even_diff_bro.utils import StrEnum


Expand Down

0 comments on commit 5992370

Please sign in to comment.