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]
Inspector: Add checkbox to hide demos
Kilian Lieretaa74614408e5
diff --git a/sweagent/inspector/fileViewer.js b/sweagent/inspector/fileViewer.jsindex 987ae301..07f09cc8 100644--- a/sweagent/inspector/fileViewer.js+++ b/sweagent/inspector/fileViewer.js@@ -49,11 +49,14 @@ function getRoleText(role) {}function viewFile(fileName) {+ currentFileName = fileName; // Store the current file name// Clear any pending message loading from previous filestimeoutIds.forEach((timeoutId) => clearTimeout(timeoutId));timeoutIds = []; // Reset the list of timeout IDsconst baseUrl = getBaseUrl();+ const showDemos = document.getElementById("showDemos").checked;+fetch(`${baseUrl}/trajectory/${fileName}`).then((response) => {if (!response.ok) {@@ -78,6 +81,7 @@ function viewFile(fileName) {if (item.tool_calls && item.tool_calls.length > 0) {contentText = `${item.thought}\n\`\`\`\n${item.action}\n\`\`\``;}+ // Skip demo items if checkbox is uncheckedlet roleClass =item.agent && item.agent !== "primary"? "subroutine"@@ -88,10 +92,16 @@ function viewFile(fileName) {const historyItem = document.createElement("div");historyItem.className = `history-item ${roleClass} fade-in`;historyItem.id = elementId;+ let isDemo = false;if (contentText.includes("--- DEMONSTRATION ---")) {item.role = "demo";+ isDemo = true;} else if ("is_demo" in item && item.is_demo === true) {item.role += "[demo]";+ isDemo = true;+ }+ if (!showDemos && isDemo) {+ return;}historyItem.innerHTML = `<div class="role-bar ${roleClass}">diff --git a/sweagent/inspector/index.html b/sweagent/inspector/index.htmlindex a5613bff..04c1b7b1 100644--- a/sweagent/inspector/index.html+++ b/sweagent/inspector/index.html@@ -8,6 +8,9 @@<div class="container"><h1>Trajectory File Viewer</h1><ul id="fileList"></ul>+ <label style="margin-right: 20px;">+ <input type="checkbox" id="showDemos" onchange="refreshCurrentFile()"> Show demonstrations+ </label><h2>Conversation History</h2><pre id="fileContent">No file selected.</pre><div class="button-container">