mirror of
https://github.com/aljazceru/gpt-engineer.git
synced 2025-12-18 13:15:00 +01:00
Fix not generating bash commands
This commit is contained in:
@@ -26,6 +26,9 @@ class AI:
|
|||||||
|
|
||||||
def fuser(self, msg):
|
def fuser(self, msg):
|
||||||
return {"role": "user", "content": msg}
|
return {"role": "user", "content": msg}
|
||||||
|
def fassistant(self, msg):
|
||||||
|
return {"role": "assistant", "content": msg}
|
||||||
|
|
||||||
|
|
||||||
def next(self, messages: list[dict[str, str]], prompt=None):
|
def next(self, messages: list[dict[str, str]], prompt=None):
|
||||||
if prompt:
|
if prompt:
|
||||||
|
|||||||
@@ -166,9 +166,23 @@ def gen_entrypoint(ai, dbs):
|
|||||||
user="Information about the codebase:\n\n" + dbs.workspace["all_output.txt"],
|
user="Information about the codebase:\n\n" + dbs.workspace["all_output.txt"],
|
||||||
)
|
)
|
||||||
print()
|
print()
|
||||||
[[lang, command]] = parse_chat(messages[-1]["content"])
|
|
||||||
assert lang in ["", "bash", "sh"]
|
blocks = parse_chat(messages[-1]["content"])
|
||||||
dbs.workspace["run.sh"] = command
|
for lang, _ in blocks:
|
||||||
|
assert lang in ["", "bash", "sh"], "Generated entrypoint command that was not bash"
|
||||||
|
|
||||||
|
dbs.workspace["run.sh"] = "\n".join(block for lang, block in blocks)
|
||||||
|
return messages
|
||||||
|
|
||||||
|
def use_feedback(ai: AI, dbs: DBs):
|
||||||
|
messages = [
|
||||||
|
ai.fsystem(setup_sys_prompt(dbs)),
|
||||||
|
ai.fuser(f"Instructions: {dbs.input['main_prompt']}"),
|
||||||
|
ai.fassistant(dbs.workspace["all_output.txt"]),
|
||||||
|
ai.fsystem(dbs.identity["use_feedback"]),
|
||||||
|
]
|
||||||
|
messages = ai.next(messages, dbs.memory['feedback'])
|
||||||
|
to_files(messages[-1]["content"], dbs.workspace)
|
||||||
return messages
|
return messages
|
||||||
|
|
||||||
|
|
||||||
@@ -180,6 +194,7 @@ STEPS = {
|
|||||||
"clarify": [clarify, gen_clarified_code, execute_workspace],
|
"clarify": [clarify, gen_clarified_code, execute_workspace],
|
||||||
"respec": [gen_spec, respec, gen_unit_tests, gen_code, execute_workspace],
|
"respec": [gen_spec, respec, gen_unit_tests, gen_code, execute_workspace],
|
||||||
"execute_only": [execute_entrypoint],
|
"execute_only": [execute_entrypoint],
|
||||||
|
"use_feedback": [use_feedback],
|
||||||
}
|
}
|
||||||
|
|
||||||
# Future steps that can be added:
|
# Future steps that can be added:
|
||||||
|
|||||||
0
identity/use_feedback
Normal file
0
identity/use_feedback
Normal file
Reference in New Issue
Block a user