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 feat: Model selection
Kilian Lieretfd97e759c02b
diff --git a/sweagent/api/server.py b/sweagent/api/server.pyindex 3108cd3f..cb099da3 100644--- a/sweagent/api/server.py+++ b/sweagent/api/server.py@@ -90,8 +90,8 @@ def run():return _build_cors_preflight_response()data_path = request.args["data_path"]repo_path = request.args["repo_path"]+ model_name = request.args["model"]test_run = request.args["test_run"].lower() == "true"- model_name = "gpt4"if test_run:os.environ["SWE_AGENT_EXPERIMENTAL_COMMUNICATE"] = "1"model_name = "instant_empty_submit"diff --git a/sweagent/frontend/src/Run.js b/sweagent/frontend/src/Run.jsindex f45050cd..9d1ca7de 100644--- a/sweagent/frontend/src/Run.js+++ b/sweagent/frontend/src/Run.js@@ -17,6 +17,7 @@ function Run() {const [dataPath, setDataPath] = useState('https://github.com/klieret/swe-agent-test-repo/issues/1');const [repoPath, setRepoPath] = useState("");+ const [model, setModel] = useState("gpt4");const [testRun, setTestRun] = useState(true);const [agentFeed, setAgentFeed] = useState([]);const [envFeed, setEnvFeed] = useState([]);@@ -92,7 +93,7 @@ function Run() {setLogs('');setHighlightedStep(null);try {- await axios.get(`/run`, { params: { data_path: dataPath, test_run: testRun, repo_path: repoPath } });+ await axios.get(`/run`, { params: { data_path: dataPath, test_run: testRun, repo_path: repoPath, model: model } });} catch (error) {console.error('Error:', error);}@@ -180,7 +181,7 @@ function Run() {<div className="container-demo">{renderErrorMessage()}- <LRunControl isComputing={isComputing} isConnected={isConnected} handleStop={handleStop} handleSubmit={handleSubmit} setDataPath={setDataPath} setTestRun={setTestRun} dataPath={dataPath} testRun={testRun} repoPath={repoPath} setRepoPath={setRepoPath} />+ <LRunControl isComputing={isComputing} isConnected={isConnected} handleStop={handleStop} handleSubmit={handleSubmit} setDataPath={setDataPath} setTestRun={setTestRun} setRepoPath={setRepoPath} testRun={testRun} setModel={setModel} /><div id="demo"><hr /><div className="panels">diff --git a/sweagent/frontend/src/components/controls/LRunControl.js b/sweagent/frontend/src/components/controls/LRunControl.jsindex 7f981e48..ec04e6e5 100644--- a/sweagent/frontend/src/components/controls/LRunControl.js+++ b/sweagent/frontend/src/components/controls/LRunControl.js@@ -6,27 +6,28 @@ import { PlayFill, StopFill} from 'react-bootstrap-icons';import logo from '../../assets/logo.png'import { Link } from 'react-router-dom';-function LRunControl({isComputing, isConnected, handleStop, handleSubmit, setDataPath, setTestRun, dataPath, testRun, repoPath, setRepoPath}) {+function LRunControl({isComputing, isConnected, handleStop, handleSubmit, setDataPath, setTestRun, testRun, setRepoPath, setModel}) {const [psType, setPsType] = useState('gh');const [key, setKey] = useState('problem');+ const defaultPS = "https://github.com/klieret/swe-agent-test-repo/issues/1" ;+const handlePsTypeChange = (event) => {const selectedType = event.target.value;setPsType(selectedType);};function getPsInput() {- if (psType == 'gh') {+ if (psType === 'gh') {return (<inputtype="text"className="form-control"- // value={inputValue}- onChange={(e) => setDataPath(e.target.value || "https://github.com/klieret/swe-agent-test-repo/issues/1")}- placeholder="https://github.com/klieret/swe-agent-test-repo/issues/1" />+ onChange={(e) => setDataPath(e.target.value || defaultPS)}+ placeholder={defaultPS}/>);}- if (psType == 'write') {+ if (psType === 'write') {return (<textareaclassName="form-control"@@ -45,10 +46,10 @@ function LRunControl({isComputing, isConnected, handleStop, handleSubmit, setDatonSelect={(k) => setKey(k)}className="mb-3 bordered-tab-contents">- <Tab eventKey="problem" title="Problem Statement">+ <Tab eventKey="problem" title="Problem Source"><div className="p-3"><div className="input-group mb-3">- <span className="input-group-text">Problem statement</span>+ <span className="input-group-text">Problem source</span><select className="form-select" aria-label="Select problem statement type" onChange={handlePsTypeChange}><option value="gh">GitHub issue URL</option><option value="write">Write here</option>@@ -61,7 +62,15 @@ function LRunControl({isComputing, isConnected, handleStop, handleSubmit, setDat</div></Tab><Tab eventKey="model" title="Model">- <div>Model settings coming soon.</div>+ <div className="p-3">+ <div className="input-group mb-3">+ <span className="input-group-text">Model name</span>+ <input type="text" className="form-control" placeholder="gpt4" onChange={(e) => setModel(e.target.value || "gpt4")} />+ </div>+ <div class="alert alert-info" role="alert">+ Please make sure that you have your API keys set in keys.cfg+ </div>+ </div></Tab><Tab eventKey="settings" title="Extra Settings"><div className="p-3">@@ -75,9 +84,9 @@ function LRunControl({isComputing, isConnected, handleStop, handleSubmit, setDat</div></Tab></Tabs>- <div className="runControl">+ <div className="runControl p-3"><div>- <img src={logo} style={{height: 50, marginRight: 20}}/>+ <img src={logo} style={{height: 50, marginRight: 20}} alt="swe agent logo"/><div class="btn-group" role="group" aria-label="Basic example"><button type="submit" className="btn btn-primary" onClick={handleSubmit} disabled={isComputing || !isConnected}><PlayFill/> Run</button><button onClick={handleStop} disabled={!isComputing} className="btn btn-primary"><StopFill/> Stop</button>