Skip to content

Commit

Permalink
feat: Demo display effect and usage (#162)
Browse files Browse the repository at this point in the history
Demo changes
  • Loading branch information
XianBW authored Aug 9, 2024
1 parent d0a6832 commit 8cf122a
Show file tree
Hide file tree
Showing 5 changed files with 322 additions and 232 deletions.
2 changes: 2 additions & 0 deletions .streamlit/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[client]
showSidebarNavigation = false
4 changes: 3 additions & 1 deletion docs/ui.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ In `RD-Agent/` folder, run:

.. code-block:: bash
rdagent ui --port <port> --log_dir <log_dir>
rdagent ui --port <port> --log_dir <log_dir> [--debug]
This will start a web app on `http://localhost:<port>`.

**NOTE**: The log_dir parameter is not required. You can manually enter the log_path in the web app. If you set the log_dir parameter, you can easily select a different log_path in the web app.

--debug is optional, it will show a "Single Step Run" button in sidebar and saved objects info in the web app.

Use Web App
-----------

Expand Down
11 changes: 9 additions & 2 deletions rdagent/app/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,19 @@
load_dotenv()


def ui(port=80, log_dir="./log"):
def ui(port=80, log_dir="", debug=False):
"""
start web app to show the log traces.
"""
with rpath("rdagent.log.ui", "app.py") as app_path:
subprocess.run(["streamlit", "run", app_path, f"--server.port={port}", "--", f"--log_dir={log_dir}"])
cmds = ["streamlit", "run", app_path, f"--server.port={port}"]
if log_dir or debug:
cmds.append("--")
if log_dir:
cmds.append(f"--log_dir={log_dir}")
if debug:
cmds.append("--debug")
subprocess.run(cmds)


def app():
Expand Down
Loading

0 comments on commit 8cf122a

Please sign in to comment.