Skip to content

Commit d1aebaa

Browse files
authored
v0.1.3
Add English/Chinese UI switching. Enhance test case management and update README. Abort test case early when failure is unrecoverable. Refresh Gradio i18n locales for zh-CN and en-US.
2 parents d75cc85 + ca754f5 commit d1aebaa

32 files changed

+2102
-979
lines changed

Dockerfile

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
FROM mcr.microsoft.com/playwright/python:v1.52.0-noble
22

3-
# 设置工作目录
3+
# Set working directory
44
WORKDIR /app
55

6-
# 安装 Node.jsnpm,以及必要的工具
6+
# Install Node.js, npm, and necessary tools
77
RUN apt-get update && apt-get install -y \
88
curl \
99
unzip \
@@ -12,13 +12,13 @@ RUN apt-get update && apt-get install -y \
1212
&& apt-get install -y nodejs \
1313
&& rm -rf /var/lib/apt/lists/*
1414

15-
# 优化pip配置和网络设置
15+
# Optimize pip configuration and network settings
1616
RUN pip config set global.index-url https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple && \
1717
pip config set global.trusted-host mirrors.tuna.tsinghua.edu.cn && \
1818
pip config set global.timeout 300 && \
1919
pip config set global.retries 5
2020

21-
# 1. 先安装nuclei
21+
# 1. Install nuclei first
2222
RUN ARCH=$(dpkg --print-architecture) && \
2323
if [ "$ARCH" = "amd64" ]; then \
2424
NUCLEI_ARCH="amd64"; \
@@ -35,19 +35,19 @@ RUN ARCH=$(dpkg --print-architecture) && \
3535
chmod +x /usr/local/bin/nuclei && \
3636
rm -rf /tmp/nuclei /tmp/nuclei.zip
3737

38-
# 2. 复制Python依赖文件并安装
38+
# 2. Copy Python dependency file and install
3939
COPY requirements.txt /app/
4040
RUN pip install --no-cache-dir --default-timeout=300 -r requirements.txt
4141

42-
# 3. 复制Node.js依赖文件并安装
42+
# 3. Copy Node.js dependency file and install
4343
COPY package.json /app/
4444
RUN npm install
4545

46-
# 4. 复制项目文件
46+
# 4. Copy project files
4747
COPY . /app
4848

49-
# 更新nuclei模板
49+
# Update nuclei templates
5050
RUN nuclei -ut -v
5151

52-
# 设置运行webqa-agent
52+
# Set to run webqa-agent
5353
CMD ["python", "webqa-agent.py"]

README.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
1-
# WebQA Agent
1+
<h1 align="center">WebQA Agent</h1>
22

33
<!-- badges -->
4-
<p align="left">
4+
<p align="center">
55
<a href="https://github.com/MigoXLab/webqa-agent/blob/main/LICENSE"><img src="https://img.shields.io/github/license/MigoXLab/webqa-agent" alt="License"></a>
66
<a href="https://github.com/MigoXLab/webqa-agent/stargazers"><img src="https://img.shields.io/github/stars/MigoXLab/webqa-agent" alt="GitHub stars"></a>
77
<a href="https://github.com/MigoXLab/webqa-agent/network/members"><img src="https://img.shields.io/github/forks/MigoXLab/webqa-agent" alt="GitHub forks"></a>
88
<a href="https://github.com/MigoXLab/webqa-agent/issues"><img src="https://img.shields.io/github/issues/MigoXLab/webqa-agent" alt="GitHub issues"></a>
99
<a href="https://deepwiki.com/MigoXLab/webqa-agent"><img src="https://deepwiki.com/badge.svg" alt="Ask DeepWiki"></a>
1010
</p>
1111

12-
[English](README.md) · [简体中文](README_zh-CN.md)
12+
<p align="center">
13+
Try Demo 🤗<a href="https://huggingface.co/spaces/mmmay0722/WebQA-Agent">HuggingFace</a> | 🚀<a href="https://modelscope.cn/studios/mmmmei22/WebQA-Agent/summary">ModelScope</a><br>
14+
Join us on 🎮<a href="https://discord.gg/K5TtkVcx">Discord</a> | 💬<a href="https://aicarrier.feishu.cn/docx/NRNXdIirXoSQEHxhaqjchUfenzd">WeChat</a>
15+
</p>
16+
17+
<p align="center"><a href="README.md">English</a> · <a href="README_zh-CN.md">简体中文</a></p>
1318

14-
**WebQA Agent** is an autonomous web agent that audits performance, functionality, and UX for any web product.
19+
<p align="center">🤖 <strong>WebQA Agent</strong> is an autonomous web browser agent that audits performance, functionality & UX for engineers and vibe-coding creators. ✨</p>
1520

1621
## 🚀 Core Features
1722

@@ -101,7 +106,9 @@ python webqa-agent.py
101106

102107
## Online Demo
103108

104-
Experience online: [WebQA-Agent on ModelScope](https://modelscope.cn/studios/mmmmei22/WebQA-Agent/summary)
109+
🚀 **Try WebQA Agent Online:**
110+
- **Hugging Face Spaces**: [WebQA-Agent on Hugging Face](https://huggingface.co/spaces/mmmay0722/WebQA-Agent)
111+
- **ModelScope Studio**: [WebQA-Agent on ModelScope](https://modelscope.cn/studios/mmmmei22/WebQA-Agent/summary)
105112

106113
## Usage
107114

README_zh-CN.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
1-
# WebQA Agent
1+
<h1 align="center">WebQA Agent</h1>
22

33
<!-- badges -->
4-
<p align="left">
4+
<p align="center">
55
<a href="https://github.com/MigoXLab/webqa-agent/blob/main/LICENSE"><img src="https://img.shields.io/github/license/MigoXLab/webqa-agent" alt="License"></a>
66
<a href="https://github.com/MigoXLab/webqa-agent/stargazers"><img src="https://img.shields.io/github/stars/MigoXLab/webqa-agent" alt="GitHub stars"></a>
77
<a href="https://github.com/MigoXLab/webqa-agent/network/members"><img src="https://img.shields.io/github/forks/MigoXLab/webqa-agent" alt="GitHub forks"></a>
88
<a href="https://github.com/MigoXLab/webqa-agent/issues"><img src="https://img.shields.io/github/issues/MigoXLab/webqa-agent" alt="GitHub issues"></a>
99
<a href="https://deepwiki.com/MigoXLab/webqa-agent"><img src="https://deepwiki.com/badge.svg" alt="Ask DeepWiki"></a>
1010
</p>
1111

12-
[English](README.md) · [简体中文](README_zh-CN.md)
12+
<p align="center">
13+
体验Demo 🤗<a href="https://huggingface.co/spaces/mmmay0722/WebQA-Agent">HuggingFace</a> | 🚀<a href="https://modelscope.cn/studios/mmmmei22/WebQA-Agent/summary">ModelScope</a><br>
14+
加入我们 🎮<a href="https://discord.gg/K5TtkVcx">Discord</a> | 💬<a href="https://aicarrier.feishu.cn/docx/NRNXdIirXoSQEHxhaqjchUfenzd">微信群</a>
15+
</p>
1316

14-
**WebQA Agent** 是全自动网页评估测试 Agent,一键诊断性能、安全、功能与交互体验
17+
<p align="center"><a href="README.md">English</a> · <a href="README_zh-CN.md">简体中文</a></p>
18+
19+
<p align="center">🤖 <strong>WebQA Agent</strong> 是全自动网页评估测试 Agent,一键完成性能、功能与交互体验的测试评估 ✨</p>
1520

1621
## 🚀 核心特性
1722

@@ -104,7 +109,9 @@ python webqa-agent.py
104109

105110
## 在线演示
106111

107-
进入ModelScope体验:[WebQA-Agent on ModelScope](https://modelscope.cn/studios/mmmmei22/WebQA-Agent/summary)
112+
🚀 **在线体验 WebQA Agent:**
113+
- **Hugging Face Spaces**: [WebQA-Agent on Hugging Face](https://huggingface.co/spaces/mmmay0722/WebQA-Agent)
114+
- **ModelScope Studio**: [WebQA-Agent on ModelScope](https://modelscope.cn/studios/mmmmei22/WebQA-Agent/summary)
108115

109116
## 使用说明
110117

@@ -139,7 +146,6 @@ browser_config:
139146
headless: False # Docker环境会自动覆盖为True
140147
language: zh-CN
141148
cookies: []
142-
143149
```
144150
145151
在配置和运行测试时,请注意以下重要事项:

app.py

Lines changed: 40 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,43 @@
11
#!/usr/bin/env python3
22
"""
3-
WebQA Agent Gradio启动脚本
3+
WebQA Agent Gradio Launch Script
44
"""
55

66
import sys
77
import os
88
import subprocess
99
import asyncio
1010

11-
# 添加项目路径到Python路径
12-
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
11+
# Add project path to Python path
12+
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
1313

14-
# 导入并启动Gradio应用
14+
# Language configuration from environment variable
15+
def get_gradio_language():
16+
"""Get Gradio interface language from environment variable with validation"""
17+
supported_languages = ["zh-CN", "en-US"]
18+
env_lang = os.getenv("GRADIO_LANGUAGE", "en-US") # Default to English
19+
20+
if env_lang in supported_languages:
21+
return env_lang
22+
else:
23+
print(f"⚠️ Warning: Unsupported language '{env_lang}', falling back to 'en-US'")
24+
return "en-US"
25+
26+
GRADIO_LANGUAGE = get_gradio_language()
27+
28+
# Import and launch Gradio application
1529
if __name__ == "__main__":
1630
try:
17-
from demo_gradio import create_gradio_interface, queue_manager, process_queue
31+
from app_gradio.demo_gradio import create_gradio_interface, queue_manager, process_queue
1832
import threading
1933
from playwright.async_api import async_playwright, Error as PlaywrightError
2034

21-
print("🚀 启动WebQA Agent Gradio界面...")
22-
print("📱 界面将在 http://localhost:7860 启动")
23-
print("⚠️ 注意:请确保已安装所有依赖包 (pip install -r requirements.txt)")
24-
print("🔍 正在检查 Playwright 浏览器依赖...")
35+
print("🚀 Starting WebQA Agent Gradio interface...")
36+
print("📱 Interface will start at http://localhost:7860")
37+
print(f"🌐 Interface language: {GRADIO_LANGUAGE}")
38+
print("💡 Tip: Set environment variable GRADIO_LANGUAGE=en-US for English or GRADIO_LANGUAGE=zh-CN for Chinese")
39+
print("⚠️ Note: Please ensure all dependencies are installed (pip install -r requirements.txt)")
40+
print("🔍 Checking Playwright browser dependencies...")
2541

2642
async def _check_playwright():
2743
try:
@@ -36,53 +52,53 @@ async def _check_playwright():
3652

3753
ok = asyncio.run(_check_playwright())
3854
if not ok:
39-
print("⚠️ 检测到 Playwright 浏览器未安装,正在自动安装...")
55+
print("⚠️ Detected Playwright browsers not installed, installing automatically...")
4056
try:
4157
cmd = [sys.executable, "-m", "playwright", "install"]
4258
result = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True)
4359
print(result.stdout)
4460
except Exception as e:
45-
print(f"❌ 自动安装失败:{e}\n请手动执行:playwright install")
61+
print(f"❌ Automatic installation failed: {e}\nPlease run manually: playwright install")
4662
sys.exit(1)
4763

48-
# 安装后再次校验
64+
# Verify again after installation
4965
ok_after = asyncio.run(_check_playwright())
5066
if not ok_after:
51-
print("❌ Playwright 浏览器仍不可用,请手动执行:playwright install")
67+
print("❌ Playwright browsers still unavailable, please run manually: playwright install")
5268
sys.exit(1)
53-
print("✅ Playwright 浏览器可用")
69+
print("✅ Playwright browsers available")
5470

55-
# 启动队列处理器
71+
# Start queue processor
5672
def run_queue_processor():
57-
"""在后台线程中运行队列处理器"""
73+
"""Run queue processor in background thread"""
5874
loop = asyncio.new_event_loop()
5975
asyncio.set_event_loop(loop)
6076
loop.run_until_complete(process_queue())
6177

6278
queue_thread = threading.Thread(target=run_queue_processor, daemon=True)
6379
queue_thread.start()
64-
print("✅ 任务队列处理器已启动")
80+
print("✅ Task queue processor started")
6581

66-
# 创建并启动Gradio应用
67-
app = create_gradio_interface()
68-
print("✅ Gradio界面已创建")
82+
# Create and launch Gradio application with language configuration
83+
app = create_gradio_interface(language=GRADIO_LANGUAGE)
84+
print(f"✅ Gradio interface created with language: {GRADIO_LANGUAGE}")
6985

7086
app.launch(
7187
server_name="0.0.0.0",
7288
server_port=7860,
7389
share=False,
7490
show_error=True,
75-
inbrowser=True # 自动打开浏览器
91+
inbrowser=True # Auto open browser
7692
)
7793

7894
except ImportError as e:
79-
print(f"❌ 导入错误: {e}")
80-
print("请确保已安装所有依赖包:")
95+
print(f"❌ Import error: {e}")
96+
print("Please ensure all dependencies are installed:")
8197
print("pip install -r requirements.txt")
8298
sys.exit(1)
8399

84100
except Exception as e:
85-
print(f"❌ 启动失败: {e}")
101+
print(f"❌ Startup failed: {e}")
86102
import traceback
87103
traceback.print_exc()
88104
sys.exit(1)

0 commit comments

Comments
 (0)