@midscene/visualizer 1.7.4 → 1.7.5-beta-20260420031652.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/config-selector/index.mjs +2 -2
- package/dist/es/component/history-selector/index.css +83 -16
- package/dist/es/component/history-selector/index.mjs +2 -2
- package/dist/es/component/playground/index.css +193 -1
- package/dist/es/component/playground-result/index.css +28 -0
- package/dist/es/component/playground-result/index.mjs +39 -54
- package/dist/es/component/prompt-input/index.css +165 -1
- package/dist/es/component/prompt-input/index.mjs +305 -130
- package/dist/es/component/universal-playground/index.css +47 -15
- package/dist/es/component/universal-playground/index.mjs +162 -102
- package/dist/es/utils/action-label.mjs +14 -0
- package/dist/es/utils/playground-utils.mjs +1 -9
- package/dist/es/utils/prompt-input-utils.mjs +45 -0
- package/dist/lib/component/config-selector/index.js +2 -2
- package/dist/lib/component/history-selector/index.css +83 -16
- package/dist/lib/component/history-selector/index.js +2 -2
- package/dist/lib/component/playground/index.css +193 -1
- package/dist/lib/component/playground-result/index.css +28 -0
- package/dist/lib/component/playground-result/index.js +39 -54
- package/dist/lib/component/prompt-input/index.css +165 -1
- package/dist/lib/component/prompt-input/index.js +307 -130
- package/dist/lib/component/universal-playground/index.css +47 -15
- package/dist/lib/component/universal-playground/index.js +161 -101
- package/dist/lib/utils/action-label.js +51 -0
- package/dist/lib/utils/playground-utils.js +2 -10
- package/dist/lib/utils/prompt-input-utils.js +82 -0
- package/dist/types/component/config-selector/index.d.ts +2 -0
- package/dist/types/component/history-selector/index.d.ts +2 -0
- package/dist/types/component/prompt-input/index.d.ts +2 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/types.d.ts +50 -0
- package/dist/types/utils/action-label.d.ts +11 -0
- package/dist/types/utils/playground-utils.d.ts +6 -1
- package/dist/types/utils/prompt-input-utils.d.ts +24 -0
- package/package.json +5 -5
|
@@ -5,12 +5,16 @@ import { Button, Dropdown, Form, Input, Radio, Tooltip } from "antd";
|
|
|
5
5
|
import react, { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
6
6
|
import { useHistoryStore } from "../../store/history.mjs";
|
|
7
7
|
import { extractDefaultValue, isLocateField, isZodObjectSchema, unwrapZodType } from "../../types.mjs";
|
|
8
|
+
import { getPromptInputActionLabel } from "../../utils/action-label.mjs";
|
|
8
9
|
import { apiMetadata, defaultMainButtons } from "../../utils/constants.mjs";
|
|
9
10
|
import { hasDeviceSpecificConfig } from "../../utils/device-capabilities.mjs";
|
|
10
11
|
import { actionNameForType, getPlaceholderForType, isRunButtonEnabled as playground_utils_mjs_isRunButtonEnabled } from "../../utils/playground-utils.mjs";
|
|
12
|
+
import { getAvailablePromptActionTypes, getInlineStructuredFieldConfig } from "../../utils/prompt-input-utils.mjs";
|
|
11
13
|
import { ConfigSelector } from "../config-selector/index.mjs";
|
|
12
14
|
import { BooleanField, EnumField, LocateField, NumberField, TextField } from "../form-field/index.mjs";
|
|
13
15
|
import { HistorySelector } from "../history-selector/index.mjs";
|
|
16
|
+
import icons_history from "../../icons/history.mjs";
|
|
17
|
+
import setting from "../../icons/setting.mjs";
|
|
14
18
|
function _define_property(obj, key, value) {
|
|
15
19
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
16
20
|
value: value,
|
|
@@ -35,10 +39,14 @@ function _object_spread(target) {
|
|
|
35
39
|
return target;
|
|
36
40
|
}
|
|
37
41
|
const { TextArea } = Input;
|
|
38
|
-
const PromptInput = ({ runButtonEnabled, form, serviceMode, selectedType, dryMode, stoppable, loading, onRun, onStop, clearPromptAfterRun = true, actionSpace, hideDomAndScreenshotOptions = false, deviceType })=>{
|
|
42
|
+
const PromptInput = ({ runButtonEnabled, form, serviceMode, selectedType, dryMode, stoppable, loading, onRun, onStop, clearPromptAfterRun = true, actionSpace, hideDomAndScreenshotOptions = false, deviceType, chrome })=>{
|
|
39
43
|
const [hoveringSettings, setHoveringSettings] = useState(false);
|
|
40
44
|
const [promptValue, setPromptValue] = useState('');
|
|
45
|
+
const [minimalHasExplicitTypeSelection, setMinimalHasExplicitTypeSelection] = useState(false);
|
|
41
46
|
const placeholder = getPlaceholderForType(selectedType);
|
|
47
|
+
const isMinimalChrome = (null == chrome ? void 0 : chrome.variant) === 'minimal';
|
|
48
|
+
const resolvedPlaceholder = (null == chrome ? void 0 : chrome.placeholder) || placeholder;
|
|
49
|
+
const actionButtonLabel = getPromptInputActionLabel(selectedType, null == chrome ? void 0 : chrome.primaryActionLabel);
|
|
42
50
|
const textAreaRef = useRef(null);
|
|
43
51
|
const modeRadioGroupRef = useRef(null);
|
|
44
52
|
const params = Form.useWatch('params', form);
|
|
@@ -51,6 +59,7 @@ const PromptInput = ({ runButtonEnabled, form, serviceMode, selectedType, dryMod
|
|
|
51
59
|
history,
|
|
52
60
|
selectedType
|
|
53
61
|
]);
|
|
62
|
+
const skipMinimalSyncRef = useRef(false);
|
|
54
63
|
const needsStructuredParams = useMemo(()=>{
|
|
55
64
|
if (actionSpace) {
|
|
56
65
|
const action = actionSpace.find((a)=>a.interfaceAlias === selectedType || a.name === selectedType);
|
|
@@ -141,22 +150,116 @@ const PromptInput = ({ runButtonEnabled, form, serviceMode, selectedType, dryMod
|
|
|
141
150
|
hideDomAndScreenshotOptions,
|
|
142
151
|
deviceType
|
|
143
152
|
]);
|
|
144
|
-
const availableDropdownMethods = useMemo(()=>
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
+
const availableDropdownMethods = useMemo(()=>getAvailablePromptActionTypes(actionSpace), [
|
|
154
|
+
actionSpace
|
|
155
|
+
]);
|
|
156
|
+
const hiddenDropdownAPIs = useMemo(()=>availableDropdownMethods.filter((api)=>!defaultMainButtons.includes(api)), [
|
|
157
|
+
availableDropdownMethods
|
|
158
|
+
]);
|
|
159
|
+
const handleTypeSelect = useCallback((api)=>{
|
|
160
|
+
if (isMinimalChrome) setMinimalHasExplicitTypeSelection(true);
|
|
161
|
+
form.setFieldValue('type', api);
|
|
162
|
+
}, [
|
|
163
|
+
form,
|
|
164
|
+
isMinimalChrome
|
|
165
|
+
]);
|
|
166
|
+
const apiGroupDefinitions = useMemo(()=>[
|
|
167
|
+
{
|
|
168
|
+
key: 'interaction-group',
|
|
169
|
+
label: 'Interaction APIs',
|
|
170
|
+
match: (api)=>{
|
|
171
|
+
var _apiMetadata_api;
|
|
172
|
+
return (null == (_apiMetadata_api = apiMetadata[api]) ? void 0 : _apiMetadata_api.group) === 'interaction';
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
key: 'extraction-group',
|
|
177
|
+
label: 'Data Extraction APIs',
|
|
178
|
+
match: (api)=>{
|
|
179
|
+
var _apiMetadata_api;
|
|
180
|
+
return (null == (_apiMetadata_api = apiMetadata[api]) ? void 0 : _apiMetadata_api.group) === 'extraction';
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
key: 'validation-group',
|
|
185
|
+
label: 'Validation APIs',
|
|
186
|
+
match: (api)=>{
|
|
187
|
+
var _apiMetadata_api;
|
|
188
|
+
return (null == (_apiMetadata_api = apiMetadata[api]) ? void 0 : _apiMetadata_api.group) === 'validation';
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
key: 'device-specific-group',
|
|
193
|
+
label: 'Device-Specific APIs',
|
|
194
|
+
match: (api)=>!apiMetadata[api]
|
|
195
|
+
}
|
|
196
|
+
], []);
|
|
197
|
+
const buildApiMenuItem = useCallback((api)=>{
|
|
198
|
+
var _apiMetadata_api;
|
|
199
|
+
return {
|
|
200
|
+
key: api,
|
|
201
|
+
label: actionNameForType(api),
|
|
202
|
+
title: (null == (_apiMetadata_api = apiMetadata[api]) ? void 0 : _apiMetadata_api.title) || '',
|
|
203
|
+
onClick: ()=>handleTypeSelect(api)
|
|
204
|
+
};
|
|
205
|
+
}, [
|
|
206
|
+
handleTypeSelect
|
|
207
|
+
]);
|
|
208
|
+
const hiddenApiGroupItems = useMemo(()=>{
|
|
209
|
+
const items = [];
|
|
210
|
+
for (const group of apiGroupDefinitions){
|
|
211
|
+
const apisInGroup = hiddenDropdownAPIs.filter(group.match);
|
|
212
|
+
if (0 !== apisInGroup.length) items.push({
|
|
213
|
+
key: group.key,
|
|
214
|
+
type: 'group',
|
|
215
|
+
label: group.label,
|
|
216
|
+
children: apisInGroup.map(buildApiMenuItem)
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
return items;
|
|
220
|
+
}, [
|
|
221
|
+
apiGroupDefinitions,
|
|
222
|
+
hiddenDropdownAPIs,
|
|
223
|
+
buildApiMenuItem
|
|
224
|
+
]);
|
|
225
|
+
const actionDropdownMenu = useMemo(()=>{
|
|
226
|
+
const primaryActions = defaultMainButtons.filter((api)=>'aiAct' === api || availableDropdownMethods.includes(api));
|
|
227
|
+
const items = [];
|
|
228
|
+
if (primaryActions.length > 0) items.push({
|
|
229
|
+
key: 'primary-group',
|
|
230
|
+
type: 'group',
|
|
231
|
+
label: 'Primary APIs',
|
|
232
|
+
children: primaryActions.map(buildApiMenuItem)
|
|
153
233
|
});
|
|
154
|
-
|
|
155
|
-
|
|
234
|
+
items.push(...hiddenApiGroupItems);
|
|
235
|
+
return {
|
|
236
|
+
items
|
|
237
|
+
};
|
|
238
|
+
}, [
|
|
239
|
+
availableDropdownMethods,
|
|
240
|
+
buildApiMenuItem,
|
|
241
|
+
hiddenApiGroupItems
|
|
242
|
+
]);
|
|
243
|
+
const moreApisDropdownMenu = useMemo(()=>({
|
|
244
|
+
items: hiddenApiGroupItems
|
|
245
|
+
}), [
|
|
246
|
+
hiddenApiGroupItems
|
|
247
|
+
]);
|
|
248
|
+
useEffect(()=>{
|
|
249
|
+
if (!isMinimalChrome || minimalHasExplicitTypeSelection || !selectedType || 'aiAct' === selectedType) return;
|
|
250
|
+
skipMinimalSyncRef.current = false;
|
|
251
|
+
lastHistoryRef.current = null;
|
|
252
|
+
form.setFieldsValue({
|
|
253
|
+
type: 'aiAct',
|
|
254
|
+
prompt: '',
|
|
255
|
+
params: {}
|
|
156
256
|
});
|
|
157
|
-
|
|
257
|
+
setPromptValue('');
|
|
158
258
|
}, [
|
|
159
|
-
|
|
259
|
+
form,
|
|
260
|
+
minimalHasExplicitTypeSelection,
|
|
261
|
+
isMinimalChrome,
|
|
262
|
+
selectedType
|
|
160
263
|
]);
|
|
161
264
|
const getDefaultParams = useCallback(()=>{
|
|
162
265
|
if (!needsStructuredParams || !actionSpace) return {};
|
|
@@ -179,15 +282,17 @@ const PromptInput = ({ runButtonEnabled, form, serviceMode, selectedType, dryMod
|
|
|
179
282
|
actionSpace
|
|
180
283
|
]);
|
|
181
284
|
useEffect(()=>{
|
|
182
|
-
if (!form.getFieldValue('type') && lastSelectedType) form.setFieldValue('type', lastSelectedType);
|
|
285
|
+
if (!isMinimalChrome && !form.getFieldValue('type') && lastSelectedType) form.setFieldValue('type', lastSelectedType);
|
|
183
286
|
}, [
|
|
184
287
|
form,
|
|
288
|
+
isMinimalChrome,
|
|
185
289
|
lastSelectedType
|
|
186
290
|
]);
|
|
187
291
|
useEffect(()=>{
|
|
188
|
-
if (selectedType && selectedType !== lastSelectedType) setLastSelectedType(selectedType);
|
|
292
|
+
if (!isMinimalChrome && selectedType && selectedType !== lastSelectedType) setLastSelectedType(selectedType);
|
|
189
293
|
}, [
|
|
190
294
|
selectedType,
|
|
295
|
+
isMinimalChrome,
|
|
191
296
|
lastSelectedType,
|
|
192
297
|
setLastSelectedType
|
|
193
298
|
]);
|
|
@@ -213,6 +318,20 @@ const PromptInput = ({ runButtonEnabled, form, serviceMode, selectedType, dryMod
|
|
|
213
318
|
}
|
|
214
319
|
}, []);
|
|
215
320
|
useEffect(()=>{
|
|
321
|
+
if (skipMinimalSyncRef.current) {
|
|
322
|
+
skipMinimalSyncRef.current = false;
|
|
323
|
+
return;
|
|
324
|
+
}
|
|
325
|
+
if (isMinimalChrome) {
|
|
326
|
+
const defaultParams = getDefaultParams();
|
|
327
|
+
form.setFieldsValue({
|
|
328
|
+
prompt: '',
|
|
329
|
+
params: defaultParams
|
|
330
|
+
});
|
|
331
|
+
setPromptValue('');
|
|
332
|
+
lastHistoryRef.current = null;
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
216
335
|
const lastHistory = historyForSelectedType[0];
|
|
217
336
|
if (lastHistory && lastHistoryRef.current && lastHistory.timestamp === lastHistoryRef.current.timestamp) return;
|
|
218
337
|
if (lastHistory) {
|
|
@@ -236,7 +355,8 @@ const PromptInput = ({ runButtonEnabled, form, serviceMode, selectedType, dryMod
|
|
|
236
355
|
selectedType,
|
|
237
356
|
historyForSelectedType,
|
|
238
357
|
form,
|
|
239
|
-
getDefaultParams
|
|
358
|
+
getDefaultParams,
|
|
359
|
+
isMinimalChrome
|
|
240
360
|
]);
|
|
241
361
|
useEffect(()=>{
|
|
242
362
|
const timeoutId = setTimeout(()=>{
|
|
@@ -255,6 +375,8 @@ const PromptInput = ({ runButtonEnabled, form, serviceMode, selectedType, dryMod
|
|
|
255
375
|
promptValue
|
|
256
376
|
]);
|
|
257
377
|
const handleSelectHistory = useCallback((historyItem)=>{
|
|
378
|
+
if (isMinimalChrome) setMinimalHasExplicitTypeSelection(true);
|
|
379
|
+
skipMinimalSyncRef.current = historyItem.type !== selectedType;
|
|
258
380
|
form.setFieldsValue({
|
|
259
381
|
prompt: historyItem.prompt,
|
|
260
382
|
type: historyItem.type,
|
|
@@ -262,7 +384,9 @@ const PromptInput = ({ runButtonEnabled, form, serviceMode, selectedType, dryMod
|
|
|
262
384
|
});
|
|
263
385
|
setPromptValue(historyItem.prompt);
|
|
264
386
|
}, [
|
|
265
|
-
form
|
|
387
|
+
form,
|
|
388
|
+
isMinimalChrome,
|
|
389
|
+
selectedType
|
|
266
390
|
]);
|
|
267
391
|
const handlePromptChange = useCallback((e)=>{
|
|
268
392
|
const value = e.target.value;
|
|
@@ -282,6 +406,11 @@ const PromptInput = ({ runButtonEnabled, form, serviceMode, selectedType, dryMod
|
|
|
282
406
|
needsStructuredParams,
|
|
283
407
|
actionSpace
|
|
284
408
|
]);
|
|
409
|
+
const minimalInlineFieldConfig = useMemo(()=>isMinimalChrome ? getInlineStructuredFieldConfig(actionSpace, selectedType) : null, [
|
|
410
|
+
actionSpace,
|
|
411
|
+
isMinimalChrome,
|
|
412
|
+
selectedType
|
|
413
|
+
]);
|
|
285
414
|
const isRunButtonEnabled = useMemo(()=>playground_utils_mjs_isRunButtonEnabled(runButtonEnabled, !!needsStructuredParams, params, actionSpace, selectedType, promptValue), [
|
|
286
415
|
runButtonEnabled,
|
|
287
416
|
needsStructuredParams,
|
|
@@ -549,6 +678,162 @@ const PromptInput = ({ runButtonEnabled, form, serviceMode, selectedType, dryMod
|
|
|
549
678
|
selectedType,
|
|
550
679
|
stoppable
|
|
551
680
|
]);
|
|
681
|
+
const inputContent = needsAnyInput ? needsStructuredParams ? minimalInlineFieldConfig ? /*#__PURE__*/ jsx(Form.Item, {
|
|
682
|
+
name: [
|
|
683
|
+
'params',
|
|
684
|
+
minimalInlineFieldConfig.name
|
|
685
|
+
],
|
|
686
|
+
style: {
|
|
687
|
+
margin: 0
|
|
688
|
+
},
|
|
689
|
+
children: /*#__PURE__*/ jsx(TextArea, {
|
|
690
|
+
className: "main-side-console-input-textarea",
|
|
691
|
+
disabled: !runButtonEnabled,
|
|
692
|
+
rows: 3,
|
|
693
|
+
placeholder: 'prompt' === minimalInlineFieldConfig.name ? resolvedPlaceholder : minimalInlineFieldConfig.placeholder,
|
|
694
|
+
autoFocus: true,
|
|
695
|
+
onKeyDown: handleStructuredKeyDown
|
|
696
|
+
})
|
|
697
|
+
}) : hasSingleStructuredParam ? renderStructuredParams() : /*#__PURE__*/ jsx("div", {
|
|
698
|
+
className: "structured-params-container",
|
|
699
|
+
children: renderStructuredParams()
|
|
700
|
+
}) : /*#__PURE__*/ jsx(Form.Item, {
|
|
701
|
+
name: "prompt",
|
|
702
|
+
style: {
|
|
703
|
+
margin: 0
|
|
704
|
+
},
|
|
705
|
+
children: /*#__PURE__*/ jsx(TextArea, {
|
|
706
|
+
className: "main-side-console-input-textarea",
|
|
707
|
+
disabled: !runButtonEnabled,
|
|
708
|
+
rows: 3,
|
|
709
|
+
placeholder: resolvedPlaceholder,
|
|
710
|
+
autoFocus: true,
|
|
711
|
+
onKeyDown: handleKeyDown,
|
|
712
|
+
onChange: handlePromptChange,
|
|
713
|
+
ref: textAreaRef
|
|
714
|
+
})
|
|
715
|
+
}) : /*#__PURE__*/ jsxs("div", {
|
|
716
|
+
className: "no-input-method",
|
|
717
|
+
children: [
|
|
718
|
+
'Click "Run" to execute ',
|
|
719
|
+
actionNameForType(selectedType)
|
|
720
|
+
]
|
|
721
|
+
});
|
|
722
|
+
if (isMinimalChrome) {
|
|
723
|
+
var _chrome_icons, _chrome_icons1, _chrome_icons2, _chrome_icons3;
|
|
724
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
725
|
+
className: "prompt-input-wrapper prompt-input-wrapper-minimal",
|
|
726
|
+
children: [
|
|
727
|
+
/*#__PURE__*/ jsx(Form.Item, {
|
|
728
|
+
hidden: true,
|
|
729
|
+
name: "type",
|
|
730
|
+
style: {
|
|
731
|
+
margin: 0
|
|
732
|
+
},
|
|
733
|
+
children: /*#__PURE__*/ jsx(Input, {})
|
|
734
|
+
}),
|
|
735
|
+
/*#__PURE__*/ jsxs("div", {
|
|
736
|
+
className: `main-side-console-input minimal-main-side-console-input ${!runButtonEnabled ? 'disabled' : ''} ${loading ? 'loading' : ''}`,
|
|
737
|
+
children: [
|
|
738
|
+
inputContent,
|
|
739
|
+
/*#__PURE__*/ jsxs("div", {
|
|
740
|
+
className: "minimal-toolbar-row",
|
|
741
|
+
children: [
|
|
742
|
+
/*#__PURE__*/ jsxs("div", {
|
|
743
|
+
className: "minimal-toolbar-left",
|
|
744
|
+
children: [
|
|
745
|
+
/*#__PURE__*/ jsx(Dropdown, {
|
|
746
|
+
menu: actionDropdownMenu,
|
|
747
|
+
placement: "topLeft",
|
|
748
|
+
trigger: [
|
|
749
|
+
'click'
|
|
750
|
+
],
|
|
751
|
+
disabled: !runButtonEnabled,
|
|
752
|
+
overlayClassName: "more-apis-dropdown",
|
|
753
|
+
children: /*#__PURE__*/ jsxs("button", {
|
|
754
|
+
"aria-label": `Select action type (current: ${actionButtonLabel})`,
|
|
755
|
+
className: "minimal-action-trigger",
|
|
756
|
+
disabled: !runButtonEnabled,
|
|
757
|
+
type: "button",
|
|
758
|
+
children: [
|
|
759
|
+
(null == chrome ? void 0 : null == (_chrome_icons = chrome.icons) ? void 0 : _chrome_icons.action) ? /*#__PURE__*/ jsx("img", {
|
|
760
|
+
alt: "",
|
|
761
|
+
className: "minimal-action-icon",
|
|
762
|
+
src: chrome.icons.action
|
|
763
|
+
}) : null,
|
|
764
|
+
/*#__PURE__*/ jsx("span", {
|
|
765
|
+
className: "minimal-action-label",
|
|
766
|
+
children: actionButtonLabel
|
|
767
|
+
}),
|
|
768
|
+
(null == chrome ? void 0 : null == (_chrome_icons1 = chrome.icons) ? void 0 : _chrome_icons1.actionChevron) ? /*#__PURE__*/ jsx("img", {
|
|
769
|
+
alt: "",
|
|
770
|
+
className: "minimal-action-chevron",
|
|
771
|
+
src: chrome.icons.actionChevron
|
|
772
|
+
}) : /*#__PURE__*/ jsx(DownOutlined, {
|
|
773
|
+
className: "minimal-action-chevron-fallback"
|
|
774
|
+
})
|
|
775
|
+
]
|
|
776
|
+
})
|
|
777
|
+
}),
|
|
778
|
+
/*#__PURE__*/ jsx(HistorySelector, {
|
|
779
|
+
onSelect: handleSelectHistory,
|
|
780
|
+
history: historyForSelectedType,
|
|
781
|
+
currentType: selectedType,
|
|
782
|
+
trigger: /*#__PURE__*/ jsx("button", {
|
|
783
|
+
"aria-label": "Open prompt history",
|
|
784
|
+
className: "minimal-icon-trigger",
|
|
785
|
+
type: "button",
|
|
786
|
+
children: (null == chrome ? void 0 : null == (_chrome_icons2 = chrome.icons) ? void 0 : _chrome_icons2.history) ? /*#__PURE__*/ jsx("img", {
|
|
787
|
+
alt: "",
|
|
788
|
+
className: "minimal-toolbar-icon",
|
|
789
|
+
src: chrome.icons.history
|
|
790
|
+
}) : /*#__PURE__*/ jsx(icons_history, {
|
|
791
|
+
className: "minimal-toolbar-icon minimal-toolbar-icon-history minimal-toolbar-icon-fallback",
|
|
792
|
+
width: 18,
|
|
793
|
+
height: 18
|
|
794
|
+
})
|
|
795
|
+
})
|
|
796
|
+
}),
|
|
797
|
+
hasConfigOptions ? /*#__PURE__*/ jsx("div", {
|
|
798
|
+
className: hoveringSettings ? 'settings-wrapper settings-wrapper-hover' : 'settings-wrapper',
|
|
799
|
+
onMouseEnter: handleMouseEnter,
|
|
800
|
+
onMouseLeave: handleMouseLeave,
|
|
801
|
+
children: /*#__PURE__*/ jsx(ConfigSelector, {
|
|
802
|
+
enableTracking: 'In-Browser-Extension' === serviceMode,
|
|
803
|
+
showDeepLocateOption: showDeepLocateOption,
|
|
804
|
+
showDeepThinkOption: showDeepThinkOption,
|
|
805
|
+
showDataExtractionOptions: showDataExtractionOptions,
|
|
806
|
+
hideDomAndScreenshotOptions: hideDomAndScreenshotOptions,
|
|
807
|
+
deviceType: deviceType,
|
|
808
|
+
trigger: /*#__PURE__*/ jsx("button", {
|
|
809
|
+
"aria-label": "Open run configuration",
|
|
810
|
+
className: "minimal-icon-trigger",
|
|
811
|
+
type: "button",
|
|
812
|
+
children: (null == chrome ? void 0 : null == (_chrome_icons3 = chrome.icons) ? void 0 : _chrome_icons3.settings) ? /*#__PURE__*/ jsx("img", {
|
|
813
|
+
alt: "",
|
|
814
|
+
className: "minimal-toolbar-icon",
|
|
815
|
+
src: chrome.icons.settings
|
|
816
|
+
}) : /*#__PURE__*/ jsx(setting, {
|
|
817
|
+
className: "minimal-toolbar-icon minimal-toolbar-icon-fallback",
|
|
818
|
+
width: 16,
|
|
819
|
+
height: 16
|
|
820
|
+
})
|
|
821
|
+
})
|
|
822
|
+
})
|
|
823
|
+
}) : null
|
|
824
|
+
]
|
|
825
|
+
}),
|
|
826
|
+
/*#__PURE__*/ jsx("div", {
|
|
827
|
+
className: "form-controller-wrapper",
|
|
828
|
+
children: renderActionButton()
|
|
829
|
+
})
|
|
830
|
+
]
|
|
831
|
+
})
|
|
832
|
+
]
|
|
833
|
+
})
|
|
834
|
+
]
|
|
835
|
+
});
|
|
836
|
+
}
|
|
552
837
|
return /*#__PURE__*/ jsxs("div", {
|
|
553
838
|
className: "prompt-input-wrapper",
|
|
554
839
|
children: [
|
|
@@ -580,87 +865,7 @@ const PromptInput = ({ runButtonEnabled, form, serviceMode, selectedType, dryMod
|
|
|
580
865
|
})
|
|
581
866
|
}),
|
|
582
867
|
/*#__PURE__*/ jsx(Dropdown, {
|
|
583
|
-
menu:
|
|
584
|
-
const hiddenAPIs = availableDropdownMethods.filter((api)=>!defaultMainButtons.includes(api));
|
|
585
|
-
const groupedItems = [];
|
|
586
|
-
const interactionAPIs = hiddenAPIs.filter((api)=>{
|
|
587
|
-
var _apiMetadata_api;
|
|
588
|
-
return (null == (_apiMetadata_api = apiMetadata[api]) ? void 0 : _apiMetadata_api.group) === 'interaction';
|
|
589
|
-
});
|
|
590
|
-
if (interactionAPIs.length > 0) groupedItems.push({
|
|
591
|
-
key: 'interaction-group',
|
|
592
|
-
type: 'group',
|
|
593
|
-
label: 'Interaction APIs',
|
|
594
|
-
children: interactionAPIs.map((api)=>{
|
|
595
|
-
var _apiMetadata_api;
|
|
596
|
-
return {
|
|
597
|
-
key: api,
|
|
598
|
-
label: actionNameForType(api),
|
|
599
|
-
title: (null == (_apiMetadata_api = apiMetadata[api]) ? void 0 : _apiMetadata_api.title) || '',
|
|
600
|
-
onClick: ()=>{
|
|
601
|
-
form.setFieldValue('type', api);
|
|
602
|
-
}
|
|
603
|
-
};
|
|
604
|
-
})
|
|
605
|
-
});
|
|
606
|
-
const extractionAPIs = hiddenAPIs.filter((api)=>{
|
|
607
|
-
var _apiMetadata_api;
|
|
608
|
-
return (null == (_apiMetadata_api = apiMetadata[api]) ? void 0 : _apiMetadata_api.group) === 'extraction';
|
|
609
|
-
});
|
|
610
|
-
if (extractionAPIs.length > 0) groupedItems.push({
|
|
611
|
-
key: 'extraction-group',
|
|
612
|
-
type: 'group',
|
|
613
|
-
label: 'Data Extraction APIs',
|
|
614
|
-
children: extractionAPIs.map((api)=>{
|
|
615
|
-
var _apiMetadata_api;
|
|
616
|
-
return {
|
|
617
|
-
key: api,
|
|
618
|
-
label: actionNameForType(api),
|
|
619
|
-
title: (null == (_apiMetadata_api = apiMetadata[api]) ? void 0 : _apiMetadata_api.title) || '',
|
|
620
|
-
onClick: ()=>{
|
|
621
|
-
form.setFieldValue('type', api);
|
|
622
|
-
}
|
|
623
|
-
};
|
|
624
|
-
})
|
|
625
|
-
});
|
|
626
|
-
const validationAPIs = hiddenAPIs.filter((api)=>{
|
|
627
|
-
var _apiMetadata_api;
|
|
628
|
-
return (null == (_apiMetadata_api = apiMetadata[api]) ? void 0 : _apiMetadata_api.group) === 'validation';
|
|
629
|
-
});
|
|
630
|
-
if (validationAPIs.length > 0) groupedItems.push({
|
|
631
|
-
key: 'validation-group',
|
|
632
|
-
type: 'group',
|
|
633
|
-
label: 'Validation APIs',
|
|
634
|
-
children: validationAPIs.map((api)=>{
|
|
635
|
-
var _apiMetadata_api;
|
|
636
|
-
return {
|
|
637
|
-
key: api,
|
|
638
|
-
label: actionNameForType(api),
|
|
639
|
-
title: (null == (_apiMetadata_api = apiMetadata[api]) ? void 0 : _apiMetadata_api.title) || '',
|
|
640
|
-
onClick: ()=>{
|
|
641
|
-
form.setFieldValue('type', api);
|
|
642
|
-
}
|
|
643
|
-
};
|
|
644
|
-
})
|
|
645
|
-
});
|
|
646
|
-
const deviceSpecificAPIs = hiddenAPIs.filter((api)=>!apiMetadata[api]);
|
|
647
|
-
if (deviceSpecificAPIs.length > 0) groupedItems.push({
|
|
648
|
-
key: 'device-specific-group',
|
|
649
|
-
type: 'group',
|
|
650
|
-
label: 'Device-Specific APIs',
|
|
651
|
-
children: deviceSpecificAPIs.map((api)=>({
|
|
652
|
-
key: api,
|
|
653
|
-
label: actionNameForType(api),
|
|
654
|
-
title: '',
|
|
655
|
-
onClick: ()=>{
|
|
656
|
-
form.setFieldValue('type', api);
|
|
657
|
-
}
|
|
658
|
-
}))
|
|
659
|
-
});
|
|
660
|
-
return {
|
|
661
|
-
items: groupedItems
|
|
662
|
-
};
|
|
663
|
-
})(),
|
|
868
|
+
menu: moreApisDropdownMenu,
|
|
664
869
|
placement: "bottomLeft",
|
|
665
870
|
trigger: [
|
|
666
871
|
'click'
|
|
@@ -710,37 +915,7 @@ const PromptInput = ({ runButtonEnabled, form, serviceMode, selectedType, dryMod
|
|
|
710
915
|
/*#__PURE__*/ jsxs("div", {
|
|
711
916
|
className: `main-side-console-input ${!runButtonEnabled ? 'disabled' : ''} ${loading ? 'loading' : ''}`,
|
|
712
917
|
children: [
|
|
713
|
-
|
|
714
|
-
className: "structured-params-container",
|
|
715
|
-
children: renderStructuredParams()
|
|
716
|
-
}) : /*#__PURE__*/ jsx(Form.Item, {
|
|
717
|
-
name: "prompt",
|
|
718
|
-
style: {
|
|
719
|
-
margin: 0
|
|
720
|
-
},
|
|
721
|
-
children: /*#__PURE__*/ jsx(TextArea, {
|
|
722
|
-
className: "main-side-console-input-textarea",
|
|
723
|
-
disabled: !runButtonEnabled,
|
|
724
|
-
rows: 3,
|
|
725
|
-
placeholder: placeholder,
|
|
726
|
-
autoFocus: true,
|
|
727
|
-
onKeyDown: handleKeyDown,
|
|
728
|
-
onChange: handlePromptChange,
|
|
729
|
-
ref: textAreaRef
|
|
730
|
-
})
|
|
731
|
-
}) : /*#__PURE__*/ jsxs("div", {
|
|
732
|
-
className: "no-input-method",
|
|
733
|
-
style: {
|
|
734
|
-
padding: '20px',
|
|
735
|
-
textAlign: 'center',
|
|
736
|
-
color: '#666',
|
|
737
|
-
fontSize: '14px'
|
|
738
|
-
},
|
|
739
|
-
children: [
|
|
740
|
-
'Click "Run" to execute ',
|
|
741
|
-
actionNameForType(selectedType)
|
|
742
|
-
]
|
|
743
|
-
}),
|
|
918
|
+
inputContent,
|
|
744
919
|
/*#__PURE__*/ jsx("div", {
|
|
745
920
|
className: "form-controller-wrapper",
|
|
746
921
|
children: renderActionButton()
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
.playground-container {
|
|
2
|
-
background: #fff;
|
|
3
|
-
flex-direction: column;
|
|
2
|
+
background: var(--midscene-surface, #fff);
|
|
4
3
|
width: 100%;
|
|
5
4
|
height: 100vh;
|
|
5
|
+
color: var(--midscene-text-primary, inherit);
|
|
6
|
+
flex-direction: column;
|
|
6
7
|
display: flex;
|
|
7
8
|
position: relative;
|
|
8
9
|
}
|
|
@@ -90,8 +91,8 @@
|
|
|
90
91
|
|
|
91
92
|
.playground-container .middle-dialog-area .scroll-to-bottom-button {
|
|
92
93
|
z-index: 10;
|
|
93
|
-
background: #fff;
|
|
94
|
-
border: 1px solid rgba(0, 0, 0, .08);
|
|
94
|
+
background: var(--midscene-surface-elevated, #fff);
|
|
95
|
+
border: 1px solid var(--midscene-border-strong, rgba(0, 0, 0, .08));
|
|
95
96
|
position: absolute;
|
|
96
97
|
bottom: 10px;
|
|
97
98
|
right: 0;
|
|
@@ -118,9 +119,9 @@
|
|
|
118
119
|
}
|
|
119
120
|
|
|
120
121
|
.playground-container .user-message-container .user-message-bubble {
|
|
121
|
-
|
|
122
|
+
background: var(--midscene-surface-muted, #f2f4f7);
|
|
123
|
+
color: var(--midscene-text-primary, rgba(0, 0, 0, .85));
|
|
122
124
|
text-align: left;
|
|
123
|
-
background: #f2f4f7;
|
|
124
125
|
border-radius: 12px;
|
|
125
126
|
max-width: 80%;
|
|
126
127
|
padding: 12px 16px;
|
|
@@ -130,8 +131,8 @@
|
|
|
130
131
|
}
|
|
131
132
|
|
|
132
133
|
.playground-container .progress-action-item {
|
|
133
|
-
|
|
134
|
-
|
|
134
|
+
background: var(--midscene-surface-muted, #f2f4f7);
|
|
135
|
+
color: var(--midscene-text-primary, #000);
|
|
135
136
|
border-radius: 8px;
|
|
136
137
|
justify-content: space-between;
|
|
137
138
|
height: 36px;
|
|
@@ -185,12 +186,12 @@
|
|
|
185
186
|
}
|
|
186
187
|
|
|
187
188
|
.playground-container .system-message-container .system-message-content {
|
|
188
|
-
color: rgba(0, 0, 0, .85);
|
|
189
|
+
color: var(--midscene-text-primary, rgba(0, 0, 0, .85));
|
|
189
190
|
font-size: 14px;
|
|
190
191
|
}
|
|
191
192
|
|
|
192
193
|
.playground-container .system-message-container .system-message-content .system-message-text {
|
|
193
|
-
color: rgba(0, 0, 0, .85);
|
|
194
|
+
color: var(--midscene-text-primary, rgba(0, 0, 0, .85));
|
|
194
195
|
font-size: 14px;
|
|
195
196
|
line-height: 25px;
|
|
196
197
|
}
|
|
@@ -237,7 +238,7 @@
|
|
|
237
238
|
}
|
|
238
239
|
|
|
239
240
|
.playground-container .new-conversation-separator .separator-line {
|
|
240
|
-
background-color: #e8e8e8;
|
|
241
|
+
background-color: var(--midscene-divider, #e8e8e8);
|
|
241
242
|
height: 1px;
|
|
242
243
|
position: absolute;
|
|
243
244
|
top: 50%;
|
|
@@ -246,20 +247,51 @@
|
|
|
246
247
|
}
|
|
247
248
|
|
|
248
249
|
.playground-container .new-conversation-separator .separator-text-container {
|
|
250
|
+
background-color: var(--midscene-surface, #fff);
|
|
249
251
|
z-index: 1;
|
|
250
|
-
background-color: #fff;
|
|
251
252
|
padding: 0 16px;
|
|
252
253
|
position: relative;
|
|
253
254
|
}
|
|
254
255
|
|
|
255
256
|
.playground-container .new-conversation-separator .separator-text-container .separator-text {
|
|
256
|
-
color: #999;
|
|
257
|
-
background-color: #fff;
|
|
257
|
+
color: var(--midscene-text-tertiary, #999);
|
|
258
|
+
background-color: var(--midscene-surface, #fff);
|
|
258
259
|
font-size: 12px;
|
|
259
260
|
}
|
|
260
261
|
|
|
262
|
+
.playground-container .progress-group-toggle {
|
|
263
|
+
cursor: pointer;
|
|
264
|
+
color: var(--midscene-text-tertiary, rgba(0, 0, 0, .5));
|
|
265
|
+
-webkit-user-select: none;
|
|
266
|
+
-moz-user-select: none;
|
|
267
|
+
user-select: none;
|
|
268
|
+
background: none;
|
|
269
|
+
border: 0;
|
|
270
|
+
align-items: center;
|
|
271
|
+
gap: 8px;
|
|
272
|
+
margin: 0 0 8px;
|
|
273
|
+
padding: 0 4px;
|
|
274
|
+
font-size: 12px;
|
|
275
|
+
font-weight: 500;
|
|
276
|
+
line-height: 15px;
|
|
277
|
+
display: inline-flex;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
.playground-container .progress-group-toggle:hover {
|
|
281
|
+
color: var(--midscene-text-secondary, rgba(0, 0, 0, .7));
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
.playground-container .progress-group-toggle .progress-group-toggle-chevron {
|
|
285
|
+
font-size: 10px;
|
|
286
|
+
transition: transform .15s ease-out;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
.playground-container .progress-group-toggle.is-collapsed .progress-group-toggle-chevron {
|
|
290
|
+
transform: rotate(180deg);
|
|
291
|
+
}
|
|
292
|
+
|
|
261
293
|
.playground-container .bottom-input-section {
|
|
262
|
-
background-color: #fff;
|
|
294
|
+
background-color: var(--midscene-surface, #fff);
|
|
263
295
|
flex-shrink: 0;
|
|
264
296
|
padding: 16px 0 0;
|
|
265
297
|
}
|