@rpascene/visualizer 0.30.17 → 0.30.18

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.
@@ -12,7 +12,7 @@ import { BooleanField, EnumField, LocateField, NumberField, TextField } from "..
12
12
  import { HistorySelector } from "../history-selector/index.mjs";
13
13
  const { TextArea } = Input;
14
14
  const PromptInput = (param)=>{
15
- let { runButtonEnabled, form, serviceMode, selectedType, dryMode, stoppable, loading, onRun, onStop, clearPromptAfterRun = true, actionSpace, hideDomAndScreenshotOptions = false } = param;
15
+ let { runButtonEnabled, form, serviceMode, selectedType, dryMode, stoppable, loading, onRun, onStop, clearPromptAfterRun = true, actionSpace, hideDomAndScreenshotOptions = false, defaultSelectedType } = param;
16
16
  const [hoveringSettings, setHoveringSettings] = useState(false);
17
17
  const [promptValue, setPromptValue] = useState('');
18
18
  const placeholder = getPlaceholderForType(selectedType);
@@ -149,9 +149,13 @@ const PromptInput = (param)=>{
149
149
  actionSpace
150
150
  ]);
151
151
  useEffect(()=>{
152
- if (!form.getFieldValue('type') && lastSelectedType) form.setFieldValue('type', lastSelectedType);
152
+ if (!form.getFieldValue('type')) {
153
+ if (defaultSelectedType) form.setFieldValue('type', defaultSelectedType);
154
+ else if (lastSelectedType) form.setFieldValue('type', lastSelectedType);
155
+ }
153
156
  }, [
154
157
  form,
158
+ defaultSelectedType,
155
159
  lastSelectedType
156
160
  ]);
157
161
  useEffect(()=>{
@@ -183,20 +187,15 @@ const PromptInput = (param)=>{
183
187
  }
184
188
  }, []);
185
189
  useEffect(()=>{
186
- const lastHistory = historyForSelectedType[0];
187
- if (lastHistory && lastHistoryRef.current && lastHistory.timestamp === lastHistoryRef.current.timestamp) return;
188
- {
189
- const defaultParams = getDefaultParams();
190
- form.setFieldsValue({
191
- prompt: '',
192
- params: defaultParams
193
- });
194
- setPromptValue('');
195
- lastHistoryRef.current = null;
196
- }
190
+ const defaultParams = getDefaultParams();
191
+ form.setFieldsValue({
192
+ prompt: '',
193
+ params: defaultParams
194
+ });
195
+ setPromptValue('');
197
196
  }, [
198
197
  selectedType,
199
- historyForSelectedType,
198
+ setPromptValue,
200
199
  form,
201
200
  getDefaultParams
202
201
  ]);
@@ -12,7 +12,6 @@ import { PromptInput } from "../prompt-input/index.mjs";
12
12
  import { createStorageProvider, detectBestStorageType } from "./providers/storage-provider.mjs";
13
13
  import { overrideAIConfig } from "@rpascene/shared/env";
14
14
  import { commandMap } from "@rpascene/shared/constants";
15
- import { useHistoryStore } from "../../store/history.mjs";
16
15
  import "./index.css";
17
16
  const { Text } = Typography;
18
17
  function getSDKId(sdk) {
@@ -48,7 +47,6 @@ function UniversalPlayground(param) {
48
47
  const { config } = useEnvConfig();
49
48
  const [sdkReady, setSdkReady] = useState(false);
50
49
  const ref = useRef(null);
51
- const setLastSelectedType = useHistoryStore((state)=>state.setLastSelectedType);
52
50
  useEffect(()=>{
53
51
  const initializeSDK = async ()=>{
54
52
  if (playgroundSDK && 'function' == typeof playgroundSDK.checkStatus) try {
@@ -142,13 +140,10 @@ function UniversalPlayground(param) {
142
140
  handleStop
143
141
  ]);
144
142
  useEffect(()=>{
145
- if (defaultSelectedType) {
146
- setLastSelectedType(defaultSelectedType);
147
- form.setFieldValue('type', defaultSelectedType);
148
- }
143
+ if (defaultSelectedType && !showPromptInput) form.setFieldValue('type', defaultSelectedType);
149
144
  }, [
150
145
  defaultSelectedType,
151
- setLastSelectedType
146
+ showPromptInput
152
147
  ]);
153
148
  return /*#__PURE__*/ jsx("div", {
154
149
  id: "playground-container",
@@ -416,7 +411,7 @@ function UniversalPlayground(param) {
416
411
  ]
417
412
  }),
418
413
  /*#__PURE__*/ jsx("div", {
419
- className: "bottom-input-section aaa",
414
+ className: "bottom-input-section",
420
415
  children: showPromptInput && /*#__PURE__*/ jsx(PromptInput, {
421
416
  runButtonEnabled: runButtonEnabled,
422
417
  form: form,
@@ -427,7 +422,8 @@ function UniversalPlayground(param) {
427
422
  loading: loading,
428
423
  onRun: handleFormRun,
429
424
  onStop: handleStop,
430
- actionSpace: actionSpace
425
+ actionSpace: actionSpace,
426
+ defaultSelectedType: defaultSelectedType
431
427
  })
432
428
  }),
433
429
  showVersionInfo && branding.version && /*#__PURE__*/ jsx("div", {
@@ -50,7 +50,7 @@ const external_form_field_index_js_namespaceObject = require("../form-field/inde
50
50
  const external_history_selector_index_js_namespaceObject = require("../history-selector/index.js");
51
51
  const { TextArea } = external_antd_namespaceObject.Input;
52
52
  const PromptInput = (param)=>{
53
- let { runButtonEnabled, form, serviceMode, selectedType, dryMode, stoppable, loading, onRun, onStop, clearPromptAfterRun = true, actionSpace, hideDomAndScreenshotOptions = false } = param;
53
+ let { runButtonEnabled, form, serviceMode, selectedType, dryMode, stoppable, loading, onRun, onStop, clearPromptAfterRun = true, actionSpace, hideDomAndScreenshotOptions = false, defaultSelectedType } = param;
54
54
  const [hoveringSettings, setHoveringSettings] = (0, external_react_namespaceObject.useState)(false);
55
55
  const [promptValue, setPromptValue] = (0, external_react_namespaceObject.useState)('');
56
56
  const placeholder = (0, playground_utils_js_namespaceObject.getPlaceholderForType)(selectedType);
@@ -187,9 +187,13 @@ const PromptInput = (param)=>{
187
187
  actionSpace
188
188
  ]);
189
189
  (0, external_react_namespaceObject.useEffect)(()=>{
190
- if (!form.getFieldValue('type') && lastSelectedType) form.setFieldValue('type', lastSelectedType);
190
+ if (!form.getFieldValue('type')) {
191
+ if (defaultSelectedType) form.setFieldValue('type', defaultSelectedType);
192
+ else if (lastSelectedType) form.setFieldValue('type', lastSelectedType);
193
+ }
191
194
  }, [
192
195
  form,
196
+ defaultSelectedType,
193
197
  lastSelectedType
194
198
  ]);
195
199
  (0, external_react_namespaceObject.useEffect)(()=>{
@@ -221,20 +225,15 @@ const PromptInput = (param)=>{
221
225
  }
222
226
  }, []);
223
227
  (0, external_react_namespaceObject.useEffect)(()=>{
224
- const lastHistory = historyForSelectedType[0];
225
- if (lastHistory && lastHistoryRef.current && lastHistory.timestamp === lastHistoryRef.current.timestamp) return;
226
- {
227
- const defaultParams = getDefaultParams();
228
- form.setFieldsValue({
229
- prompt: '',
230
- params: defaultParams
231
- });
232
- setPromptValue('');
233
- lastHistoryRef.current = null;
234
- }
228
+ const defaultParams = getDefaultParams();
229
+ form.setFieldsValue({
230
+ prompt: '',
231
+ params: defaultParams
232
+ });
233
+ setPromptValue('');
235
234
  }, [
236
235
  selectedType,
237
- historyForSelectedType,
236
+ setPromptValue,
238
237
  form,
239
238
  getDefaultParams
240
239
  ]);
@@ -52,7 +52,6 @@ const external_prompt_input_index_js_namespaceObject = require("../prompt-input/
52
52
  const storage_provider_js_namespaceObject = require("./providers/storage-provider.js");
53
53
  const env_namespaceObject = require("@rpascene/shared/env");
54
54
  const constants_namespaceObject = require("@rpascene/shared/constants");
55
- const history_js_namespaceObject = require("../../store/history.js");
56
55
  require("./index.css");
57
56
  const { Text } = external_antd_namespaceObject.Typography;
58
57
  function getSDKId(sdk) {
@@ -88,7 +87,6 @@ function UniversalPlayground(param) {
88
87
  const { config } = (0, store_js_namespaceObject.useEnvConfig)();
89
88
  const [sdkReady, setSdkReady] = (0, external_react_namespaceObject.useState)(false);
90
89
  const ref = (0, external_react_namespaceObject.useRef)(null);
91
- const setLastSelectedType = (0, history_js_namespaceObject.useHistoryStore)((state)=>state.setLastSelectedType);
92
90
  (0, external_react_namespaceObject.useEffect)(()=>{
93
91
  const initializeSDK = async ()=>{
94
92
  if (playgroundSDK && 'function' == typeof playgroundSDK.checkStatus) try {
@@ -182,13 +180,10 @@ function UniversalPlayground(param) {
182
180
  handleStop
183
181
  ]);
184
182
  (0, external_react_namespaceObject.useEffect)(()=>{
185
- if (defaultSelectedType) {
186
- setLastSelectedType(defaultSelectedType);
187
- form.setFieldValue('type', defaultSelectedType);
188
- }
183
+ if (defaultSelectedType && !showPromptInput) form.setFieldValue('type', defaultSelectedType);
189
184
  }, [
190
185
  defaultSelectedType,
191
- setLastSelectedType
186
+ showPromptInput
192
187
  ]);
193
188
  return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
194
189
  id: "playground-container",
@@ -456,7 +451,7 @@ function UniversalPlayground(param) {
456
451
  ]
457
452
  }),
458
453
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
459
- className: "bottom-input-section aaa",
454
+ className: "bottom-input-section",
460
455
  children: showPromptInput && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_prompt_input_index_js_namespaceObject.PromptInput, {
461
456
  runButtonEnabled: runButtonEnabled,
462
457
  form: form,
@@ -467,7 +462,8 @@ function UniversalPlayground(param) {
467
462
  loading: loading,
468
463
  onRun: handleFormRun,
469
464
  onStop: handleStop,
470
- actionSpace: actionSpace
465
+ actionSpace: actionSpace,
466
+ defaultSelectedType: defaultSelectedType
471
467
  })
472
468
  }),
473
469
  showVersionInfo && branding.version && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
@@ -17,6 +17,7 @@ interface PromptInputProps {
17
17
  clearPromptAfterRun?: boolean;
18
18
  hideDomAndScreenshotOptions?: boolean;
19
19
  actionSpace: DeviceAction<any>[];
20
+ defaultSelectedType?: string;
20
21
  }
21
22
  export declare const PromptInput: React.FC<PromptInputProps>;
22
23
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpascene/visualizer",
3
- "version": "0.30.17",
3
+ "version": "0.30.18",
4
4
  "description": "RPA visualizer",
5
5
  "repository": "",
6
6
  "homepage": "",
@@ -72,10 +72,10 @@
72
72
  "antd": "^5.21.6",
73
73
  "buffer": "6.0.3",
74
74
  "dayjs": "^1.11.11",
75
- "@rpascene/core": "0.30.17",
76
- "@rpascene/web": "0.30.17",
77
- "@rpascene/playground": "0.30.17",
78
- "@rpascene/shared": "0.30.17"
75
+ "@rpascene/core": "0.30.18",
76
+ "@rpascene/playground": "0.30.18",
77
+ "@rpascene/web": "0.30.18",
78
+ "@rpascene/shared": "0.30.18"
79
79
  },
80
80
  "license": "MIT",
81
81
  "scripts": {