gpt-engineer-org / gpt-engineer

Platform to experiment with the AI Software Engineer. Terminal based. NOTE: Very different from https://gptengineer.app
MIT License
52.32k stars 6.81k forks source link

Files are generated inside all_output.txt only #31

Closed d4rkc0de closed 1 year ago

d4rkc0de commented 1 year ago

I'm using gpt-3.5-turbo because gpt-4 doesn't work

I asked for an angular project with a table that is generated from an API, however it generated all output in afile called all_output.txt, and file called HTML and a file called typescript,

What is expected to generate all files separately (app.component.ts, api.service.ts, table.component.ts app.component.html ...) with their corresponding content instead of generating it in the all_output.txt

all_output.txt

iplayfast commented 1 year ago

I had the same experience. Needed to use gtp-3.5-turbo, and ran the example. Used snake description genterated by chat.openai.com, and it talked about file1 board.py with code, and so on, but the only files in the workspace was one called python (no extension) that appears to contain the code for the controller class.

WizKid1968 commented 1 year ago

Same issue. The application ends after "Now let's proceed with the file contents.".

patillacode commented 1 year ago

Behaviour is different between gpt-3.5-turbo and gpt-3.5-turbo-16k

The former doesn't work very well (no files are created, except the all_output.txt and the latter indeed just keeps ending like you mention on #32 @WizKid1968

WizKid1968 commented 1 year ago

Behaviour is different between gpt-3.5-turbo and gpt-3.5-turbo-16k

The former doesn't work very well (no files are created, except the all_output.txt and the latter indeed just keeps ending like you mention on #32 @WizKid1968

You're absolutely right, I'm using gpt-3.5-turbo-16k.

jebarpg commented 1 year ago

Heres my solution: create a python file for instance 'create_files.py' then add the following code:

import re
import os

save_dir = "results/"
f = open("example/workspace/all_output.txt", "r")
s = f.read()
#pattern = re.compile(r'^\*\*(.*?\.py)\*\*\s+```python\s+.*?(^(?:.*\n)*?)^```\s*', re.MULTILINE) #Example **game.py**
#pattern = re.compile(r'^(.*?\.py):\s+```python\s+.*?(^(?:.*\n)*?)^```\s*', re.MULTILINE) #Example game.py:
pattern = re.compile(r'^.*?\((.*?\.py)\):\s+```python\s+.*?(^(?:.*\n)*?)^```\s*', re.MULTILINE) #Example Game File (game.py):
os.makedirs(save_dir, exist_ok=True)
for (file_name, file_text) in re.findall(pattern, s):
    write_file = open(save_dir + file_name, "w")
    write_file.write(file_text)
    write_file.close()
    print(file_name, "\n")

but sometimes you have to change the regex because the output isn't always the same. so if you see **game.py** use: #pattern = re.compile(r'^\*\*(.*?\.py)\*\*\s+```python\s+.*?(^(?:.*\n)*?)^```\s*', re.MULTILINE) #Example **game.py** if you see game.py\: then use this: pattern = re.compile(r'^(.*?\.py):\s+```python\s+.*?(^(?:.*\n)*?)^```\s', re.MULTILINE) if you see 'Game file (game.py)' use: pattern = re.compile(r'^.*?\((.*?\.py)\):\s+```python\s+.*?(^(?:.*\n)*?)^```\s*', re.MULTILINE) #Example Game File (game.py):

DrMemoryFish commented 1 year ago

where do we put this?

jebarpg commented 1 year ago

where do we put this?

I created a file called 'create_files.py' in the main repo directory. then ran python create_files.py

iplayfast commented 1 year ago

Can that solution be made more generic, so c++, py etc all work. I think the line above the marker actually gives the proper filename (using 3.5-turbo)

jebarpg commented 1 year ago

@iplayfast Here yea go https://github.com/AntonOsika/gpt-engineer/issues/35#issuecomment-1594148378

jebarpg commented 1 year ago

@DrMemoryFish check this comment out https://github.com/AntonOsika/gpt-engineer/issues/35#issuecomment-1594148378

RemkoDelsman commented 1 year ago

Hi, did you also change the (hardcoded) GPT-4 reference in file https://github.com/AntonOsika/gpt-engineer/blob/12cb93fc7a6ea3d1865b6dd8a2f892c4105bebaf/scripts/rerun_edited_message_logs.py? I'm using the gpt-3.5-turbo-16k and files are (now) created for me.

jebarpg commented 1 year ago

I did on my copy, but they are already working on having the project default to gpt-3.5-turbo if gpt-4 is not available. This did create the files for me too.

jebarpg commented 1 year ago

@RemkoDelsman https://github.com/AntonOsika/gpt-engineer/pull/40#issuecomment-1594579187

jebarpg commented 1 year ago

O geez sorry to spam you @RemkoDelsman I didn't realize you are the one in that comment lol... Just woke up so catching up with all the new issues and comments etc.

JohnGomes commented 1 year ago

Adjusting the identities was a small (2 line) change that seems to work for me - see here

patillacode commented 1 year ago

A lot of progress has been done on this since the last comment here, make sure to pull the latest version.

If you wish to reopen the issue please do following the new issue template.

d4rkc0de commented 1 year ago

I closed the issue because the problem don't exist in the latest version.