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]

Doc: Add information of how to open correct browser window (#324)

Kilian Lieret5544bc43f9eb
diff --git a/docs/assets/open_port_default.png b/docs/assets/open_port_default.png
new file mode 100644
index 00000000..16f1c97f
Binary files /dev/null and b/docs/assets/open_port_default.png differ
diff --git a/docs/assets/open_port_in_browser.png b/docs/assets/open_port_in_browser.png
new file mode 100644
index 00000000..c34d1655
Binary files /dev/null and b/docs/assets/open_port_in_browser.png differ
diff --git a/docs/github_codespace.md b/docs/github_codespace.md
new file mode 100644
index 00000000..92d758a0
--- /dev/null
+++ b/docs/github_codespace.md
@@ -0,0 +1,20 @@
+# SWE-agent on GitHub Codespaces
+
+## Running the web UI
+
+Go to the terminal and enter
+
+```bash
+./start_web_ui.sh
+```
+
+After a while, you should see a popup offering you to forward port `3000`. Click `Open in Browser`.
+
+![port 3000 forwarding popup](assets/open_port_default.png)
+
+
+If you instead only see the offer to forward port `8000`, do not click it (this is the port that's being used by the backend).
+
+Instead, click on the `Ports` tab, and click on the globe next to port `3000`:
+
+![port 3000 forwarding manual](assets/open_port_in_browser.png)
\ No newline at end of file
diff --git a/start_web_ui.sh b/start_web_ui.sh
index eeee8071..e4d848a9 100755
--- a/start_web_ui.sh
+++ b/start_web_ui.sh
@@ -8,10 +8,20 @@ function stop_react {
npx --prefix "${this_dir}/sweagent/frontend" pm2 delete swe-agent
}
-cd sweagent/frontend
+cd "${this_dir}/sweagent/frontend"
npm install
trap stop_react exit
npx pm2 start --name swe-agent npm -- start
+echo "* If you are running on your own machine, then a browser window "
+echo " should have already opened. If not, wait a few more seconds, then "
+echo " open your browser at http://localhost:3000"
+echo "* If you are running in github codespaces, please click the popup "
+echo " that offers to forward port 3000 (not 8000!)."
+echo " Missed it? Find more information at "
+echo " https://github.com/princeton-nlp/SWE-agent/blob/main/docs/github_codespace.md"
+echo "* Something went wrong? Please check "
+echo " web_api.log for error messages!"
+
cd ../../
-python sweagent/api/server.py
+python sweagent/api/server.py > web_api.log 2>&1