Skip to content

Commit 9b6fcc6

Browse files
authored
feat: rename aiAction to aiAct to adapt Midscene v1.0 (#75)
* fix: command in readme * feat: rename aiAction as aiAct
1 parent 92d7131 commit 9b6fcc6

File tree

28 files changed

+82
-82
lines changed

28 files changed

+82
-82
lines changed

android/javascript-sdk-demo/demo-run-yaml.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Promise.resolve(
99

1010
// 👀 init Midscene agent
1111
const agent = new AndroidAgent(page,{
12-
aiActionContext:
12+
aiActContext:
1313
'If any location, permission, user agreement, etc. popup, click agree. If login page pops up, close it.',
1414
});
1515
await page.connect();

android/javascript-sdk-demo/demo.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Promise.resolve(
99

1010
// 👀 init Midscene agent
1111
const agent = new AndroidAgent(page,{
12-
aiActionContext:
12+
aiActContext:
1313
'If any location, permission, user agreement, etc. popup, click agree. If login page pops up, close it.',
1414
});
1515
await page.connect();
@@ -18,7 +18,7 @@ Promise.resolve(
1818
await sleep(5000);
1919

2020
// 👀 type keywords, perform a search
21-
await agent.aiAction(
21+
await agent.aiAct(
2222
'type "Headphones" in search box, click search button'
2323
);
2424

android/vitest-demo/tests/setting.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,19 @@ describe(
1212
await it('Android settings page demo for scroll', async () => {
1313
const devices = await getConnectedDevices();
1414
const agent = await agentFromAdbDevice(devices[0].udid,{
15-
aiActionContext:
15+
aiActContext:
1616
'If any location, permission, user agreement, etc. popup, click agree. If login page pops up, close it.',
1717
});
1818

1919
await agent.launch('com.android.settings/.Settings');
2020

2121

22-
await agent.aiAction('scroll list to bottom');
23-
await agent.aiAction('open "More settings"');
24-
await agent.aiAction('scroll list to bottom');
25-
await agent.aiAction('scroll list to top');
26-
await agent.aiAction('swipe down one screen');
27-
await agent.aiAction('swipe up one screen');
22+
await agent.aiAct('scroll list to bottom');
23+
await agent.aiAct('open "More settings"');
24+
await agent.aiAct('scroll list to bottom');
25+
await agent.aiAct('scroll list to top');
26+
await agent.aiAct('swipe down one screen');
27+
await agent.aiAct('swipe up one screen');
2828
});
2929
},
3030
360 * 1000,

android/vitest-demo/tests/todo.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ describe('Test todo list', () => {
1717
const devices = await getConnectedDevices();
1818
const page = new AndroidDevice(devices[0].udid);
1919
agent = new AndroidAgent(page,{
20-
aiActionContext:
20+
aiActContext:
2121
'If any location, permission, user agreement, etc. popup, click agree. If login page pops up, close it.',
2222
});
2323
await page.connect();
@@ -28,22 +28,22 @@ describe('Test todo list', () => {
2828
it(
2929
'ai todo',
3030
async () => {
31-
await agent.aiAction(
31+
await agent.aiAct(
3232
"type 'Study JS today' in the task box input and press the Enter key",
3333
);
34-
await agent.aiAction(
34+
await agent.aiAct(
3535
"type 'Study Rust tomorrow' in the task box input and press the Enter key",
3636
);
37-
await agent.aiAction(
37+
await agent.aiAct(
3838
"type 'Study AI the day after tomorrow' in the task box input and press the Enter key",
3939
);
40-
await agent.aiAction(
40+
await agent.aiAct(
4141
'move the mouse to the second item in the task list and click the delete button on the right of the second task',
4242
);
43-
await agent.aiAction(
43+
await agent.aiAct(
4444
'click the check button on the left of the second task',
4545
);
46-
await agent.aiAction(
46+
await agent.aiAct(
4747
"click the 'completed' status button below the task list",
4848
);
4949

android/yaml-scripts-demo/midscene-scripts/maps-navigation.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ android:
77
tasks:
88
- name: travel
99
flow:
10-
- aiAction: open Maps app
11-
- aiAction: input 'attractions' in the search bar, and click the search button
12-
- aiAction: click the first search result, enter the attraction details page
13-
- aiAction: click "Directions" button, enter the route planning page
14-
- aiAction: click "Start" button to start navigation
10+
- aiAct: open Maps app
11+
- aiAct: input 'attractions' in the search bar, and click the search button
12+
- aiAct: click the first search result, enter the attraction details page
13+
- aiAct: click "Directions" button, enter the route planning page
14+
- aiAct: click "Start" button to start navigation

android/yaml-scripts-demo/midscene-scripts/search-headphone-on-ebay.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ android:
77
tasks:
88
- name: search headphones
99
flow:
10-
- aiAction: open browser and navigate to ebay.com
11-
- aiAction: type 'Headphones' in ebay search box, hit Enter
10+
- aiAct: open browser and navigate to ebay.com
11+
- aiAct: type 'Headphones' in ebay search box, hit Enter
1212
- sleep: 5000
13-
- aiAction: scroll down the page for 800px
13+
- aiAct: scroll down the page for 800px
1414

1515
- name: extract headphones info
1616
flow:

android/yaml-scripts-demo/midscene-scripts/twitter-auto-like.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ android:
66
tasks:
77
- name: like tweets
88
flow:
9-
- aiAction: open x app
10-
- aiAction: search 'midscene ai'
11-
- aiAction: click the user called 'midscene ai'
12-
- aiAction: click the first tweet
13-
- aiAction: click the like button
9+
- aiAct: open x app
10+
- aiAct: search 'midscene ai'
11+
- aiAct: click the user called 'midscene ai'
12+
- aiAct: click the first tweet
13+
- aiAct: click the like button
1414

1515
- name: extract tweets info
1616
flow:

bridge-mode-demo/demo-new-tab.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Promise.resolve(
1616
console.log("connected to a new tab !");
1717

1818
// these are the same as normal Midscene agent
19-
await agent.aiAction('type "AI 101" and hit Enter');
19+
await agent.aiAct('type "AI 101" and hit Enter');
2020
await sleep(3000);
2121

2222
await agent.aiAssert("there are some search results");

bridge-mode-demo/yaml-new-tab.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ target:
88
tasks:
99
- name: login
1010
flow:
11-
- aiAction: type 'standard_user' in user name input, type 'secret_sauce' in password, click 'Login'
11+
- aiAct: type 'standard_user' in user name input, type 'secret_sauce' in password, click 'Login'
1212

1313
- name: extract items info
1414
flow:

connectivity-test/tests/connectivity.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import OpenAI, { AzureOpenAI } from "openai";
44
import { join } from "node:path";
55
import { localImg2Base64 } from "@midscene/shared/img";
66
import { globalModelConfigManager } from "@midscene/shared/env";
7-
import { AIActionType, callAIWithObjectResponse } from "@midscene/core/ai-model";
7+
import { aiActType, callAIWithObjectResponse } from "@midscene/core/ai-model";
88
import {
99
DefaultAzureCredential,
1010
getBearerTokenProvider,
@@ -95,7 +95,7 @@ describe("Use Midscene wrapped OpenAI SDK", () => {
9595
],
9696
},
9797
],
98-
AIActionType.EXTRACT_DATA,
98+
aiActType.EXTRACT_DATA,
9999
globalModelConfigManager.getModelConfig('default')
100100
);
101101
console.log(result.content.content);

0 commit comments

Comments
 (0)