WIP: Refactor Coder class constructor to accept a main_model argument instead of a boolean flag, and update CLI help messages accordingly.

This commit is contained in:
Paul Gauthier 2023-05-08 23:12:33 -07:00
parent e5e5a8e325
commit 2f06ce08a3

View file

@ -40,11 +40,8 @@ class Coder:
last_modified = 0 last_modified = 0
repo = None repo = None
def __init__(self, use_gpt_4, files, pretty): def __init__(self, main_model, files, pretty):
if use_gpt_4: self.main_model = main_model
self.main_model = "gpt-4"
else:
self.main_model = "gpt-3.5-turbo"
if pretty: if pretty:
self.console = Console() self.console = Console()
@ -578,28 +575,27 @@ def main():
parser.add_argument( parser.add_argument(
"--model", "--model",
metavar="MODEL", metavar="MODEL",
default="gpt-3.5-turbo", default="gpt-4",
help="Specify the model to use (default: gpt-3.5-turbo)", help="Specify the model to use for the main chat (default: gpt-4)",
) )
parser.add_argument( parser.add_argument(
"-3", "-3",
action="store_const", action="store_const",
dest="model", dest="model",
const="gpt-3.5-turbo", const="gpt-3.5-turbo",
help="Use gpt-3.5-turbo model", help="Use gpt-3.5-turbo model for the main chat",
) )
parser.add_argument( parser.add_argument(
"-4", "-4",
action="store_const", action="store_const",
dest="model", dest="model",
const="gpt-4", const="gpt-4",
help="Use gpt-4 model", help="Use gpt-4 model for the main chat",
) )
parser.add_argument( parser.add_argument(
"--no-pretty", "--no-pretty",
action="store_false", action="store_false",
dest="pretty", dest="pretty",
default=True,
help="Disable prettyd output of GPT responses", help="Disable prettyd output of GPT responses",
default=not bool(int(os.environ.get(env_prefix + "PRETTY", 1))) default=not bool(int(os.environ.get(env_prefix + "PRETTY", 1)))
) )
@ -616,12 +612,11 @@ def main():
) )
args = parser.parse_args() args = parser.parse_args()
use_gpt_4 = not args.gpt_3_5_turbo
fnames = args.files fnames = args.files
pretty = args.pretty pretty = args.pretty
coder = Coder(use_gpt_4, fnames, pretty) coder = Coder(args.model, fnames, pretty)
coder.commit(ask=not args.commit, prefix="WIP: ") coder.commit(ask=not args.commit_dirty, prefix="WIP: ")
if args.apply: if args.apply:
with open(args.apply, "r") as f: with open(args.apply, "r") as f: