@midscene/visualizer 0.27.1-beta-20250822053848.0 → 0.27.1-beta-20250822103738.0
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/playground/FormField.mjs +122 -0
- package/dist/es/component/playground/HistorySelector.mjs +2 -3
- package/dist/es/component/playground/PromptInput.mjs +339 -58
- package/dist/es/component/playground/index.css +160 -2
- package/dist/es/component/playground/playground-constants.mjs +69 -1
- package/dist/es/component/playground/playground-utils.mjs +43 -1
- package/dist/es/component/playground/types.mjs +50 -0
- package/dist/es/component/replay-scripts.mjs +18 -9
- package/dist/es/component/store/history.mjs +42 -8
- package/dist/lib/component/playground/FormField.js +165 -0
- package/dist/lib/component/playground/HistorySelector.js +2 -3
- package/dist/lib/component/playground/PromptInput.js +345 -54
- package/dist/lib/component/playground/index.css +160 -2
- package/dist/lib/component/playground/playground-constants.js +76 -2
- package/dist/lib/component/playground/playground-utils.js +45 -0
- package/dist/lib/component/playground/types.js +96 -0
- package/dist/lib/component/replay-scripts.js +28 -19
- package/dist/lib/component/store/history.js +42 -8
- package/dist/types/component/playground/FormField.d.ts +15 -0
- package/dist/types/component/playground/HistorySelector.d.ts +2 -0
- package/dist/types/component/playground/PromptInput.d.ts +3 -1
- package/dist/types/component/playground/playground-constants.d.ts +63 -0
- package/dist/types/component/playground/playground-types.d.ts +1 -1
- package/dist/types/component/playground/playground-utils.d.ts +1 -0
- package/dist/types/component/playground/types.d.ts +58 -0
- package/dist/types/component/store/history.d.ts +9 -4
- package/package.json +4 -4
|
@@ -48,10 +48,9 @@ const external_store_history_js_namespaceObject = require("../store/history.js")
|
|
|
48
48
|
require("./index.css");
|
|
49
49
|
const { Text } = external_antd_namespaceObject.Typography;
|
|
50
50
|
const HistorySelector = (param)=>{
|
|
51
|
-
let { onSelect } = param;
|
|
51
|
+
let { onSelect, history, currentType } = param;
|
|
52
52
|
const [isModalOpen, setIsModalOpen] = (0, external_react_namespaceObject.useState)(false);
|
|
53
53
|
const [searchText, setSearchText] = (0, external_react_namespaceObject.useState)('');
|
|
54
|
-
const history = (0, external_store_history_js_namespaceObject.useHistoryStore)((state)=>state.history);
|
|
55
54
|
const clearHistory = (0, external_store_history_js_namespaceObject.useHistoryStore)((state)=>state.clearHistory);
|
|
56
55
|
const groupedHistory = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
57
56
|
const now = Date.now();
|
|
@@ -73,7 +72,7 @@ const HistorySelector = (param)=>{
|
|
|
73
72
|
setIsModalOpen(false);
|
|
74
73
|
};
|
|
75
74
|
const handleClearHistory = ()=>{
|
|
76
|
-
clearHistory();
|
|
75
|
+
clearHistory(currentType);
|
|
77
76
|
setSearchText('');
|
|
78
77
|
setIsModalOpen(false);
|
|
79
78
|
};
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.n = (module)=>{
|
|
5
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
+
__webpack_require__.d(getter, {
|
|
7
|
+
a: getter
|
|
8
|
+
});
|
|
9
|
+
return getter;
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
3
12
|
(()=>{
|
|
4
13
|
__webpack_require__.d = (exports1, definition)=>{
|
|
5
14
|
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
@@ -30,40 +39,105 @@ const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
|
30
39
|
const icons_namespaceObject = require("@ant-design/icons");
|
|
31
40
|
const external_antd_namespaceObject = require("antd");
|
|
32
41
|
const external_react_namespaceObject = require("react");
|
|
42
|
+
var external_react_default = /*#__PURE__*/ __webpack_require__.n(external_react_namespaceObject);
|
|
33
43
|
const history_js_namespaceObject = require("../store/history.js");
|
|
34
44
|
const external_ConfigSelector_js_namespaceObject = require("./ConfigSelector.js");
|
|
45
|
+
const external_FormField_js_namespaceObject = require("./FormField.js");
|
|
35
46
|
const external_HistorySelector_js_namespaceObject = require("./HistorySelector.js");
|
|
47
|
+
const external_playground_constants_js_namespaceObject = require("./playground-constants.js");
|
|
36
48
|
const external_playground_utils_js_namespaceObject = require("./playground-utils.js");
|
|
49
|
+
const external_types_js_namespaceObject = require("./types.js");
|
|
37
50
|
require("./index.css");
|
|
38
51
|
const { TextArea } = external_antd_namespaceObject.Input;
|
|
39
52
|
const PromptInput = (param)=>{
|
|
40
|
-
let { runButtonEnabled, form, serviceMode, selectedType, dryMode, stoppable, loading, onRun, onStop, clearPromptAfterRun = true } = param;
|
|
53
|
+
let { runButtonEnabled, form, serviceMode, selectedType, dryMode, stoppable, loading, onRun, onStop, clearPromptAfterRun = true, actionSpace } = param;
|
|
41
54
|
const [hoveringSettings, setHoveringSettings] = (0, external_react_namespaceObject.useState)(false);
|
|
42
55
|
const [promptValue, setPromptValue] = (0, external_react_namespaceObject.useState)('');
|
|
43
56
|
const placeholder = (0, external_playground_utils_js_namespaceObject.getPlaceholderForType)(selectedType);
|
|
44
57
|
const textAreaRef = (0, external_react_namespaceObject.useRef)(null);
|
|
58
|
+
const params = external_antd_namespaceObject.Form.useWatch('params', form);
|
|
45
59
|
const history = (0, history_js_namespaceObject.useHistoryStore)((state)=>state.history);
|
|
60
|
+
const lastSelectedType = (0, history_js_namespaceObject.useHistoryStore)((state)=>state.lastSelectedType);
|
|
46
61
|
const addHistory = (0, history_js_namespaceObject.useHistoryStore)((state)=>state.addHistory);
|
|
47
|
-
const
|
|
62
|
+
const setLastSelectedType = (0, history_js_namespaceObject.useHistoryStore)((state)=>state.setLastSelectedType);
|
|
63
|
+
const historyForSelectedType = (0, external_react_namespaceObject.useMemo)(()=>history[selectedType] || [], [
|
|
64
|
+
history,
|
|
65
|
+
selectedType
|
|
66
|
+
]);
|
|
67
|
+
const needsStructuredParams = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
68
|
+
if (actionSpace) {
|
|
69
|
+
const action = actionSpace.find((a)=>a.interfaceAlias === selectedType || a.name === selectedType);
|
|
70
|
+
return null == action ? void 0 : action.paramSchema;
|
|
71
|
+
}
|
|
72
|
+
return [
|
|
73
|
+
'aiInput',
|
|
74
|
+
'aiKeyboardPress',
|
|
75
|
+
'aiScroll'
|
|
76
|
+
].includes(selectedType);
|
|
77
|
+
}, [
|
|
78
|
+
selectedType,
|
|
79
|
+
actionSpace
|
|
80
|
+
]);
|
|
81
|
+
const getDefaultParams = (0, external_react_namespaceObject.useCallback)(()=>{
|
|
82
|
+
if (!needsStructuredParams || !actionSpace) return {};
|
|
83
|
+
const action = actionSpace.find((a)=>a.interfaceAlias === selectedType || a.name === selectedType);
|
|
84
|
+
if ((null == action ? void 0 : action.paramSchema) && (0, external_types_js_namespaceObject.isZodObjectSchema)(action.paramSchema)) {
|
|
85
|
+
const defaultParams = {};
|
|
86
|
+
const schema = action.paramSchema;
|
|
87
|
+
Object.keys(schema.shape).forEach((key)=>{
|
|
88
|
+
const field = schema.shape[key];
|
|
89
|
+
const defaultValue = (0, external_types_js_namespaceObject.extractDefaultValue)(field);
|
|
90
|
+
if (void 0 !== defaultValue) defaultParams[key] = defaultValue;
|
|
91
|
+
});
|
|
92
|
+
return defaultParams;
|
|
93
|
+
}
|
|
94
|
+
return {};
|
|
95
|
+
}, [
|
|
96
|
+
selectedType,
|
|
97
|
+
needsStructuredParams,
|
|
98
|
+
actionSpace
|
|
99
|
+
]);
|
|
100
|
+
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
101
|
+
if (!form.getFieldValue('type') && lastSelectedType) form.setFieldValue('type', lastSelectedType);
|
|
102
|
+
}, [
|
|
103
|
+
form,
|
|
104
|
+
lastSelectedType
|
|
105
|
+
]);
|
|
48
106
|
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
107
|
+
if (selectedType && selectedType !== lastSelectedType) setLastSelectedType(selectedType);
|
|
108
|
+
}, [
|
|
109
|
+
selectedType,
|
|
110
|
+
lastSelectedType,
|
|
111
|
+
setLastSelectedType
|
|
112
|
+
]);
|
|
113
|
+
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
114
|
+
const lastHistory = historyForSelectedType[0];
|
|
49
115
|
if (lastHistory) {
|
|
50
116
|
form.setFieldsValue({
|
|
51
|
-
type: lastHistory.type
|
|
52
|
-
prompt: lastHistory.prompt || ''
|
|
117
|
+
type: lastHistory.type,
|
|
118
|
+
prompt: lastHistory.prompt || '',
|
|
119
|
+
params: lastHistory.params
|
|
53
120
|
});
|
|
54
121
|
setPromptValue(lastHistory.prompt || '');
|
|
55
122
|
} else {
|
|
123
|
+
const defaultParams = getDefaultParams();
|
|
56
124
|
form.setFieldsValue({
|
|
57
|
-
|
|
58
|
-
|
|
125
|
+
prompt: '',
|
|
126
|
+
params: defaultParams
|
|
59
127
|
});
|
|
60
128
|
setPromptValue('');
|
|
61
129
|
}
|
|
62
|
-
}, [
|
|
130
|
+
}, [
|
|
131
|
+
selectedType,
|
|
132
|
+
historyForSelectedType,
|
|
133
|
+
form,
|
|
134
|
+
getDefaultParams
|
|
135
|
+
]);
|
|
63
136
|
const handleSelectHistory = (0, external_react_namespaceObject.useCallback)((historyItem)=>{
|
|
64
137
|
form.setFieldsValue({
|
|
65
138
|
prompt: historyItem.prompt,
|
|
66
|
-
type: historyItem.type
|
|
139
|
+
type: historyItem.type,
|
|
140
|
+
params: historyItem.params
|
|
67
141
|
});
|
|
68
142
|
setPromptValue(historyItem.prompt);
|
|
69
143
|
}, [
|
|
@@ -76,23 +150,73 @@ const PromptInput = (param)=>{
|
|
|
76
150
|
}, [
|
|
77
151
|
form
|
|
78
152
|
]);
|
|
79
|
-
const
|
|
153
|
+
const hasSingleStructuredParam = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
154
|
+
if (!needsStructuredParams || !actionSpace) return false;
|
|
155
|
+
const action = actionSpace.find((a)=>a.interfaceAlias === selectedType || a.name === selectedType);
|
|
156
|
+
if ((null == action ? void 0 : action.paramSchema) && (0, external_types_js_namespaceObject.isZodObjectSchema)(action.paramSchema)) {
|
|
157
|
+
const schema = action.paramSchema;
|
|
158
|
+
return 1 === Object.keys(schema.shape).length;
|
|
159
|
+
}
|
|
160
|
+
return false;
|
|
161
|
+
}, [
|
|
162
|
+
selectedType,
|
|
163
|
+
needsStructuredParams,
|
|
164
|
+
actionSpace
|
|
165
|
+
]);
|
|
166
|
+
const isRunButtonEnabled = (0, external_react_namespaceObject.useMemo)(()=>(0, external_playground_utils_js_namespaceObject.isRunButtonEnabled)(runButtonEnabled, !!needsStructuredParams, params, actionSpace, selectedType, promptValue), [
|
|
167
|
+
runButtonEnabled,
|
|
168
|
+
needsStructuredParams,
|
|
169
|
+
selectedType,
|
|
170
|
+
actionSpace,
|
|
171
|
+
promptValue,
|
|
172
|
+
params
|
|
173
|
+
]);
|
|
80
174
|
const handleRunWithHistory = (0, external_react_namespaceObject.useCallback)(()=>{
|
|
81
175
|
const values = form.getFieldsValue();
|
|
82
|
-
|
|
176
|
+
let historyPrompt = '';
|
|
177
|
+
if (needsStructuredParams && values.params && actionSpace) {
|
|
178
|
+
const action = actionSpace.find((a)=>a.interfaceAlias === selectedType || a.name === selectedType);
|
|
179
|
+
if ((null == action ? void 0 : action.paramSchema) && (0, external_types_js_namespaceObject.isZodObjectSchema)(action.paramSchema)) {
|
|
180
|
+
let locateValue = '';
|
|
181
|
+
const otherValues = [];
|
|
182
|
+
const schema = action.paramSchema;
|
|
183
|
+
Object.keys(schema.shape).forEach((key)=>{
|
|
184
|
+
const paramValue = values.params[key];
|
|
185
|
+
if (null != paramValue && '' !== paramValue) {
|
|
186
|
+
const field = schema.shape[key];
|
|
187
|
+
const { actualField } = (0, external_types_js_namespaceObject.unwrapZodType)(field);
|
|
188
|
+
if ((0, external_types_js_namespaceObject.isLocateField)(actualField)) locateValue = String(paramValue);
|
|
189
|
+
else if ('distance' === key) otherValues.push(`${paramValue}`);
|
|
190
|
+
else otherValues.push(String(paramValue));
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
const mainPart = otherValues.join(' ');
|
|
194
|
+
historyPrompt = locateValue ? `${mainPart} | ${locateValue}` : mainPart;
|
|
195
|
+
} else historyPrompt = values.prompt || '';
|
|
196
|
+
} else historyPrompt = values.prompt || '';
|
|
197
|
+
addHistory({
|
|
83
198
|
type: values.type,
|
|
84
|
-
prompt:
|
|
199
|
+
prompt: historyPrompt,
|
|
200
|
+
params: values.params,
|
|
85
201
|
timestamp: Date.now()
|
|
86
202
|
});
|
|
87
203
|
onRun();
|
|
88
204
|
if (clearPromptAfterRun) {
|
|
89
205
|
setPromptValue('');
|
|
90
|
-
|
|
206
|
+
if (needsStructuredParams) {
|
|
207
|
+
const defaultParams = getDefaultParams();
|
|
208
|
+
form.setFieldValue('params', defaultParams);
|
|
209
|
+
} else form.setFieldValue('prompt', '');
|
|
91
210
|
}
|
|
92
211
|
}, [
|
|
93
212
|
form,
|
|
94
213
|
addHistory,
|
|
95
|
-
onRun
|
|
214
|
+
onRun,
|
|
215
|
+
needsStructuredParams,
|
|
216
|
+
selectedType,
|
|
217
|
+
clearPromptAfterRun,
|
|
218
|
+
actionSpace,
|
|
219
|
+
getDefaultParams
|
|
96
220
|
]);
|
|
97
221
|
const handleKeyDown = (0, external_react_namespaceObject.useCallback)((e)=>{
|
|
98
222
|
if ('Enter' === e.key && e.metaKey && isRunButtonEnabled) {
|
|
@@ -113,6 +237,116 @@ const PromptInput = (param)=>{
|
|
|
113
237
|
handleRunWithHistory,
|
|
114
238
|
isRunButtonEnabled
|
|
115
239
|
]);
|
|
240
|
+
const handleStructuredKeyDown = (0, external_react_namespaceObject.useCallback)((e)=>{
|
|
241
|
+
if ('Enter' === e.key && e.metaKey && isRunButtonEnabled) {
|
|
242
|
+
handleRunWithHistory();
|
|
243
|
+
e.preventDefault();
|
|
244
|
+
e.stopPropagation();
|
|
245
|
+
}
|
|
246
|
+
}, [
|
|
247
|
+
handleRunWithHistory,
|
|
248
|
+
isRunButtonEnabled
|
|
249
|
+
]);
|
|
250
|
+
const renderStructuredParams = (0, external_react_namespaceObject.useCallback)(()=>{
|
|
251
|
+
if (!needsStructuredParams) return null;
|
|
252
|
+
if (actionSpace) {
|
|
253
|
+
const action = actionSpace.find((a)=>a.interfaceAlias === selectedType || a.name === selectedType);
|
|
254
|
+
if ((null == action ? void 0 : action.paramSchema) && (0, external_types_js_namespaceObject.isZodObjectSchema)(action.paramSchema)) {
|
|
255
|
+
const schema = action.paramSchema;
|
|
256
|
+
const schemaKeys = Object.keys(schema.shape);
|
|
257
|
+
if (1 === schemaKeys.length) {
|
|
258
|
+
const key = schemaKeys[0];
|
|
259
|
+
const field = schema.shape[key];
|
|
260
|
+
const { actualField, isOptional } = (0, external_types_js_namespaceObject.unwrapZodType)(field);
|
|
261
|
+
const isLocateFieldFlag = (0, external_types_js_namespaceObject.isLocateField)(actualField);
|
|
262
|
+
let placeholderText = '';
|
|
263
|
+
if (isLocateFieldFlag) placeholderText = 'Describe the element you want to interact with';
|
|
264
|
+
else {
|
|
265
|
+
placeholderText = `Enter ${key}`;
|
|
266
|
+
if ('keyName' === key) placeholderText = 'Enter key name or text to type';
|
|
267
|
+
if ('value' === key) placeholderText = 'Enter text to input';
|
|
268
|
+
}
|
|
269
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Form.Item, {
|
|
270
|
+
name: [
|
|
271
|
+
'params',
|
|
272
|
+
key
|
|
273
|
+
],
|
|
274
|
+
style: {
|
|
275
|
+
margin: 0
|
|
276
|
+
},
|
|
277
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Input.TextArea, {
|
|
278
|
+
className: "main-side-console-input-textarea",
|
|
279
|
+
rows: 4,
|
|
280
|
+
placeholder: placeholderText,
|
|
281
|
+
autoFocus: true,
|
|
282
|
+
onKeyDown: handleStructuredKeyDown
|
|
283
|
+
})
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
const fields = [];
|
|
287
|
+
schemaKeys.forEach((key, index)=>{
|
|
288
|
+
var _actualField__def, _actualField__def1;
|
|
289
|
+
const fieldSchema = schema.shape[key];
|
|
290
|
+
const { actualField, isOptional } = (0, external_types_js_namespaceObject.unwrapZodType)(fieldSchema);
|
|
291
|
+
const isLocateFieldFlag = (0, external_types_js_namespaceObject.isLocateField)(actualField);
|
|
292
|
+
const label = key.charAt(0).toUpperCase() + key.slice(1);
|
|
293
|
+
const isRequired = !isOptional;
|
|
294
|
+
const marginBottom = index === schemaKeys.length - 1 ? 0 : 12;
|
|
295
|
+
const fieldProps = {
|
|
296
|
+
name: key,
|
|
297
|
+
label,
|
|
298
|
+
fieldSchema: actualField,
|
|
299
|
+
isRequired,
|
|
300
|
+
marginBottom
|
|
301
|
+
};
|
|
302
|
+
if (isLocateFieldFlag) fields.push(/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_FormField_js_namespaceObject.LocateField, {
|
|
303
|
+
...fieldProps
|
|
304
|
+
}));
|
|
305
|
+
else if ((null == (_actualField__def = actualField._def) ? void 0 : _actualField__def.typeName) === 'ZodEnum') fields.push(/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_FormField_js_namespaceObject.EnumField, {
|
|
306
|
+
...fieldProps
|
|
307
|
+
}));
|
|
308
|
+
else if ((null == (_actualField__def1 = actualField._def) ? void 0 : _actualField__def1.typeName) === 'ZodNumber') fields.push(/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_FormField_js_namespaceObject.NumberField, {
|
|
309
|
+
...fieldProps
|
|
310
|
+
}));
|
|
311
|
+
else fields.push(/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_FormField_js_namespaceObject.TextField, {
|
|
312
|
+
...fieldProps
|
|
313
|
+
}));
|
|
314
|
+
});
|
|
315
|
+
if ('aiScroll' === selectedType) {
|
|
316
|
+
const directionField = fields.find((field)=>/*#__PURE__*/ external_react_default().isValidElement(field) && 'direction' === field.props.name);
|
|
317
|
+
const distanceField = fields.find((field)=>/*#__PURE__*/ external_react_default().isValidElement(field) && 'distance' === field.props.name);
|
|
318
|
+
const otherFields = fields.filter((field)=>/*#__PURE__*/ external_react_default().isValidElement(field) && 'direction' !== field.props.name && 'distance' !== field.props.name);
|
|
319
|
+
if (directionField && distanceField) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
320
|
+
className: "structured-params",
|
|
321
|
+
children: [
|
|
322
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
323
|
+
style: {
|
|
324
|
+
display: 'flex',
|
|
325
|
+
gap: 12,
|
|
326
|
+
marginBottom: 12
|
|
327
|
+
},
|
|
328
|
+
children: [
|
|
329
|
+
directionField,
|
|
330
|
+
distanceField
|
|
331
|
+
]
|
|
332
|
+
}),
|
|
333
|
+
otherFields
|
|
334
|
+
]
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
338
|
+
className: "structured-params",
|
|
339
|
+
children: fields
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
return null;
|
|
344
|
+
}, [
|
|
345
|
+
selectedType,
|
|
346
|
+
needsStructuredParams,
|
|
347
|
+
actionSpace,
|
|
348
|
+
handleStructuredKeyDown
|
|
349
|
+
]);
|
|
116
350
|
const handleMouseEnter = (0, external_react_namespaceObject.useCallback)(()=>{
|
|
117
351
|
setHoveringSettings(true);
|
|
118
352
|
}, []);
|
|
@@ -161,52 +395,106 @@ const PromptInput = (param)=>{
|
|
|
161
395
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_antd_namespaceObject.Space, {
|
|
162
396
|
className: "mode-radio-group-wrapper",
|
|
163
397
|
children: [
|
|
164
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
value: "aiQuery",
|
|
185
|
-
children: (0, external_playground_utils_js_namespaceObject.actionNameForType)('aiQuery')
|
|
186
|
-
})
|
|
187
|
-
}),
|
|
188
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Tooltip, {
|
|
189
|
-
title: "Understand the UI and determine if the assertion is true",
|
|
190
|
-
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Radio.Button, {
|
|
191
|
-
value: "aiAssert",
|
|
192
|
-
children: (0, external_playground_utils_js_namespaceObject.actionNameForType)('aiAssert')
|
|
193
|
-
})
|
|
194
|
-
}),
|
|
195
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Tooltip, {
|
|
196
|
-
title: "Instant Action: click something",
|
|
197
|
-
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Radio.Button, {
|
|
198
|
-
value: "aiTap",
|
|
199
|
-
children: (0, external_playground_utils_js_namespaceObject.actionNameForType)('aiTap')
|
|
398
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
399
|
+
className: "mode-radio-group",
|
|
400
|
+
children: [
|
|
401
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Form.Item, {
|
|
402
|
+
name: "type",
|
|
403
|
+
style: {
|
|
404
|
+
margin: 0
|
|
405
|
+
},
|
|
406
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Radio.Group, {
|
|
407
|
+
buttonStyle: "solid",
|
|
408
|
+
disabled: !runButtonEnabled,
|
|
409
|
+
children: external_playground_constants_js_namespaceObject.defaultMainButtons.map((apiType)=>{
|
|
410
|
+
var _apiMetadata_apiType;
|
|
411
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Tooltip, {
|
|
412
|
+
title: (null == (_apiMetadata_apiType = external_playground_constants_js_namespaceObject.apiMetadata[apiType]) ? void 0 : _apiMetadata_apiType.title) || '',
|
|
413
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Radio.Button, {
|
|
414
|
+
value: apiType,
|
|
415
|
+
children: (0, external_playground_utils_js_namespaceObject.actionNameForType)(apiType)
|
|
416
|
+
})
|
|
417
|
+
}, apiType);
|
|
200
418
|
})
|
|
201
419
|
})
|
|
202
|
-
|
|
203
|
-
|
|
420
|
+
}),
|
|
421
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Dropdown, {
|
|
422
|
+
menu: (()=>{
|
|
423
|
+
const hiddenAPIs = Object.keys(external_playground_constants_js_namespaceObject.apiMetadata).filter((api)=>!external_playground_constants_js_namespaceObject.defaultMainButtons.includes(api));
|
|
424
|
+
const groupedItems = [];
|
|
425
|
+
const interactionAPIs = hiddenAPIs.filter((api)=>'interaction' === external_playground_constants_js_namespaceObject.apiMetadata[api].group);
|
|
426
|
+
if (interactionAPIs.length > 0) groupedItems.push({
|
|
427
|
+
key: 'interaction-group',
|
|
428
|
+
type: 'group',
|
|
429
|
+
label: 'Interaction APIs',
|
|
430
|
+
children: interactionAPIs.map((api)=>({
|
|
431
|
+
key: api,
|
|
432
|
+
label: (0, external_playground_utils_js_namespaceObject.actionNameForType)(api),
|
|
433
|
+
title: external_playground_constants_js_namespaceObject.apiMetadata[api].title,
|
|
434
|
+
onClick: ()=>{
|
|
435
|
+
form.setFieldValue('type', api);
|
|
436
|
+
}
|
|
437
|
+
}))
|
|
438
|
+
});
|
|
439
|
+
const extractionAPIs = hiddenAPIs.filter((api)=>'extraction' === external_playground_constants_js_namespaceObject.apiMetadata[api].group);
|
|
440
|
+
if (extractionAPIs.length > 0) groupedItems.push({
|
|
441
|
+
key: 'extraction-group',
|
|
442
|
+
type: 'group',
|
|
443
|
+
label: 'Data Extraction APIs',
|
|
444
|
+
children: extractionAPIs.map((api)=>({
|
|
445
|
+
key: api,
|
|
446
|
+
label: (0, external_playground_utils_js_namespaceObject.actionNameForType)(api),
|
|
447
|
+
title: external_playground_constants_js_namespaceObject.apiMetadata[api].title,
|
|
448
|
+
onClick: ()=>{
|
|
449
|
+
form.setFieldValue('type', api);
|
|
450
|
+
}
|
|
451
|
+
}))
|
|
452
|
+
});
|
|
453
|
+
const validationAPIs = hiddenAPIs.filter((api)=>'validation' === external_playground_constants_js_namespaceObject.apiMetadata[api].group);
|
|
454
|
+
if (validationAPIs.length > 0) groupedItems.push({
|
|
455
|
+
key: 'validation-group',
|
|
456
|
+
type: 'group',
|
|
457
|
+
label: 'Validation APIs',
|
|
458
|
+
children: validationAPIs.map((api)=>({
|
|
459
|
+
key: api,
|
|
460
|
+
label: (0, external_playground_utils_js_namespaceObject.actionNameForType)(api),
|
|
461
|
+
title: external_playground_constants_js_namespaceObject.apiMetadata[api].title,
|
|
462
|
+
onClick: ()=>{
|
|
463
|
+
form.setFieldValue('type', api);
|
|
464
|
+
}
|
|
465
|
+
}))
|
|
466
|
+
});
|
|
467
|
+
return {
|
|
468
|
+
items: groupedItems
|
|
469
|
+
};
|
|
470
|
+
})(),
|
|
471
|
+
placement: "bottomLeft",
|
|
472
|
+
trigger: [
|
|
473
|
+
'click'
|
|
474
|
+
],
|
|
475
|
+
disabled: !runButtonEnabled,
|
|
476
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_antd_namespaceObject.Button, {
|
|
477
|
+
className: `more-apis-button ${!external_playground_constants_js_namespaceObject.defaultMainButtons.includes(selectedType) ? 'selected-from-dropdown' : ''}`,
|
|
478
|
+
children: [
|
|
479
|
+
selectedType && !external_playground_constants_js_namespaceObject.defaultMainButtons.includes(selectedType) ? (0, external_playground_utils_js_namespaceObject.actionNameForType)(selectedType) : 'more',
|
|
480
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(icons_namespaceObject.DownOutlined, {
|
|
481
|
+
style: {
|
|
482
|
+
fontSize: '10px',
|
|
483
|
+
marginLeft: '2px'
|
|
484
|
+
}
|
|
485
|
+
})
|
|
486
|
+
]
|
|
487
|
+
})
|
|
488
|
+
})
|
|
489
|
+
]
|
|
204
490
|
}),
|
|
205
491
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
206
492
|
className: "action-icons",
|
|
207
493
|
children: [
|
|
208
494
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_HistorySelector_js_namespaceObject.HistorySelector, {
|
|
209
|
-
onSelect: handleSelectHistory
|
|
495
|
+
onSelect: handleSelectHistory,
|
|
496
|
+
history: historyForSelectedType,
|
|
497
|
+
currentType: selectedType
|
|
210
498
|
}),
|
|
211
499
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
212
500
|
className: hoveringSettings ? 'settings-wrapper settings-wrapper-hover' : 'settings-wrapper',
|
|
@@ -214,7 +502,7 @@ const PromptInput = (param)=>{
|
|
|
214
502
|
onMouseLeave: handleMouseLeave,
|
|
215
503
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_ConfigSelector_js_namespaceObject.ConfigSelector, {
|
|
216
504
|
enableTracking: 'In-Browser-Extension' === serviceMode,
|
|
217
|
-
showDeepThinkOption: 'aiTap' === selectedType
|
|
505
|
+
showDeepThinkOption: 'aiTap' === selectedType || 'aiHover' === selectedType || 'aiInput' === selectedType || 'aiRightClick' === selectedType || 'aiLocate' === selectedType
|
|
218
506
|
})
|
|
219
507
|
})
|
|
220
508
|
]
|
|
@@ -224,7 +512,10 @@ const PromptInput = (param)=>{
|
|
|
224
512
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
225
513
|
className: `main-side-console-input ${!runButtonEnabled ? 'disabled' : ''} ${loading ? 'loading' : ''}`,
|
|
226
514
|
children: [
|
|
227
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
515
|
+
needsStructuredParams ? hasSingleStructuredParam ? renderStructuredParams() : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
516
|
+
className: "structured-params-container",
|
|
517
|
+
children: renderStructuredParams()
|
|
518
|
+
}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Form.Item, {
|
|
228
519
|
name: "prompt",
|
|
229
520
|
style: {
|
|
230
521
|
margin: 0
|