Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parse json error: ```json #192

Open
wenmhan opened this issue Dec 19, 2024 · 1 comment
Open

parse json error: ```json #192

wenmhan opened this issue Dec 19, 2024 · 1 comment

Comments

@wenmhan
Copy link

wenmhan commented Dec 19, 2024

使用 qwen 配置为:

OPENAI_API_KEY sk-xxxxxxxxxxx
OPENAI_BASE_URL https://dashscope.aliyuncs.com/compatible-mode/v1
MIDSCENE_MODEL_NAME qwen-vl-max-lates

运行 plawright-demo e2e 文件夹中的 “todo-mvc-zh.spec.ts” 文件,即:

import { expect } from "@playwright/test";
import { test } from "./fixture";

test.beforeEach(async ({ page }) => {
await page.goto("https://todomvc.com/examples/react/dist/");
});

test("ai todo - Chinese Prompt", async ({ ai, aiQuery, aiAssert }) => {
await ai("在任务框 input 输入 今天学习 JS,按回车键");
await ai("在任务框 input 输入 明天学习 Rust,按回车键");
await ai("在任务框 input 输入后天学习 AI,按回车键");
await ai("将鼠标移动到任务列表中的第二项,点击第二项任务右边的删除按钮");
await ai("点击第二条任务左边的勾选按钮");
await ai("点击任务列表下面的 completed 状态按钮");

const list = await aiQuery("string[], 完整的任务列表");
expect(list.length).toEqual(1);

await aiAssert('页面下方有一个区域显示有 "1 item left"');
});

-------------------------- 运行 指令为 : playwright test ./e2e/todo-mvc-zh.spec.ts --config=playwright.config.ts

报错信息如下:

Image

{
"status": "failed",
"type": "Planning",
"locate": null,
"param": {
"userPrompt": "在任务框 input 输入 今天学习 JS,按回车键"
},
"timing": {
"start": 1734587525761,
"end": 1734587528641,
"cost": 2880
},
"recorder": [
{
"type": "screenshot",
"ts": 1734587525761,
"screenshot": "data:image...",
"timing": "before planning"
}
],
"pageContext": {
"content": [
{
"content": "todos",
"rect": {
"left": 542,
"top": 21,
"width": 196,
"height": 89,
"zoom": 1
},
"center": [
640,
65
],
"page": {
"underlyingPage": {
"_type": "Page",
"_guid": "page@461cab55131ed2cd61d03db1165eb8ba"
},
"pageType": "playwright",
"viewportSize": {
"width": 1280,
"height": 720,
"dpr": 1
}
},
"locator": "",
"id": "770c90dee52b90bf",
"attributes": {
"nodeType": "TEXT Node",
"htmlTagName": "

"
},
"indexId": 0
},
{
"content": "What needs to be done?",
"rect": {
"left": 365,
"top": 130,
"width": 550,
"height": 65,
"zoom": 1
},
"center": [
640,
162
],
"page": {
"underlyingPage": {
"_type": "Page",
"_guid": "page@461cab55131ed2cd61d03db1165eb8ba"
},
"pageType": "playwright",
"viewportSize": {
"width": 1280,
"height": 720,
"dpr": 1
}
},
"locator": "[_midscene_retrieve_task_id='fbc2d0029b7a9037']",
"id": "fbc2d0029b7a9037",
"attributes": {
"class": ".new-todo",
"id": "todo-input",
"type": "text",
"data-testid": "text-input",
"placeholder": "What needs to be done?",
"style": "caret-color: transparent !important;",
"htmlTagName": "",
"nodeType": "FORM_ITEM Node"
},
"indexId": 1
},
{
"content": "New Todo Input",
"rect": {
"left": 914,
"top": 130,
"width": 97,
"height": 16,
"zoom": 1
},
"center": [
962,
138
],
"page": {
"underlyingPage": {
"_type": "Page",
"_guid": "page@461cab55131ed2cd61d03db1165eb8ba"
},
"pageType": "playwright",
"viewportSize": {
"width": 1280,
"height": 720,
"dpr": 1
}
},
"locator": "",
"id": "a894cd599156c8b0",
"attributes": {
"nodeType": "TEXT Node",
"htmlTagName": ""
},
"indexId": 2
},
{
"content": "Double-click to edit a todo",
"rect": {
"left": 577,
"top": 260,
"width": 127,
"height": 12,
"zoom": 1
},
"center": [
640,
266
],
"page": {
"underlyingPage": {
"_type": "Page",
"_guid": "page@461cab55131ed2cd61d03db1165eb8ba"
},
"pageType": "playwright",
"viewportSize": {
"width": 1280,
"height": 720,
"dpr": 1
}
},
"locator": "",
"id": "9149d73abcede103",
"attributes": {
"nodeType": "TEXT Node",
"htmlTagName": "

"
},
"indexId": 3
},
{
"content": "Created by the TodoMVC Team",
"rect": {
"left": 563,
"top": 282,
"width": 153,
"height": 12,
"zoom": 1
},
"center": [
639,
288
],
"page": {
"underlyingPage": {
"_type": "Page",
"_guid": "page@461cab55131ed2cd61d03db1165eb8ba"
},
"pageType": "playwright",
"viewportSize": {
"width": 1280,
"height": 720,
"dpr": 1
}
},
"locator": "",
"id": "99259898ea27271a",
"attributes": {
"nodeType": "TEXT Node",
"htmlTagName": "

"
},
"indexId": 4
},
{
"content": "Part of",
"rect": {
"left": 598,
"top": 304,
"width": 35,
"height": 12,
"zoom": 1
},
"center": [
615,
310
],
"page": {
"underlyingPage": {
"_type": "Page",
"_guid": "page@461cab55131ed2cd61d03db1165eb8ba"
},
"pageType": "playwright",
"viewportSize": {
"width": 1280,
"height": 720,
"dpr": 1
}
},
"locator": "",
"id": "bc22e68185487412",
"attributes": {
"nodeType": "TEXT Node",
"htmlTagName": "

"
},
"indexId": 5
},
{
"content": "TodoMVC",
"rect": {
"left": 634,
"top": 304,
"width": 48,
"height": 12,
"zoom": 1
},
"center": [
658,
310
],
"page": {
"underlyingPage": {
"_type": "Page",
"_guid": "page@461cab55131ed2cd61d03db1165eb8ba"
},
"pageType": "playwright",
"viewportSize": {
"width": 1280,
"height": 720,
"dpr": 1
}
},
"locator": "",
"id": "c43298f119e499d2",
"attributes": {
"nodeType": "TEXT Node",
"htmlTagName": ""
},
"indexId": 6
}
],
"size": {
"width": 1280,
"height": 720,
"dpr": 1
},
"screenshotBase64": "data:image...",
"screenshotBase64WithElementMarker": "data:image...",
"url": "https://todomvc.com/examples/react/dist/"
},
"error": "parse json error: json", "errorStack": "Error: parse json error: json\n at callToGetJSONObject (D:\Daily File\code\midscene-example\playwright-demo\node_modules\@midscene\core\dist\lib\index.js:5542:11)\n at processTicksAndRejections (node:internal/process/task_queues:95:5)\n at callAiFn (D:\Daily File\code\midscene-example\playwright-demo\node_modules\@midscene\core\dist\lib\index.js:5565:32)\n at plan (D:\Daily File\code\midscene-example\playwright-demo\node_modules\@midscene\core\dist\lib\index.js:5856:30)\n at Object.executor (D:\Daily File\code\midscene-example\playwright-demo\node_modules\@midscene\web\dist\lib\index.js:1342:24)\n at Executor.flush (D:\Daily File\code\midscene-example\playwright-demo\node_modules\@midscene\core\dist\lib\index.js:4607:25)\n at PageTaskExecutor.action (D:\Daily File\code\midscene-example\playwright-demo\node_modules\@midscene\web\dist\lib\index.js:1418:26)\n at PageAgent.aiAction (D:\Daily File\code\midscene-example\playwright-demo\node_modules\@midscene\web\dist\lib\index.js:1786:26)\n at D:\Daily File\code\midscene-example\playwright-demo\node_modules\@midscene\web\dist\lib\index.js:1917:32\n at D:\Daily File\code\midscene-example\playwright-demo\node_modules\@playwright\test\node_modules\playwright\lib\common\testType.js:236:24\n at TestTypeImpl._step (D:\Daily File\code\midscene-example\playwright-demo\node_modules\@playwright\test\node_modules\playwright\lib\common\testType.js:234:12)"
}

@yuyutaotao
Copy link
Collaborator

试了一下,感觉这个模型挺稳的才对。npm 依赖更新到最新版再看看?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants