SWE-agent takes a GitHub issue and tries to automatically fix it, using your LM of choice. It can also be employed for offensive cybersecurity or competitive coding challenges. [NeurIPS 2024]
Web: Remove files from flask prototype
Kilian Lieret72781287574c
diff --git a/sweagent/api/static/scripts/mainscript.js b/sweagent/api/static/scripts/mainscript.jsdeleted file mode 100644index 9a3dab2d..00000000--- a/sweagent/api/static/scripts/mainscript.js+++ /dev/null@@ -1,64 +0,0 @@-function addMessageToFeed(feedID, title, text, format, step) {- console.log("in addMessageToFeed");-- let classes = "message"- if (step !== null) {- classes += " step" + step;- title += " (step " + step + ")";-- }- const $feed = $(feedID);- const $messageBlock = $('<div>', { class: classes});-- if (title) {- $('<h4>', { text: title}).appendTo($messageBlock);- }-- let $messageText;- if (format === "text") {- $messageText = $('<p>', { text: text });- } else if (format === "markdown") {- $messageText = $('<md-block>', { text: text }); // Note: Custom elements need to be handled properly in jQuery- } else {- console.error("Unknown format: " + format);- return;- }-- $messageBlock.append($messageText).appendTo($feed);- $feed.scrollTop($feed.prop("scrollHeight")); // jQuery method to scroll to the bottom-}--function highlightStep(step) {- // Highlight all actions, thoughts, etc. of one specific step- $('.message').removeClass('highlight');- $(`.message.step${step}`).addClass('highlight');-}--function removeAllMessagesFromFeed(feedID) {- const $feed = $(feedID);- $feed.find('.message').remove();-}---document.addEventListener('DOMContentLoaded', function() {- const socket = io();- socket.on('update', function(data) {- feed = '#' + data["feed"] + "Feed";- addMessageToFeed(feed, data["title"], data["message"], data["format"], data["thought_idx"]);- });-});---function findFirstMessageForStep(feedName, step) {- // Find the first element with class 'message' and 'stepX' within the specified feed- const selector = `#${feedName} .message.step${step}`;- return $(selector).first();-}---function scrollToFirstMessageForStep(feedName, step) {- const $message = findFirstMessageForStep(feedName, step);- const $container = $(`#${feedName}`);- const scrollTo = $message.offset().top - $container.offset().top + $container.scrollTop();- $container.animate({ scrollTop: scrollTo }, 'slow');-}\ No newline at end of filediff --git a/sweagent/api/static/styles/mainpage.css b/sweagent/api/static/styles/mainpage.cssdeleted file mode 100644index d623683b..00000000--- a/sweagent/api/static/styles/mainpage.css+++ /dev/null@@ -1,28 +0,0 @@-.message {- border: 1px solid #ccc;- padding: 10px;- margin-bottom: 10px;- border-radius: 5px;-}---#container {- display: flex; /* Enables flexbox layout */- justify-content: space-between; /* Spaces children evenly */- padding: 10px;-}--#agentFeed, #envFeed {- flex: 1; /* Each container takes up half the parent width */- margin: 10px;- max-width: 50%; /* Optionally limit the feed width */- overflow-y: auto; /* Adds scroll bar if feed gets too long */- height: 500px; /* Fixed height for feed */- border: 1px solid #ccc;- padding: 10px;- border-radius: 5px;-}--.highlight {- background-color: #eac2c2;-}\ No newline at end of filediff --git a/sweagent/api/templates/index.html b/sweagent/api/templates/index.htmldeleted file mode 100644index 732e6196..00000000--- a/sweagent/api/templates/index.html+++ /dev/null@@ -1,67 +0,0 @@-<!DOCTYPE html>-<html>-<head>- <title>Run Command</title>- <link rel="stylesheet" type="text/css" href="{{ url_for('static',filename='styles/mainpage.css') }}">- <script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.0.0/socket.io.js"></script>- <script src="{{ url_for('static',filename='scripts/mainscript.js') }}"></script>- <script type="module" src="https://md-block.verou.me/md-block.js"></script>- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>- <script>- $(document).ready(function() {- $('#dataForm').on('submit', function(event) {- event.preventDefault();- removeAllMessagesFromFeed("#agentFeed");- removeAllMessagesFromFeed("#envFeed");- const dataPath = $('#data_path').val();- const testRun = $('#test_run').is(':checked');- $.get(`/run`, { data_path: dataPath, test_run: testRun }, function(response) {- $('#responseMessage').text(response);- }).fail(function(error) {- console.error('Error:', error);- });- });-- // Hovering over a message in the feed highlights the corresponding step- // and scrolls to the right place- $(document).on('mouseenter', '[class*=step]', function() {- // Extract the step number from the class name- const stepNumber = $(this).attr('class').match(/step(\d+)/)[1];- if (stepNumber) {- highlightStep(stepNumber);-- if ($(this).closest('.envFeed').length > 0) {- console.log("In agent feed");- scrollToFirstMessageForStep("agentFeed", stepNumber);- }- else {- console.log("In env feed");- scrollToFirstMessageForStep("envFeed", stepNumber);- }- }- });- });- </script>-</head>-<body>- <h1>Start run</h1>- <form id="dataForm">- <label for="data_path">Data Path:</label>- <input type="text" id="data_path" name="data_path" value="https://github.com/klieret/swe-agent-test-repo/issues/1" required>- <label for="test_run">Test run (no LM queries)</label>- <input type="checkbox" id="test_run" name="test_run" checked>- <button type="submit">Run</button>- </form>- <div id="responseMessage"></div>- <div id="update"></div>- <h2>Trajectory</h2>- <div id="container">- <div id="agentFeed" class="agentFeed">- <h3>Agent Feed</h3>- </div>- <div id="envFeed" class="envFeed">- <h3>Environment Feed</h3>- </div>- </div>-</body>-</html>