Merge branch 'main' into streaming
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -130,6 +130,7 @@ ENV/
|
||||
env.bak/
|
||||
venv.bak/
|
||||
test_env/
|
||||
myenv
|
||||
|
||||
|
||||
# Spyder project settings
|
||||
|
||||
38
README.md
38
README.md
@@ -107,6 +107,44 @@ playwright install
|
||||
- Open the WebUI in a non-Chrome browser, such as Firefox or Edge. This is important because the persistent browser context will use the Chrome data when running the agent.
|
||||
- Check the "Use Own Browser" option within the Browser Settings.
|
||||
|
||||
### Options:
|
||||
|
||||
### `--theme`
|
||||
|
||||
- **Type**: `str`
|
||||
- **Default**: `Ocean`
|
||||
- **Description**: Specifies the theme for the user interface.
|
||||
- **Options**:
|
||||
The available themes are defined in the `theme_map` dictionary. Below are the options you can choose from:
|
||||
- **Default**: The standard theme with a balanced design.
|
||||
- **Soft**: A gentle, muted color scheme for a relaxed viewing experience.
|
||||
- **Monochrome**: A grayscale theme with minimal color for simplicity and focus.
|
||||
- **Glass**: A sleek, semi-transparent design for a modern appearance.
|
||||
- **Origin**: A classic, retro-inspired theme for a nostalgic feel.
|
||||
- **Citrus**: A vibrant, citrus-inspired palette with bright and fresh colors.
|
||||
- **Ocean** (default): A blue, ocean-inspired theme providing a calming effect.
|
||||
|
||||
**Example**:
|
||||
|
||||
```bash
|
||||
python webui.py --ip 127.0.0.1 --port 7788 --theme Glass
|
||||
```
|
||||
|
||||
### `--dark-mode`
|
||||
|
||||
- **Type**: `boolean`
|
||||
- **Default**: Disabled
|
||||
- **Description**: Enables dark mode for the user interface. This is a simple toggle; including the flag activates dark mode, while omitting it keeps the interface in light mode.
|
||||
- **Options**:
|
||||
- **Enabled (`--dark-mode`)**: Activates dark mode, switching the interface to a dark color scheme for better visibility in low-light environments.
|
||||
- **Disabled (default)**: Keeps the interface in the default light mode.
|
||||
|
||||
**Example**:
|
||||
|
||||
```bash
|
||||
python webui.py --ip 127.0.0.1 --port 7788 --dark-mode
|
||||
```
|
||||
|
||||
## (Optional) Configure Environment Variables
|
||||
|
||||
Copy `.env.example` to `.env` and set your environment variables, including API keys for the LLM. With
|
||||
|
||||
@@ -21,14 +21,14 @@ def test_connect_browser():
|
||||
browser = p.chromium.launch_persistent_context(
|
||||
user_data_dir=chrome_use_data,
|
||||
executable_path=chrome_exe,
|
||||
headless=False # 保持浏览器窗口可见
|
||||
headless=False # Keep browser window visible
|
||||
)
|
||||
|
||||
page = browser.new_page()
|
||||
page.goto("https://mail.google.com/mail/u/0/#inbox")
|
||||
page.wait_for_load_state()
|
||||
|
||||
input("按下回车键以关闭浏览器...")
|
||||
input("Press the Enter key to close the browser...")
|
||||
|
||||
browser.close()
|
||||
|
||||
|
||||
9
webui.py
9
webui.py
@@ -47,6 +47,7 @@ async def run_browser_agent(
|
||||
window_w,
|
||||
window_h,
|
||||
save_recording_path,
|
||||
enable_recording,
|
||||
task,
|
||||
add_infos,
|
||||
max_steps,
|
||||
@@ -98,8 +99,6 @@ async def run_browser_agent(
|
||||
else:
|
||||
raise ValueError(f"Invalid agent type: {agent_type}")
|
||||
|
||||
|
||||
|
||||
async def run_org_agent(
|
||||
llm,
|
||||
headless,
|
||||
@@ -567,6 +566,11 @@ def create_ui(theme_name="Ocean"):
|
||||
value=True,
|
||||
info="Disable browser security features",
|
||||
)
|
||||
enable_recording = gr.Checkbox(
|
||||
label="Enable Recording",
|
||||
value=True,
|
||||
info="Enable saving browser recordings",
|
||||
)
|
||||
|
||||
with gr.Row():
|
||||
window_w = gr.Number(
|
||||
@@ -585,6 +589,7 @@ def create_ui(theme_name="Ocean"):
|
||||
placeholder="e.g. ./tmp/record_videos",
|
||||
value="./tmp/record_videos",
|
||||
info="Path to save browser recordings",
|
||||
interactive=True, # Allow editing only if recording is enabled
|
||||
)
|
||||
|
||||
with gr.TabItem("🤖 Run Agent", id=4):
|
||||
|
||||
Reference in New Issue
Block a user