mirror of
https://github.com/aljazceru/gpt-engineer.git
synced 2025-12-17 20:55:09 +01:00
Simplify and clarify
This commit is contained in:
20
steps.py
20
steps.py
@@ -11,12 +11,14 @@ from db import DB
|
||||
def setup_sys_prompt(dbs):
|
||||
return dbs.identity['setup'] + '\nUseful to know:\n' + dbs.identity['philosophy']
|
||||
|
||||
def setup(ai: AI, dbs: DBs):
|
||||
def run(ai: AI, dbs: DBs):
|
||||
'''Run the AI on the main prompt and save the results'''
|
||||
messages = ai.start(setup_sys_prompt(dbs), dbs.input['main_prompt'])
|
||||
to_files(messages[-1]['content'], dbs.workspace)
|
||||
return messages
|
||||
|
||||
def clarify(ai: AI, dbs: DBs):
|
||||
'''Ask the user if they want to clarify anything and save the results to the workspace'''
|
||||
messages = [ai.fsystem(dbs.identity['qa'])]
|
||||
user = dbs.input['main_prompt']
|
||||
while True:
|
||||
@@ -26,12 +28,13 @@ def clarify(ai: AI, dbs: DBs):
|
||||
break
|
||||
|
||||
print()
|
||||
user = input('Answer: ')
|
||||
user = input('(answer in text, or "q" to move on)\n')
|
||||
if not user or user == 'q':
|
||||
break
|
||||
|
||||
user += '\n\nIs anything else unclear? If everything is sufficiently clear to write the code, just answer "no".'
|
||||
user += '\n\nIs anything else unclear? If yes, only answer in the form: {remaining unclear areas} remaining questions. {Next question}\nIf everything is sufficiently clear, only answer "no".'
|
||||
|
||||
print()
|
||||
return messages
|
||||
|
||||
def run_clarified(ai: AI, dbs: DBs):
|
||||
@@ -49,12 +52,13 @@ def run_clarified(ai: AI, dbs: DBs):
|
||||
return messages
|
||||
|
||||
|
||||
# STEPS: List[Callable[[AI, DBs], List]] = [
|
||||
STEPS=[
|
||||
# setup,
|
||||
clarify,
|
||||
run_clarified
|
||||
# improve_files,
|
||||
# run_tests,
|
||||
# ImproveBasedOnHumanComments
|
||||
]
|
||||
|
||||
# Future steps that can be added:
|
||||
# improve_files,
|
||||
# add_tests
|
||||
# run_tests_and_fix_files,
|
||||
# improve_based_on_in_file_feedback_comments
|
||||
|
||||
Reference in New Issue
Block a user