Skip to content

Commit ebc8484

Browse files
authored
feat: update docs (#25)
1 parent 3350fc7 commit ebc8484

File tree

11 files changed

+55
-52
lines changed

11 files changed

+55
-52
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[
22
"introduction",
3-
"quick-start.md",
3+
"quick-start",
44
"demo.md"
55
]

apps/site/docs/en/docs/getting-started/quick-start.md renamed to apps/site/docs/en/docs/getting-started/quick-start.mdx

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Quick Start
22

3+
import { PackageManagerTabs } from '@theme';
4+
5+
36
In this example, we use OpenAI GPT-4o to search headphones on eBay, and then get the result items and prices in JSON format.
47

58
Remember to prepare an API key that is eligible for accessing OpenAI's GPT-4o before running.
@@ -21,9 +24,7 @@ We assume you already have a project with Puppeteer.
2124

2225
### add the dependency
2326

24-
```bash
25-
npm install @midscene/web --save-dev
26-
```
27+
<PackageManagerTabs command="install @midscene/web --save-dev" />
2728

2829
### Step 1. update playwright.config.ts
2930

@@ -51,7 +52,7 @@ export const test = base.extend<PlayWrightAiFixtureType>(PlaywrightAiFixture());
5152

5253
Save the following code as `./e2e/ebay-search.spec.ts`
5354

54-
```typescript
55+
```typescript title="./e2e/ebay-search.spec.ts"
5556
import { expect } from "@playwright/test";
5657
import { test } from "./fixture";
5758

@@ -97,16 +98,13 @@ npx http-server ./midscene_run/report -p 9888 -o -s
9798
9899
### Step 1. install dependencies
99100

100-
```bash
101-
npm install @midscene/web --save-dev
102-
npm install puppeteer ts-node --save-dev
103-
```
101+
<PackageManagerTabs command="install @midscene/web puppeteer ts-node --save-dev" />
104102

105103
### Step 2. write scripts
106104

107105
Write and save the following code as `./demo.ts`.
108106

109-
```typescript
107+
```typescript title="./demo.ts"
110108
import puppeteer from "puppeteer";
111109
import { PuppeteerAgent } from "@midscene/web";
112110

@@ -181,4 +179,9 @@ npx ts-node demo.ts
181179

182180
After running, MidScene will generate a log dump, which is placed in `./midscene_run/report/latest.web-dump.json` by default. Then put this file into [Visualization Tool](/visualization/), and you will have a clearer understanding of the process.
183181

182+
183+
## View demo report
184+
184185
Click the 'Load Demo' button in the [Visualization Tool](/visualization/), you will be able to see the results of the previous code as well as some other samples.
186+
187+
![](/view-demo-visualization.gif)

apps/site/docs/en/index.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ pageType: home
33

44
hero:
55
name: MidScene.js
6-
text: Joyful Automation by AI
6+
text: |
7+
Powered by AI
8+
Joyful UI Automation
79
tagline:
810
actions:
911
- theme: brand
@@ -17,14 +19,14 @@ hero:
1719
alt: MidScene Logo
1820
features:
1921
- title: Natural Language Interaction
20-
details: Describe the steps, let MidScene plan and execute for you.
21-
icon: 🔍
22+
details: Describe the steps and let MidScene plan and control the user interface for you
23+
icon: 👆
2224
- title: Understand UI, Answer in JSON
23-
details: Provide prompts for the desired data format, and then receive the predictable answer in JSON format.
24-
icon: 🤔
25+
details: Provide prompts regarding the desired data format, and then receive the expected response in JSON format.
26+
icon: 🔍
2527
- title: Intuitive Assertion
2628
details: Make assertions in natural language. It’s all based on AI understanding.
27-
icon:
29+
icon: 🤔
2830
- title: Out-of-box LLM
2931
details: It is fine to use public multimodal LLMs like GPT-4o. There is no need for any custom training.
3032
icon: 🪓
Loading

apps/site/docs/public/visualizer.jpg

305 KB
Loading
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[
22
"introduction",
3-
"quick-start.md",
4-
"demo.md"
3+
"quick-start",
4+
"demo"
55
]

apps/site/docs/zh/docs/getting-started/quick-start.md renamed to apps/site/docs/zh/docs/getting-started/quick-start.mdx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ export OPENAI_API_KEY="sk-abcdefghijklmnopqrstuvwxyz"
2323

2424
### 新增依赖
2525

26-
```bash
27-
npm install @midscene/web --save-dev
28-
```
26+
<PackageManagerTabs command="install @midscene/web --save-dev" />
2927

3028
### 第一步:更新 playwright.config.ts
3129

@@ -53,7 +51,7 @@ export const test = base.extend<PlayWrightAiFixtureType>(PlaywrightAiFixture());
5351

5452
编写下方代码,保存为 `./e2e/ebay-search.spec.ts`
5553

56-
```typescript
54+
```typescript title="./e2e/ebay-search.spec.ts"
5755
import { expect } from "@playwright/test";
5856
import { test } from "./fixture";
5957

@@ -109,7 +107,7 @@ npm install puppeteer ts-node --save-dev
109107

110108
编写下方代码,保存为 `./demo.ts`
111109

112-
```typescript
110+
```typescript title="./demo.ts"
113111
import puppeteer from "puppeteer";
114112
import { PuppeteerAgent } from "@midscene/web";
115113

@@ -186,4 +184,8 @@ npx ts-node demo.ts
186184

187185
运行 MidScene 之后,系统会生成一个日志文件,默认存放在 `./midscene_run/report/latest.web-dump.json`。然后,你可以把这个文件导入 [可视化工具](/visualization/),这样你就能更清楚地了解整个过程。
188186

187+
## 访问示例报告
188+
189189
[可视化工具](/visualization/) 中,点击 `Load Demo` 按钮,你将能够看到上方代码的运行结果以及其他的一些示例。
190+
191+
![](/view-demo-visualization.gif)

apps/site/docs/zh/docs/more/prompting-tips.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
你在 MidScene 编写的自然语言参数,最终都会变成提示词(Prompt)发送给大语言模型。以下是一些可以帮助提升效果的提示词工程(Prompt Engineering)技巧。
44

5-
## 目的是获得更稳定的响应
5+
## 目标是获得更稳定的响应
66

7-
由于 AI 常常会“幻想”,调优的目的是在多次运行中获得模型的稳定响应。大多数情况下,通过使用良好的提示,LLM 的响应效果可以变得更好。
7+
由于 AI 常常会“幻想”,调优的目标是在多次运行中获得模型的稳定响应。大多数情况下,通过使用良好的提示,LLM 的响应效果可以变得更好。
88

99
## 提供更详细的描述并提供样例
1010

apps/site/docs/zh/index.md

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,38 @@ pageType: home
33

44
hero:
55
name: MidScene.js
6-
text: Joyful Automation by AI
6+
text: |
7+
Powered by AI
8+
Joyful UI Automation
79
tagline:
810
actions:
911
- theme: brand
10-
text: Introduction
12+
text: 介绍
1113
link: /docs/getting-started/introduction
1214
- theme: alt
13-
text: Quick Start
15+
text: 快速开始
1416
link: /docs/getting-started/quick-start
1517
image:
1618
src: /midscene.png
1719
alt: MidScene Logo
1820
features:
1921

20-
- title: 自然语言交互
21-
details: 描述操作步骤,MidScene 为你自动执行
22-
icon: 🔍
22+
- title: 自然语言控制界面
23+
details: 描述操作步骤,MidScene 为你自动操控界面
24+
icon: 👆
2325
- title: 理解界面,提取数据
2426
details: 描述你需要的数据和格式,由 MidScene 提取并生成 JSON
25-
icon: 🤔
27+
icon: 🔍
2628
- title: 描述并断言
27-
details: 使用自然语言进行描述和断言
28-
icon:
29+
details: 使用自然语言对界面进行断言
30+
icon: 🤔
2931
- title: 开箱即用的模型
30-
details: 无需自行训练模型,直接使用 GPT-4o
32+
details: 无需自行训练模型,可以直接使用 GPT-4o
3133
icon: 🪓
32-
- title: 可视化
33-
details: 使用我们的可视化工具,清晰掌握 SDK 的每个步骤
34+
- title: 可视化工具
35+
details: 使用配套的可视化工具,清晰掌握 SDK 的每个步骤
3436
icon: 🎞️
3537
- title: 前所未有的新体验!
36-
details: 通过全新的方式编写自动化脚本 试试吧!
38+
details: 更自然、更易于维护的 UI 自动化编写体验。试试吧!
39+
icon: 🔥
3740
---

packages/visualizer/src/demo-dump.json

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

packages/visualizer/src/index.tsx

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import Timeline from './component/timeline';
99
import DetailPanel from './component/detail-panel';
1010
import Logo from './component/assets/logo-plain.svg';
1111
import GlobalHoverPreview from './component/global-hover-preview';
12+
import demoDump from './demo-dump.json';
1213
import { useExecutionDump } from '@/component/store';
1314
import DetailSide from '@/component/detail-side';
1415
import Sidebar from '@/component/sidebar';
@@ -90,14 +91,8 @@ export function Visualizer(props: {
9091
},
9192
};
9293

93-
const loadTasksDemo = () => {
94-
// setExecutionDump(actionDemo);
95-
// message.info('Your are viewing the demo data.');
96-
};
97-
98-
const loadInsightDemo = () => {
99-
// loadInsightDump(InsightDemo);
100-
// message.info('Your are viewing the demo data.');
94+
const loadDemoDump = () => {
95+
setGroupedDump(demoDump as any);
10196
};
10297

10398
let mainContent: JSX.Element;
@@ -122,19 +117,16 @@ export function Visualizer(props: {
122117
<p className="ant-upload-text">
123118
The latest dump file is usually placed in{' '}
124119
<b>
125-
<i>./midscene_run/</i>
120+
<i>./midscene_run/report</i>
126121
</b>
127122
</p>
128123
<p className="ant-upload-text">
129124
All data will be processed locally by the browser. No data will be sent to the server.
130125
</p>
131126
</Dragger>
132127
<div className="demo-loader">
133-
<Button type="link" onClick={loadTasksDemo}>
134-
Load Tasks Demo
135-
</Button>
136-
<Button type="link" onClick={loadInsightDemo}>
137-
Load Insight Demo
128+
<Button type="link" onClick={loadDemoDump}>
129+
Load Demo
138130
</Button>
139131
</div>
140132
</div>

0 commit comments

Comments
 (0)