gpt-engineer-org / gpt-engineer

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

Bug: Parentheses around filenames #1088

Closed esbjornlg closed 5 months ago

esbjornlg commented 5 months ago

Expected Behavior

Filenames should have the correct names that the LLM produced.

Current Behavior

Filenames have parantheses around the names. Also, even though the LLM outputs that the file should be in a specific folder, all files are put in the root of the working directory.

Failure Information

OS: WSL with Ubuntu 22.04.1 on Windows 10 22H2 GPTEngineer python package 0.2.8 LLM: Locally hosted codellama:13b-instruct-q4_0 on Ollama.

Prompt: Multiplayer snake in the browser. Use a python backend with MVC components. The view needs to stream the state to all connected players. Please implement also the html and js necessary to run the game with only the code you generate.

Failure Logs

These files were created during this run: (controllers.py) (index.html) (main.js) (requirements.txt) (views.py) run.sh

Output

This is a multiplayer snake game that can be played in the browser. The game uses a Python backend with an MVC (Model-View-Controller) architecture. The view streams the state of the game to all connected players, and the user can control their snake using the arrow keys.

Here's a high-level overview of the architecture:

Here's a more detailed breakdown of each module:

model The model module contains the logic for the game, including the rules for how the snakes move and interact with each other. It defines the data structures used to represent the state of the game, such as the position and direction of each snake.

# model/snake.py
class Snake:
    def __init__(self, x, y):
        self.x = x
        self.y = y
        self.direction = "up"
        self.length = 1

    def move(self):
        if self.direction == "up":
            self.y -= 1
        elif self.direction == "down":
            self.y += 1
        elif self.direction == "left":
            self.x -= 1
        else:
            self.x += 1

view The view module is responsible for rendering the game state to the screen. It uses HTML and JavaScript to create a user interface that allows players to control their snake.

<!-- view/index.html -->
<!DOCTYPE html>
<html>
  <head>
    <title>Snake Game</title>
  </head>
  <body>
    <canvas id="game-canvas" width="640" height="480"></canvas>
    <script src="view.js"></script>
  </body>
</html>
// view/view.js
const canvas = document.getElementById("game-canvas");
const ctx = canvas.getContext("2d");

function drawSnake(snake) {
    const x = snake.x * 10;
    const y = snake.y * 10;
    ctx.fillStyle = "green";
    ctx.fillRect(x, y, 10, 10);
}

function drawFood(food) {
    const x = food.x * 10;
    const y = food.y * 10;
    ctx.fillStyle = "red";
    ctx.fillRect(x, y, 10, 10);
}

function drawGameState(gameState) {
    ctx.clearRect(0, 0, canvas.width, canvas.height);
    gameState.snakes.forEach(drawSnake);
    gameState.food.forEach(drawFood);
}

+more that I have cut off

ErikBjare commented 5 months ago

This is a problem with the model used and/or the parameters used, not with gpt-engineer itself.

viborc commented 5 months ago

@esbjornlg I'll proceed with closing this issue since it doesn't seem to be related to gpt-engineer. If you encounter the same issue while using GPT 4 as a model, for example, feel free to open a new one.

Thanks for reporting this!