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]

add blank landing page 8000 (#493)

Kilian Lieret28e0de5caf78
diff --git a/docs/installation/codespaces.md b/docs/installation/codespaces.md
index 210de68a..62a43f98 100644
--- a/docs/installation/codespaces.md
+++ b/docs/installation/codespaces.md
@@ -29,4 +29,8 @@ 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)
+!!! tip "More information"
+ See [running the web UI](../usage/web_ui.md) for more information about the
+ web UI and additional hints for how to solve problems with the starting it.
+
{% include-markdown "../_footer.md" %}
\ No newline at end of file
diff --git a/docs/installation/docker.md b/docs/installation/docker.md
index e1705089..61188f4c 100644
--- a/docs/installation/docker.md
+++ b/docs/installation/docker.md
@@ -25,6 +25,10 @@ docker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock \
If you're using docker on Windows, use `-v //var/run/docker.sock:/var/run/docker.sock`
(double slash) to escape it ([more information](https://stackoverflow.com/a/47229180/)).
+!!! tip "More tips"
+ See the [installation issues section](tips.md) for more help if you run into
+ trouble.
+
If you instead want to pass the keys as environment variables, use
```bash
@@ -66,8 +70,8 @@ docker run -p 3000:3000 -it -v /var/run/docker.sock:/var/run/docker.sock \
sweagent/swe-agent-run:latest bash start_web_ui.sh
```
-!!! tip "More tips"
- See the [installation issues section](tips.md) for more help if you run into
- trouble.
+!!! tip "More information"
+ See [running the web UI](../usage/web_ui.md) for more information about the
+ web UI and additional hints for how to solve problems with the starting it.
{% include-markdown "../_footer.md" %}
diff --git a/docs/usage/web_ui.md b/docs/usage/web_ui.md
index fcaeacf2..ce835b2b 100644
--- a/docs/usage/web_ui.md
+++ b/docs/usage/web_ui.md
@@ -21,7 +21,31 @@ from the root of the repository.
If you run SWE-agent from the `docker-run` Docker container, please see [here](../installation/docker.md)
for how to start the web server.
-## Manually starting frontend and backend
+## If something doesn't work <a name="web-ui-debug"></a>
+
+Please make sure that your port 8000 and 3000 are unoccupied before running the above script.
+
+Run
+
+```bash
+lsof -i :8000
+lsof -i :3000
+```
+
+to identify other programs serving to that port and kill them, then try again.
+
+If `./start_web_ui.sh` is running, but you see a warning message about the backend not being connected, either run
+
+```bash
+# this should show some python processes
+lsof -i :8000
+```
+
+or head to `localhost:8000` (you should see a small dummy page).
+
+It might also make sense to start the backend frontend manually as explained in the next section.
+
+## Manually starting frontend and backend <a name="manual-web-ui"></a>
The web UI consists of a frontend written in [react][] (showing the pretty control elements) and a backend written with [flask][].
The `./start_web_ui.sh` starts both of them in the background.
diff --git a/sweagent/api/index.html b/sweagent/api/index.html
new file mode 100644
index 00000000..a1e2805c
--- /dev/null
+++ b/sweagent/api/index.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>SWE-agent backend</title>
+</head>
+<body>
+ <header>
+ <h1>SWE-agent backend</h1>
+ </header>
+
+ If you can see this page, then the SWE-agent backend is running.
+ Please start the SWE-agent react frontend to interact with the backend.
+</body>
+</html>
\ No newline at end of file
diff --git a/sweagent/api/server.py b/sweagent/api/server.py
index 93c47497..87200dcb 100644
--- a/sweagent/api/server.py
+++ b/sweagent/api/server.py
@@ -38,7 +38,7 @@ from sweagent.environment.swe_env import EnvironmentArguments
sys.path.append(str(PACKAGE_DIR.parent))
from run import ActionsArguments, Main, ScriptArguments
-app = Flask(__name__)
+app = Flask(__name__, template_folder=Path(__file__).parent)
CORS(app)
socketio = SocketIO(app, cors_allowed_origins="*")
# Setting these variables outside of `if __name__ == "__main__"` because when run Flask server with