Skip to content

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: Factor out run control

Kilian Lieret93c8028e72d1
diff --git a/sweagent/frontend/src/Run.js b/sweagent/frontend/src/Run.js
index f48495a9..9a92519e 100644
--- a/sweagent/frontend/src/Run.js
+++ b/sweagent/frontend/src/Run.js
@@ -5,6 +5,7 @@ import './static/run.css';
import AgentFeed from './components/panels/AgentFeed';
import EnvFeed from './components/panels/EnvFeed';
import LogPanel from './components/panels/LogPanel';
+import LRunControl from './components/controls/LRunControl';
const url = ''; // Will get this from .env
// Connect to Socket.io
@@ -157,14 +158,7 @@ function Run() {
<div className="container-demo">
<hr />
{renderErrorMessage()}
- <form onSubmit={handleSubmit}>
- <label htmlFor="data_path">Data Path:</label>
- <input type="text" value={dataPath} onChange={(e) => setDataPath(e.target.value)} required />
- <label htmlFor="test_run">Test run (no LM queries)</label>
- <input type="checkbox" checked={testRun} onChange={(e) => setTestRun(e.target.checked)} />
- <button type="submit" disabled={isComputing || !isConnected}>Run</button>
- </form>
- <button onClick={handleStop} disabled={!isComputing}>Stop Computation</button>
+ <LRunControl isComputing={isComputing} isConnected={isConnected} handleStop={handleStop} handleSubmit={handleSubmit} setDataPath={setDataPath} setTestRun={setTestRun} dataPath={dataPath} testRun={testRun} />
<div id="demo">
<hr />
<div className="panels">
diff --git a/sweagent/frontend/src/components/controls/LRunControl.js b/sweagent/frontend/src/components/controls/LRunControl.js
new file mode 100644
index 00000000..8225f34b
--- /dev/null
+++ b/sweagent/frontend/src/components/controls/LRunControl.js
@@ -0,0 +1,18 @@
+import React, { useState } from 'react';
+
+function LRunControl({isComputing, isConnected, handleStop, handleSubmit, setDataPath, setTestRun, dataPath, testRun}) {
+ return (
+ <div>
+ <form onSubmit={handleSubmit}>
+ <label htmlFor="data_path">Data Path:</label>
+ <input type="text" value={dataPath} onChange={(e) => setDataPath(e.target.value)} required />
+ <label htmlFor="test_run">Test run (no LM queries)</label>
+ <input type="checkbox" checked={testRun} onChange={(e) => setTestRun(e.target.checked)} />
+ <button type="submit" disabled={isComputing || !isConnected}>Run</button>
+ </form>
+ <button onClick={handleStop} disabled={!isComputing}>Stop Computation</button>
+ </div>
+ );
+}
+
+export default LRunControl;
\ No newline at end of file
diff --git a/sweagent/frontend/src/controls/LRunControl.js b/sweagent/frontend/src/controls/LRunControl.js
deleted file mode 100644
index e69de29b..00000000