Skip to content

Commit

Permalink
chore: update prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
zhoushaw committed Jan 2, 2025
1 parent a4c73e7 commit c55e447
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
2 changes: 0 additions & 2 deletions packages/midscene/src/ai-model/openai/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import {
MIDSCENE_API_TYPE,
MIDSCENE_AZURE_OPENAI_INIT_CONFIG_JSON,
MIDSCENE_AZURE_OPENAI_SCOPE,
MIDSCENE_COOKIE,
MIDSCENE_DANGEROUSLY_PRINT_ALL_CONFIG,
MIDSCENE_DEBUG_AI_PROFILE,
MIDSCENE_LANGSMITH_DEBUG,
Expand Down Expand Up @@ -131,7 +130,6 @@ async function createChatClient({
...extraConfig,
defaultHeaders: {
...(extraConfig?.defaultHeaders || {}),
Cookie: getAIConfig(MIDSCENE_COOKIE) || '',
[MIDSCENE_API_TYPE]: AIActionTypeValue.toString(),
},
dangerouslyAllowBrowser: true,
Expand Down
14 changes: 7 additions & 7 deletions packages/midscene/src/ai-model/prompt/planning.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,19 +150,19 @@ By viewing the page screenshot and description, you should consider this and out
{{
"actions":[
{{
"thought": "Click the language switch button to open the language options.",
"type": "Tap",
"thought": "Click the language switch button to open the language options.",
"param": null,
"locate": {sample},
}},
{{
"thought": "Wait for 1 second to ensure the language options are displayed.",
"type": "Sleep",
"thought": "Wait for 1 second to ensure the language options are displayed.",
"param": {{ "timeMs": 1000 }},
}},
{{
"thought": "Locate the 'English' option in the language menu.",
"type": "Tap",
"thought": "Locate the 'English' option in the language menu.",
"param": null,
"locate": null
}},
Expand All @@ -184,8 +184,8 @@ If the user says "If there is a popup, close it", you should consider this and o
{{
"actions": [{{
"thought": "There is no popup on the page",
"type": "FalsyConditionStatement",
"thought": "There is no popup on the page",
"param": null
}}
],
Expand All @@ -209,8 +209,8 @@ When the user ask to "Wait 4s", you should consider this:
{{
"actions": [
{{
"thought": "Wait for 4 seconds",
"type": "Sleep",
"thought": "Wait for 4 seconds",
"param": {{ "timeMs": 4000 }},
}},
],
Expand All @@ -225,16 +225,16 @@ Wrong output:
{{
"actions":[
{{
"thought": "Click the language switch button to open the language options.",
"type": "Tap",
"thought": "Click the language switch button to open the language options.",
"param": null,
"locate": {{
{sample}, // WRONG:prompt is missing
}}
}},
{{
"thought": "Click the English option",
"type": "Tap",
"thought": "Click the English option",
"param": null,
"locate": null, // This means the 'English' option is not shown in the screenshot, the task cannot be accomplished
}}
Expand Down
5 changes: 1 addition & 4 deletions packages/midscene/src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ export const MIDSCENE_MODEL_TEXT_ONLY = 'MIDSCENE_MODEL_TEXT_ONLY';

export const MIDSCENE_CACHE = 'MIDSCENE_CACHE';
export const MATCH_BY_POSITION = 'MATCH_BY_POSITION';
export const MIDSCENE_COOKIE = 'MIDSCENE_COOKIE';
export const MIDSCENE_API_TYPE = 'midscene-ai-type';
export const MIDSCENE_API_TYPE = 'MIDSCENE_API_TYPE';
export const MIDSCENE_REPORT_TAG_NAME = 'MIDSCENE_REPORT_TAG_NAME';

export const MIDSCENE_USE_AZURE_OPENAI = 'MIDSCENE_USE_AZURE_OPENAI';
Expand Down Expand Up @@ -63,8 +62,6 @@ const allConfigFromEnv = () => {
process.env[MIDSCENE_USE_AZURE_OPENAI] || undefined,
[MIDSCENE_AZURE_OPENAI_SCOPE]:
process.env[MIDSCENE_AZURE_OPENAI_SCOPE] || undefined,
[MIDSCENE_COOKIE]: process.env[MIDSCENE_COOKIE] || undefined,
[MIDSCENE_API_TYPE]: process.env[MIDSCENE_API_TYPE] || undefined,
[MIDSCENE_AZURE_OPENAI_INIT_CONFIG_JSON]:
process.env[MIDSCENE_AZURE_OPENAI_INIT_CONFIG_JSON] || undefined,
[MIDSCENE_USE_ANTHROPIC_SDK]:
Expand Down

0 comments on commit c55e447

Please sign in to comment.