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 feat: Set custom install command

Kilian Lieretd3665541b286
diff --git a/sweagent/api/server.py b/sweagent/api/server.py
index 0904ad00..9b2e0c73 100644
--- a/sweagent/api/server.py
+++ b/sweagent/api/server.py
@@ -128,6 +128,8 @@ def run():
environment = json.loads(request.args["environment"])
environment_setup = ""
if environment["config_type"] == "manual":
+ if not environment["install_command_active"]:
+ environment["install"] = ""
environment_setup = str(write_env_yaml(environment))
elif environment["config_type"] == "script_path":
environment_setup = environment["script_path"]
diff --git a/sweagent/frontend/src/Run.js b/sweagent/frontend/src/Run.js
index 122505a4..33a3988f 100644
--- a/sweagent/frontend/src/Run.js
+++ b/sweagent/frontend/src/Run.js
@@ -20,7 +20,12 @@ function Run() {
);
const [repoPath, setRepoPath] = useState("");
const [model, setModel] = useState("gpt4");
- const envConfigDefault = { python: "3.10" };
+ const envConfigDefault = {
+ python: "3.10",
+ config_type: "manual",
+ install: "pip install --editable .",
+ install_command_active: true,
+ };
const [envConfig, setEnvConfig] = useState(envConfigDefault);
const [testRun, setTestRun] = useState(false);
const [agentFeed, setAgentFeed] = useState([]);
diff --git a/sweagent/frontend/src/components/controls/LRunControl.js b/sweagent/frontend/src/components/controls/LRunControl.js
index 218f8641..01ab87c7 100644
--- a/sweagent/frontend/src/components/controls/LRunControl.js
+++ b/sweagent/frontend/src/components/controls/LRunControl.js
@@ -25,6 +25,7 @@ function LRunControl({
// ps = problem statement
const [psType, setPsType] = useState("gh");
const [envInputType, setEnvInputType] = useState("manual");
+ const defaultInstallCommand = "pip install --editable .";
const defaultPS =
"https://github.com/marshmallow-code/marshmallow/issues/1359";
@@ -133,16 +134,46 @@ function LRunControl({
})
}
placeholder={envConfigDefault["python"]}
- value=""
+ defaultValue=""
+ />
+ </div>
+ <div class="input-group mb-3">
+ <div class="input-group-text">
+ <input
+ class="form-check-input mt-0"
+ type="checkbox"
+ aria-label="Run installation command"
+ defaultChecked={true}
+ onChange={(e) =>
+ setEnvConfig({
+ ...envConfig,
+ install_command_active: e.target.value,
+ })
+ }
+ />
+ </div>
+ <span className="input-group-text">Installation command</span>
+ <input
+ type="text"
+ class="form-control"
+ aria-label="Text input with checkbox"
+ placeholder={defaultInstallCommand}
+ onChange={(e) =>
+ setEnvConfig({
+ ...envConfig,
+ install: e.target.value || defaultInstallCommand,
+ })
+ }
/>
</div>
+
<textarea
className="form-control"
onChange={(e) =>
setEnvConfig({ ...envConfig, pip_packages: e.target.value })
}
rows="5"
- placeholder="pip installable packages list, one per line (i.e., requirements.txt). You can also just enter . to install the package with pip install ."
+ placeholder="pip installable packages list, one per line (i.e., requirements.txt)."
/>
</div>
);
@@ -160,6 +191,8 @@ function LRunControl({
setEnvConfig({
python: envConfigDefault["python"],
config_type: "manual",
+ install: "pip install --editable .",
+ install_command_active: true,
});
} else if (value === "script_path") {
setEnvConfig({ script_path: "", config_type: "script_path" });
@@ -245,7 +278,7 @@ function LRunControl({
className="form-select"
aria-label="Select problem statement type"
onChange={(e) => handleEnvInputTypeUpdate(e.target.value)}
- value={envInputType}
+ defaultValue={envInputType}
>
<option value="manual">Python version and packages</option>
<option value="script_path">Path to shell script</option>