@midscene/visualizer 1.6.3-beta-20260403070857.0 → 1.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/component/env-config/index.mjs +131 -5
- package/dist/es/component/nav-actions/index.mjs +3 -2
- package/dist/es/component/shiny-text/index.css +3 -3
- package/dist/es/types.mjs +4 -1
- package/dist/es/utils/playground-utils.mjs +2 -2
- package/dist/lib/component/env-config/index.js +130 -4
- package/dist/lib/component/nav-actions/index.js +3 -2
- package/dist/lib/component/shiny-text/index.css +3 -3
- package/dist/lib/types.js +4 -1
- package/dist/lib/utils/playground-utils.js +2 -2
- package/dist/types/component/env-config/index.d.ts +3 -1
- package/dist/types/component/nav-actions/index.d.ts +3 -1
- package/dist/types/types.d.ts +4 -2
- package/package.json +5 -5
|
@@ -1,33 +1,118 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { SettingOutlined } from "@ant-design/icons";
|
|
3
|
-
import { Input, Modal, Tooltip } from "antd";
|
|
3
|
+
import { Alert, Button, Input, Modal, Tooltip, message } from "antd";
|
|
4
4
|
import { useEffect, useRef, useState } from "react";
|
|
5
5
|
import { useEnvConfig } from "../../store/store.mjs";
|
|
6
|
-
function
|
|
6
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
7
|
+
try {
|
|
8
|
+
var info = gen[key](arg);
|
|
9
|
+
var value = info.value;
|
|
10
|
+
} catch (error) {
|
|
11
|
+
reject(error);
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
if (info.done) resolve(value);
|
|
15
|
+
else Promise.resolve(value).then(_next, _throw);
|
|
16
|
+
}
|
|
17
|
+
function _async_to_generator(fn) {
|
|
18
|
+
return function() {
|
|
19
|
+
var self = this, args = arguments;
|
|
20
|
+
return new Promise(function(resolve, reject) {
|
|
21
|
+
var gen = fn.apply(self, args);
|
|
22
|
+
function _next(value) {
|
|
23
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
24
|
+
}
|
|
25
|
+
function _throw(err) {
|
|
26
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
27
|
+
}
|
|
28
|
+
_next(void 0);
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function EnvConfig({ showTooltipWhenEmpty = true, showModelName = true, tooltipPlacement = 'bottom', mode = 'icon', playgroundSDK }) {
|
|
7
33
|
const { config, configString, loadConfig, syncFromStorage } = useEnvConfig();
|
|
8
34
|
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
9
35
|
const [tempConfigString, setTempConfigString] = useState(configString);
|
|
36
|
+
const [connectivityResult, setConnectivityResult] = useState(null);
|
|
37
|
+
const [connectivityLoading, setConnectivityLoading] = useState(false);
|
|
10
38
|
const midsceneModelName = config.MIDSCENE_MODEL_NAME;
|
|
39
|
+
const canRunConnectivityTest = !!(null == playgroundSDK ? void 0 : playgroundSDK.runConnectivityTest) && !!(null == playgroundSDK ? void 0 : playgroundSDK.overrideConfig);
|
|
11
40
|
const componentRef = useRef(null);
|
|
41
|
+
const closeTimerRef = useRef(null);
|
|
42
|
+
const clearCloseTimer = ()=>{
|
|
43
|
+
if (null !== closeTimerRef.current) {
|
|
44
|
+
window.clearTimeout(closeTimerRef.current);
|
|
45
|
+
closeTimerRef.current = null;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
12
48
|
const showModal = (e)=>{
|
|
13
49
|
syncFromStorage();
|
|
50
|
+
clearCloseTimer();
|
|
14
51
|
setIsModalOpen(true);
|
|
15
52
|
e.preventDefault();
|
|
16
53
|
e.stopPropagation();
|
|
17
54
|
};
|
|
18
55
|
const handleOk = ()=>{
|
|
56
|
+
clearCloseTimer();
|
|
19
57
|
setIsModalOpen(false);
|
|
20
58
|
loadConfig(tempConfigString);
|
|
21
59
|
};
|
|
60
|
+
const handleSaveAndRun = ()=>_async_to_generator(function*() {
|
|
61
|
+
const sdk = playgroundSDK;
|
|
62
|
+
if (!(null == sdk ? void 0 : sdk.overrideConfig) || !(null == sdk ? void 0 : sdk.runConnectivityTest)) return;
|
|
63
|
+
try {
|
|
64
|
+
setConnectivityLoading(true);
|
|
65
|
+
setConnectivityResult(null);
|
|
66
|
+
loadConfig(tempConfigString);
|
|
67
|
+
const nextConfig = useEnvConfig.getState().config;
|
|
68
|
+
yield sdk.overrideConfig(nextConfig);
|
|
69
|
+
const result = yield sdk.runConnectivityTest();
|
|
70
|
+
setConnectivityResult(result);
|
|
71
|
+
if (result.passed) {
|
|
72
|
+
message.success('Model verification passed');
|
|
73
|
+
clearCloseTimer();
|
|
74
|
+
closeTimerRef.current = window.setTimeout(()=>{
|
|
75
|
+
setIsModalOpen(false);
|
|
76
|
+
closeTimerRef.current = null;
|
|
77
|
+
}, 2000);
|
|
78
|
+
} else message.warning('Model verification found issues');
|
|
79
|
+
} catch (error) {
|
|
80
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
81
|
+
message.error(`Model verification failed: ${errorMessage}`);
|
|
82
|
+
setConnectivityResult({
|
|
83
|
+
passed: false,
|
|
84
|
+
checks: [
|
|
85
|
+
{
|
|
86
|
+
name: 'text',
|
|
87
|
+
intent: 'default',
|
|
88
|
+
modelName: useEnvConfig.getState().config.MIDSCENE_MODEL_NAME || '',
|
|
89
|
+
modelFamily: void 0,
|
|
90
|
+
passed: false,
|
|
91
|
+
durationMs: 0,
|
|
92
|
+
message: errorMessage
|
|
93
|
+
}
|
|
94
|
+
]
|
|
95
|
+
});
|
|
96
|
+
} finally{
|
|
97
|
+
setConnectivityLoading(false);
|
|
98
|
+
}
|
|
99
|
+
})();
|
|
22
100
|
const handleCancel = ()=>{
|
|
101
|
+
clearCloseTimer();
|
|
23
102
|
setIsModalOpen(false);
|
|
24
103
|
};
|
|
25
104
|
useEffect(()=>{
|
|
26
|
-
if (isModalOpen)
|
|
105
|
+
if (isModalOpen) {
|
|
106
|
+
setTempConfigString(configString);
|
|
107
|
+
setConnectivityResult(null);
|
|
108
|
+
}
|
|
27
109
|
}, [
|
|
28
110
|
isModalOpen,
|
|
29
111
|
configString
|
|
30
112
|
]);
|
|
113
|
+
useEffect(()=>()=>{
|
|
114
|
+
clearCloseTimer();
|
|
115
|
+
}, []);
|
|
31
116
|
return /*#__PURE__*/ jsxs("div", {
|
|
32
117
|
style: {
|
|
33
118
|
display: 'flex',
|
|
@@ -67,7 +152,28 @@ function EnvConfig({ showTooltipWhenEmpty = true, showModelName = true, tooltipP
|
|
|
67
152
|
open: isModalOpen,
|
|
68
153
|
onOk: handleOk,
|
|
69
154
|
onCancel: handleCancel,
|
|
70
|
-
|
|
155
|
+
footer: /*#__PURE__*/ jsxs("div", {
|
|
156
|
+
style: {
|
|
157
|
+
display: 'flex',
|
|
158
|
+
justifyContent: 'flex-end',
|
|
159
|
+
alignItems: 'center',
|
|
160
|
+
gap: 8
|
|
161
|
+
},
|
|
162
|
+
children: [
|
|
163
|
+
canRunConnectivityTest ? /*#__PURE__*/ jsx(Button, {
|
|
164
|
+
type: "primary",
|
|
165
|
+
ghost: true,
|
|
166
|
+
loading: connectivityLoading,
|
|
167
|
+
onClick: handleSaveAndRun,
|
|
168
|
+
children: "Save and Verify Model"
|
|
169
|
+
}, "save-and-run") : null,
|
|
170
|
+
/*#__PURE__*/ jsx(Button, {
|
|
171
|
+
type: "primary",
|
|
172
|
+
onClick: handleOk,
|
|
173
|
+
children: "Save"
|
|
174
|
+
}, "save")
|
|
175
|
+
]
|
|
176
|
+
}),
|
|
71
177
|
style: {
|
|
72
178
|
width: '800px',
|
|
73
179
|
height: '100%',
|
|
@@ -102,7 +208,27 @@ function EnvConfig({ showTooltipWhenEmpty = true, showModelName = true, tooltipP
|
|
|
102
208
|
]
|
|
103
209
|
})
|
|
104
210
|
]
|
|
105
|
-
})
|
|
211
|
+
}),
|
|
212
|
+
connectivityResult ? /*#__PURE__*/ jsx(Alert, {
|
|
213
|
+
type: connectivityResult.passed ? 'success' : 'warning',
|
|
214
|
+
showIcon: true,
|
|
215
|
+
message: connectivityResult.passed ? 'Model verification passed' : 'Model verification failed',
|
|
216
|
+
description: /*#__PURE__*/ jsx("div", {
|
|
217
|
+
children: connectivityResult.checks.map((item)=>/*#__PURE__*/ jsxs("div", {
|
|
218
|
+
children: [
|
|
219
|
+
item.modelName,
|
|
220
|
+
" (",
|
|
221
|
+
item.intent,
|
|
222
|
+
"):",
|
|
223
|
+
' ',
|
|
224
|
+
item.passed ? 'OK.' : `Failed.${item.message ? ` ${item.message}` : ''}`
|
|
225
|
+
]
|
|
226
|
+
}, item.name))
|
|
227
|
+
}),
|
|
228
|
+
style: {
|
|
229
|
+
marginTop: 16
|
|
230
|
+
}
|
|
231
|
+
}) : null
|
|
106
232
|
]
|
|
107
233
|
})
|
|
108
234
|
]
|
|
@@ -3,7 +3,7 @@ import { GithubOutlined, QuestionCircleOutlined } from "@ant-design/icons";
|
|
|
3
3
|
import { Typography } from "antd";
|
|
4
4
|
import { EnvConfig } from "../env-config/index.mjs";
|
|
5
5
|
import "./style.css";
|
|
6
|
-
function NavActions({ showEnvConfig = true, showTooltipWhenEmpty = false, showModelName = false, githubUrl = 'https://github.com/web-infra-dev/midscene', helpUrl = 'https://midscenejs.com/quick-experience.html', className = '' }) {
|
|
6
|
+
function NavActions({ showEnvConfig = true, showTooltipWhenEmpty = false, showModelName = false, githubUrl = 'https://github.com/web-infra-dev/midscene', helpUrl = 'https://midscenejs.com/quick-experience.html', className = '', playgroundSDK }) {
|
|
7
7
|
return /*#__PURE__*/ jsxs("div", {
|
|
8
8
|
className: `nav-actions ${className}`,
|
|
9
9
|
children: [
|
|
@@ -23,7 +23,8 @@ function NavActions({ showEnvConfig = true, showTooltipWhenEmpty = false, showMo
|
|
|
23
23
|
}),
|
|
24
24
|
showEnvConfig && /*#__PURE__*/ jsx(EnvConfig, {
|
|
25
25
|
showTooltipWhenEmpty: showTooltipWhenEmpty,
|
|
26
|
-
showModelName: showModelName
|
|
26
|
+
showModelName: showModelName,
|
|
27
|
+
playgroundSDK: playgroundSDK
|
|
27
28
|
})
|
|
28
29
|
]
|
|
29
30
|
});
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
color: rgba(0, 0, 0, 0);
|
|
3
3
|
letter-spacing: .5px;
|
|
4
4
|
text-shadow: 0 1px 2px rgba(0, 0, 0, .05);
|
|
5
|
-
background-image: linear-gradient(45deg, #2b83ff, #
|
|
5
|
+
background-image: linear-gradient(45deg, #2b83ff, #1d9bf0, #2575fc, #4481eb);
|
|
6
6
|
background-size: 300%;
|
|
7
7
|
-webkit-background-clip: text;
|
|
8
8
|
background-clip: text;
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
.shiny-text.theme-blue {
|
|
17
|
-
background-image: linear-gradient(45deg, #2b83ff, #
|
|
17
|
+
background-image: linear-gradient(45deg, #2b83ff, #1d9bf0, #2575fc, #4481eb);
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
.shiny-text.theme-purple {
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
color: rgba(0, 0, 0, 0);
|
|
61
61
|
-webkit-text-fill-color: transparent;
|
|
62
62
|
text-shadow: none;
|
|
63
|
-
background-image: linear-gradient(45deg, #
|
|
63
|
+
background-image: linear-gradient(45deg, #7dd3fc, #60a5fa, #38bdf8, #60a5fa);
|
|
64
64
|
background-size: 300%;
|
|
65
65
|
-webkit-background-clip: text;
|
|
66
66
|
background-clip: text;
|
package/dist/es/types.mjs
CHANGED
|
@@ -63,7 +63,10 @@ const extractDefaultValue = (field)=>{
|
|
|
63
63
|
var _currentField__def;
|
|
64
64
|
let currentField = field;
|
|
65
65
|
while(null == (_currentField__def = currentField._def) ? void 0 : _currentField__def.innerType){
|
|
66
|
-
if (currentField._def.typeName === VALIDATION_CONSTANTS.ZOD_TYPES.DEFAULT
|
|
66
|
+
if (currentField._def.typeName === VALIDATION_CONSTANTS.ZOD_TYPES.DEFAULT) {
|
|
67
|
+
if ('function' == typeof currentField._def.defaultValue) return currentField._def.defaultValue();
|
|
68
|
+
if (void 0 !== currentField._def._serializedDefaultValue) return currentField._def._serializedDefaultValue;
|
|
69
|
+
}
|
|
67
70
|
currentField = currentField._def.innerType;
|
|
68
71
|
}
|
|
69
72
|
};
|
|
@@ -6,8 +6,8 @@ const actionNameForType = (type)=>{
|
|
|
6
6
|
if (typeWithoutAi.startsWith('IOS')) return typeWithoutAi.substring(3).replace(/([A-Z])/g, ' $1').replace(/^/, 'IOS').trim();
|
|
7
7
|
const fullName = typeWithoutAi.replace(/([A-Z])/g, ' $1').trim();
|
|
8
8
|
const words = fullName.split(' ');
|
|
9
|
-
|
|
10
|
-
return
|
|
9
|
+
const result = words.length > 3 ? words.slice(-3).join(' ') : fullName;
|
|
10
|
+
return result.replace(/\b\w/g, (c)=>c.toUpperCase());
|
|
11
11
|
};
|
|
12
12
|
const staticAgentFromContext = (context)=>{
|
|
13
13
|
const page = new StaticPage(context);
|
|
@@ -31,31 +31,116 @@ const icons_namespaceObject = require("@ant-design/icons");
|
|
|
31
31
|
const external_antd_namespaceObject = require("antd");
|
|
32
32
|
const external_react_namespaceObject = require("react");
|
|
33
33
|
const store_js_namespaceObject = require("../../store/store.js");
|
|
34
|
-
function
|
|
34
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
35
|
+
try {
|
|
36
|
+
var info = gen[key](arg);
|
|
37
|
+
var value = info.value;
|
|
38
|
+
} catch (error) {
|
|
39
|
+
reject(error);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
if (info.done) resolve(value);
|
|
43
|
+
else Promise.resolve(value).then(_next, _throw);
|
|
44
|
+
}
|
|
45
|
+
function _async_to_generator(fn) {
|
|
46
|
+
return function() {
|
|
47
|
+
var self = this, args = arguments;
|
|
48
|
+
return new Promise(function(resolve, reject) {
|
|
49
|
+
var gen = fn.apply(self, args);
|
|
50
|
+
function _next(value) {
|
|
51
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
52
|
+
}
|
|
53
|
+
function _throw(err) {
|
|
54
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
55
|
+
}
|
|
56
|
+
_next(void 0);
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
function EnvConfig({ showTooltipWhenEmpty = true, showModelName = true, tooltipPlacement = 'bottom', mode = 'icon', playgroundSDK }) {
|
|
35
61
|
const { config, configString, loadConfig, syncFromStorage } = (0, store_js_namespaceObject.useEnvConfig)();
|
|
36
62
|
const [isModalOpen, setIsModalOpen] = (0, external_react_namespaceObject.useState)(false);
|
|
37
63
|
const [tempConfigString, setTempConfigString] = (0, external_react_namespaceObject.useState)(configString);
|
|
64
|
+
const [connectivityResult, setConnectivityResult] = (0, external_react_namespaceObject.useState)(null);
|
|
65
|
+
const [connectivityLoading, setConnectivityLoading] = (0, external_react_namespaceObject.useState)(false);
|
|
38
66
|
const midsceneModelName = config.MIDSCENE_MODEL_NAME;
|
|
67
|
+
const canRunConnectivityTest = !!(null == playgroundSDK ? void 0 : playgroundSDK.runConnectivityTest) && !!(null == playgroundSDK ? void 0 : playgroundSDK.overrideConfig);
|
|
39
68
|
const componentRef = (0, external_react_namespaceObject.useRef)(null);
|
|
69
|
+
const closeTimerRef = (0, external_react_namespaceObject.useRef)(null);
|
|
70
|
+
const clearCloseTimer = ()=>{
|
|
71
|
+
if (null !== closeTimerRef.current) {
|
|
72
|
+
window.clearTimeout(closeTimerRef.current);
|
|
73
|
+
closeTimerRef.current = null;
|
|
74
|
+
}
|
|
75
|
+
};
|
|
40
76
|
const showModal = (e)=>{
|
|
41
77
|
syncFromStorage();
|
|
78
|
+
clearCloseTimer();
|
|
42
79
|
setIsModalOpen(true);
|
|
43
80
|
e.preventDefault();
|
|
44
81
|
e.stopPropagation();
|
|
45
82
|
};
|
|
46
83
|
const handleOk = ()=>{
|
|
84
|
+
clearCloseTimer();
|
|
47
85
|
setIsModalOpen(false);
|
|
48
86
|
loadConfig(tempConfigString);
|
|
49
87
|
};
|
|
88
|
+
const handleSaveAndRun = ()=>_async_to_generator(function*() {
|
|
89
|
+
const sdk = playgroundSDK;
|
|
90
|
+
if (!(null == sdk ? void 0 : sdk.overrideConfig) || !(null == sdk ? void 0 : sdk.runConnectivityTest)) return;
|
|
91
|
+
try {
|
|
92
|
+
setConnectivityLoading(true);
|
|
93
|
+
setConnectivityResult(null);
|
|
94
|
+
loadConfig(tempConfigString);
|
|
95
|
+
const nextConfig = store_js_namespaceObject.useEnvConfig.getState().config;
|
|
96
|
+
yield sdk.overrideConfig(nextConfig);
|
|
97
|
+
const result = yield sdk.runConnectivityTest();
|
|
98
|
+
setConnectivityResult(result);
|
|
99
|
+
if (result.passed) {
|
|
100
|
+
external_antd_namespaceObject.message.success('Model verification passed');
|
|
101
|
+
clearCloseTimer();
|
|
102
|
+
closeTimerRef.current = window.setTimeout(()=>{
|
|
103
|
+
setIsModalOpen(false);
|
|
104
|
+
closeTimerRef.current = null;
|
|
105
|
+
}, 2000);
|
|
106
|
+
} else external_antd_namespaceObject.message.warning('Model verification found issues');
|
|
107
|
+
} catch (error) {
|
|
108
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
109
|
+
external_antd_namespaceObject.message.error(`Model verification failed: ${errorMessage}`);
|
|
110
|
+
setConnectivityResult({
|
|
111
|
+
passed: false,
|
|
112
|
+
checks: [
|
|
113
|
+
{
|
|
114
|
+
name: 'text',
|
|
115
|
+
intent: 'default',
|
|
116
|
+
modelName: store_js_namespaceObject.useEnvConfig.getState().config.MIDSCENE_MODEL_NAME || '',
|
|
117
|
+
modelFamily: void 0,
|
|
118
|
+
passed: false,
|
|
119
|
+
durationMs: 0,
|
|
120
|
+
message: errorMessage
|
|
121
|
+
}
|
|
122
|
+
]
|
|
123
|
+
});
|
|
124
|
+
} finally{
|
|
125
|
+
setConnectivityLoading(false);
|
|
126
|
+
}
|
|
127
|
+
})();
|
|
50
128
|
const handleCancel = ()=>{
|
|
129
|
+
clearCloseTimer();
|
|
51
130
|
setIsModalOpen(false);
|
|
52
131
|
};
|
|
53
132
|
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
54
|
-
if (isModalOpen)
|
|
133
|
+
if (isModalOpen) {
|
|
134
|
+
setTempConfigString(configString);
|
|
135
|
+
setConnectivityResult(null);
|
|
136
|
+
}
|
|
55
137
|
}, [
|
|
56
138
|
isModalOpen,
|
|
57
139
|
configString
|
|
58
140
|
]);
|
|
141
|
+
(0, external_react_namespaceObject.useEffect)(()=>()=>{
|
|
142
|
+
clearCloseTimer();
|
|
143
|
+
}, []);
|
|
59
144
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
60
145
|
style: {
|
|
61
146
|
display: 'flex',
|
|
@@ -95,7 +180,28 @@ function EnvConfig({ showTooltipWhenEmpty = true, showModelName = true, tooltipP
|
|
|
95
180
|
open: isModalOpen,
|
|
96
181
|
onOk: handleOk,
|
|
97
182
|
onCancel: handleCancel,
|
|
98
|
-
|
|
183
|
+
footer: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
184
|
+
style: {
|
|
185
|
+
display: 'flex',
|
|
186
|
+
justifyContent: 'flex-end',
|
|
187
|
+
alignItems: 'center',
|
|
188
|
+
gap: 8
|
|
189
|
+
},
|
|
190
|
+
children: [
|
|
191
|
+
canRunConnectivityTest ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Button, {
|
|
192
|
+
type: "primary",
|
|
193
|
+
ghost: true,
|
|
194
|
+
loading: connectivityLoading,
|
|
195
|
+
onClick: handleSaveAndRun,
|
|
196
|
+
children: "Save and Verify Model"
|
|
197
|
+
}, "save-and-run") : null,
|
|
198
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Button, {
|
|
199
|
+
type: "primary",
|
|
200
|
+
onClick: handleOk,
|
|
201
|
+
children: "Save"
|
|
202
|
+
}, "save")
|
|
203
|
+
]
|
|
204
|
+
}),
|
|
99
205
|
style: {
|
|
100
206
|
width: '800px',
|
|
101
207
|
height: '100%',
|
|
@@ -130,7 +236,27 @@ function EnvConfig({ showTooltipWhenEmpty = true, showModelName = true, tooltipP
|
|
|
130
236
|
]
|
|
131
237
|
})
|
|
132
238
|
]
|
|
133
|
-
})
|
|
239
|
+
}),
|
|
240
|
+
connectivityResult ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Alert, {
|
|
241
|
+
type: connectivityResult.passed ? 'success' : 'warning',
|
|
242
|
+
showIcon: true,
|
|
243
|
+
message: connectivityResult.passed ? 'Model verification passed' : 'Model verification failed',
|
|
244
|
+
description: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
245
|
+
children: connectivityResult.checks.map((item)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
246
|
+
children: [
|
|
247
|
+
item.modelName,
|
|
248
|
+
" (",
|
|
249
|
+
item.intent,
|
|
250
|
+
"):",
|
|
251
|
+
' ',
|
|
252
|
+
item.passed ? 'OK.' : `Failed.${item.message ? ` ${item.message}` : ''}`
|
|
253
|
+
]
|
|
254
|
+
}, item.name))
|
|
255
|
+
}),
|
|
256
|
+
style: {
|
|
257
|
+
marginTop: 16
|
|
258
|
+
}
|
|
259
|
+
}) : null
|
|
134
260
|
]
|
|
135
261
|
})
|
|
136
262
|
]
|
|
@@ -31,7 +31,7 @@ const icons_namespaceObject = require("@ant-design/icons");
|
|
|
31
31
|
const external_antd_namespaceObject = require("antd");
|
|
32
32
|
const index_js_namespaceObject = require("../env-config/index.js");
|
|
33
33
|
require("./style.css");
|
|
34
|
-
function NavActions({ showEnvConfig = true, showTooltipWhenEmpty = false, showModelName = false, githubUrl = 'https://github.com/web-infra-dev/midscene', helpUrl = 'https://midscenejs.com/quick-experience.html', className = '' }) {
|
|
34
|
+
function NavActions({ showEnvConfig = true, showTooltipWhenEmpty = false, showModelName = false, githubUrl = 'https://github.com/web-infra-dev/midscene', helpUrl = 'https://midscenejs.com/quick-experience.html', className = '', playgroundSDK }) {
|
|
35
35
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
36
36
|
className: `nav-actions ${className}`,
|
|
37
37
|
children: [
|
|
@@ -51,7 +51,8 @@ function NavActions({ showEnvConfig = true, showTooltipWhenEmpty = false, showMo
|
|
|
51
51
|
}),
|
|
52
52
|
showEnvConfig && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(index_js_namespaceObject.EnvConfig, {
|
|
53
53
|
showTooltipWhenEmpty: showTooltipWhenEmpty,
|
|
54
|
-
showModelName: showModelName
|
|
54
|
+
showModelName: showModelName,
|
|
55
|
+
playgroundSDK: playgroundSDK
|
|
55
56
|
})
|
|
56
57
|
]
|
|
57
58
|
});
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
color: rgba(0, 0, 0, 0);
|
|
3
3
|
letter-spacing: .5px;
|
|
4
4
|
text-shadow: 0 1px 2px rgba(0, 0, 0, .05);
|
|
5
|
-
background-image: linear-gradient(45deg, #2b83ff, #
|
|
5
|
+
background-image: linear-gradient(45deg, #2b83ff, #1d9bf0, #2575fc, #4481eb);
|
|
6
6
|
background-size: 300%;
|
|
7
7
|
-webkit-background-clip: text;
|
|
8
8
|
background-clip: text;
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
.shiny-text.theme-blue {
|
|
17
|
-
background-image: linear-gradient(45deg, #2b83ff, #
|
|
17
|
+
background-image: linear-gradient(45deg, #2b83ff, #1d9bf0, #2575fc, #4481eb);
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
.shiny-text.theme-purple {
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
color: rgba(0, 0, 0, 0);
|
|
61
61
|
-webkit-text-fill-color: transparent;
|
|
62
62
|
text-shadow: none;
|
|
63
|
-
background-image: linear-gradient(45deg, #
|
|
63
|
+
background-image: linear-gradient(45deg, #7dd3fc, #60a5fa, #38bdf8, #60a5fa);
|
|
64
64
|
background-size: 300%;
|
|
65
65
|
-webkit-background-clip: text;
|
|
66
66
|
background-clip: text;
|
package/dist/lib/types.js
CHANGED
|
@@ -95,7 +95,10 @@ const extractDefaultValue = (field)=>{
|
|
|
95
95
|
var _currentField__def;
|
|
96
96
|
let currentField = field;
|
|
97
97
|
while(null == (_currentField__def = currentField._def) ? void 0 : _currentField__def.innerType){
|
|
98
|
-
if (currentField._def.typeName === VALIDATION_CONSTANTS.ZOD_TYPES.DEFAULT
|
|
98
|
+
if (currentField._def.typeName === VALIDATION_CONSTANTS.ZOD_TYPES.DEFAULT) {
|
|
99
|
+
if ('function' == typeof currentField._def.defaultValue) return currentField._def.defaultValue();
|
|
100
|
+
if (void 0 !== currentField._def._serializedDefaultValue) return currentField._def._serializedDefaultValue;
|
|
101
|
+
}
|
|
99
102
|
currentField = currentField._def.innerType;
|
|
100
103
|
}
|
|
101
104
|
};
|
|
@@ -37,8 +37,8 @@ const actionNameForType = (type)=>{
|
|
|
37
37
|
if (typeWithoutAi.startsWith('IOS')) return typeWithoutAi.substring(3).replace(/([A-Z])/g, ' $1').replace(/^/, 'IOS').trim();
|
|
38
38
|
const fullName = typeWithoutAi.replace(/([A-Z])/g, ' $1').trim();
|
|
39
39
|
const words = fullName.split(' ');
|
|
40
|
-
|
|
41
|
-
return
|
|
40
|
+
const result = words.length > 3 ? words.slice(-3).join(' ') : fullName;
|
|
41
|
+
return result.replace(/\b\w/g, (c)=>c.toUpperCase());
|
|
42
42
|
};
|
|
43
43
|
const staticAgentFromContext = (context)=>{
|
|
44
44
|
const page = new static_namespaceObject.StaticPage(context);
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import type { PlaygroundSDKLike } from '../../types';
|
|
2
|
+
export declare function EnvConfig({ showTooltipWhenEmpty, showModelName, tooltipPlacement, mode, playgroundSDK, }: {
|
|
2
3
|
showTooltipWhenEmpty?: boolean;
|
|
3
4
|
showModelName?: boolean;
|
|
4
5
|
tooltipPlacement?: 'bottom' | 'top';
|
|
5
6
|
mode?: 'icon' | 'text';
|
|
7
|
+
playgroundSDK?: PlaygroundSDKLike | null;
|
|
6
8
|
}): import("react").JSX.Element;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { PlaygroundSDKLike } from '../../types';
|
|
1
2
|
import './style.less';
|
|
2
3
|
export interface NavActionsProps {
|
|
3
4
|
showEnvConfig?: boolean;
|
|
@@ -6,5 +7,6 @@ export interface NavActionsProps {
|
|
|
6
7
|
githubUrl?: string;
|
|
7
8
|
helpUrl?: string;
|
|
8
9
|
className?: string;
|
|
10
|
+
playgroundSDK?: PlaygroundSDKLike | null;
|
|
9
11
|
}
|
|
10
|
-
export declare function NavActions({ showEnvConfig, showTooltipWhenEmpty, showModelName, githubUrl, helpUrl, className, }: NavActionsProps): import("react").JSX.Element;
|
|
12
|
+
export declare function NavActions({ showEnvConfig, showTooltipWhenEmpty, showModelName, githubUrl, helpUrl, className, playgroundSDK, }: NavActionsProps): import("react").JSX.Element;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import type { DeviceAction, ModelBrief, UIContext } from '@midscene/core';
|
|
1
|
+
import type { ConnectivityTestResult, DeviceAction, ModelBrief, UIContext } from '@midscene/core';
|
|
2
2
|
import type { ComponentType } from 'react';
|
|
3
3
|
export interface ZodType {
|
|
4
4
|
_def?: {
|
|
5
5
|
typeName: 'ZodOptional' | 'ZodDefault' | 'ZodNullable' | 'ZodObject' | 'ZodEnum' | 'ZodNumber' | 'ZodString' | 'ZodBoolean';
|
|
6
6
|
innerType?: ZodType;
|
|
7
7
|
defaultValue?: () => unknown;
|
|
8
|
-
|
|
8
|
+
_serializedDefaultValue?: unknown;
|
|
9
|
+
shape?: (() => Record<string, ZodType>) | Record<string, ZodType>;
|
|
9
10
|
values?: string[];
|
|
10
11
|
description?: string;
|
|
11
12
|
};
|
|
@@ -120,6 +121,7 @@ export interface PlaygroundSDKLike {
|
|
|
120
121
|
reportHTML: string | null;
|
|
121
122
|
}>;
|
|
122
123
|
overrideConfig?(config: any): Promise<void>;
|
|
124
|
+
runConnectivityTest?(): Promise<ConnectivityTestResult>;
|
|
123
125
|
checkStatus?(): Promise<boolean>;
|
|
124
126
|
getServiceMode?(): 'In-Browser-Extension' | 'Server';
|
|
125
127
|
getRuntimeInfo?(): Promise<PlaygroundRuntimeInfo | null>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midscene/visualizer",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.4",
|
|
4
4
|
"repository": "https://github.com/web-infra-dev/midscene",
|
|
5
5
|
"homepage": "https://midscenejs.com/",
|
|
6
6
|
"types": "./dist/types/index.d.ts",
|
|
@@ -58,10 +58,10 @@
|
|
|
58
58
|
"antd": "^5.21.6",
|
|
59
59
|
"buffer": "6.0.3",
|
|
60
60
|
"dayjs": "^1.11.11",
|
|
61
|
-
"@midscene/core": "1.6.
|
|
62
|
-
"@midscene/
|
|
63
|
-
"@midscene/
|
|
64
|
-
"@midscene/web": "1.6.
|
|
61
|
+
"@midscene/core": "1.6.4",
|
|
62
|
+
"@midscene/playground": "1.6.4",
|
|
63
|
+
"@midscene/shared": "1.6.4",
|
|
64
|
+
"@midscene/web": "1.6.4"
|
|
65
65
|
},
|
|
66
66
|
"license": "MIT",
|
|
67
67
|
"scripts": {
|