@godscene/visualizer 1.7.11

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.
Files changed (221) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +9 -0
  3. package/dist/es/component/blackboard/highlights.mjs +47 -0
  4. package/dist/es/component/blackboard/index.css +118 -0
  5. package/dist/es/component/blackboard/index.mjs +122 -0
  6. package/dist/es/component/config-selector/index.mjs +251 -0
  7. package/dist/es/component/context-preview/index.mjs +37 -0
  8. package/dist/es/component/env-config/index.mjs +237 -0
  9. package/dist/es/component/env-config-reminder/index.css +30 -0
  10. package/dist/es/component/env-config-reminder/index.mjs +27 -0
  11. package/dist/es/component/form-field/index.mjs +158 -0
  12. package/dist/es/component/history-selector/index.css +237 -0
  13. package/dist/es/component/history-selector/index.mjs +197 -0
  14. package/dist/es/component/index.mjs +1 -0
  15. package/dist/es/component/logo/index.css +19 -0
  16. package/dist/es/component/logo/index.mjs +20 -0
  17. package/dist/es/component/logo/logo.mjs +2 -0
  18. package/dist/es/component/misc/index.mjs +96 -0
  19. package/dist/es/component/nav-actions/index.mjs +14 -0
  20. package/dist/es/component/nav-actions/style.css +35 -0
  21. package/dist/es/component/player/index.css +296 -0
  22. package/dist/es/component/player/index.mjs +702 -0
  23. package/dist/es/component/player/playback-controls.mjs +4 -0
  24. package/dist/es/component/player/report-download.mjs +61 -0
  25. package/dist/es/component/player/scenes/StepScene.mjs +194 -0
  26. package/dist/es/component/player/scenes/derive-frame-state.mjs +229 -0
  27. package/dist/es/component/player/scenes/export-branded-video.mjs +360 -0
  28. package/dist/es/component/player/scenes/frame-calculator.mjs +149 -0
  29. package/dist/es/component/player/scenes/playback-frame.mjs +6 -0
  30. package/dist/es/component/player/scenes/playback-layout.mjs +12 -0
  31. package/dist/es/component/player/scenes/pointer-layout.mjs +36 -0
  32. package/dist/es/component/player/use-frame-player.mjs +87 -0
  33. package/dist/es/component/playground/index.css +930 -0
  34. package/dist/es/component/playground/playground-demo-ui-context.json +290 -0
  35. package/dist/es/component/playground-result/index.css +92 -0
  36. package/dist/es/component/playground-result/index.mjs +232 -0
  37. package/dist/es/component/prompt-input/index.css +832 -0
  38. package/dist/es/component/prompt-input/index.mjs +959 -0
  39. package/dist/es/component/screenshot-viewer/index.css +237 -0
  40. package/dist/es/component/screenshot-viewer/index.mjs +319 -0
  41. package/dist/es/component/service-mode-control/index.mjs +107 -0
  42. package/dist/es/component/shiny-text/index.css +107 -0
  43. package/dist/es/component/shiny-text/index.mjs +15 -0
  44. package/dist/es/component/universal-playground/empty-state.mjs +5 -0
  45. package/dist/es/component/universal-playground/index.css +619 -0
  46. package/dist/es/component/universal-playground/index.mjs +558 -0
  47. package/dist/es/component/universal-playground/providers/context-provider.mjs +90 -0
  48. package/dist/es/component/universal-playground/providers/indexeddb-storage-provider.mjs +280 -0
  49. package/dist/es/component/universal-playground/providers/storage-provider.mjs +279 -0
  50. package/dist/es/component/universal-playground/universal-playground-electron.mjs +668 -0
  51. package/dist/es/hooks/useMinimalTypeGate.mjs +47 -0
  52. package/dist/es/hooks/usePlaygroundExecution.mjs +435 -0
  53. package/dist/es/hooks/usePlaygroundState.mjs +278 -0
  54. package/dist/es/hooks/useSafeOverrideAIConfig.mjs +20 -0
  55. package/dist/es/hooks/useServerValid.mjs +55 -0
  56. package/dist/es/hooks/useTheme.mjs +25 -0
  57. package/dist/es/icons/action-chevron.mjs +61 -0
  58. package/dist/es/icons/avatar.mjs +70 -0
  59. package/dist/es/icons/close.mjs +61 -0
  60. package/dist/es/icons/global-perspective.mjs +58 -0
  61. package/dist/es/icons/history.mjs +72 -0
  62. package/dist/es/icons/magnifying-glass.mjs +81 -0
  63. package/dist/es/icons/player-setting.mjs +68 -0
  64. package/dist/es/icons/prompt-history.mjs +70 -0
  65. package/dist/es/icons/setting.mjs +62 -0
  66. package/dist/es/icons/show-marker.mjs +58 -0
  67. package/dist/es/index.mjs +26 -0
  68. package/dist/es/static/image/logo.png +0 -0
  69. package/dist/es/store/history.mjs +128 -0
  70. package/dist/es/store/store.mjs +277 -0
  71. package/dist/es/types.mjs +73 -0
  72. package/dist/es/utils/action-label.mjs +15 -0
  73. package/dist/es/utils/color.mjs +35 -0
  74. package/dist/es/utils/constants.mjs +99 -0
  75. package/dist/es/utils/device-capabilities.mjs +13 -0
  76. package/dist/es/utils/empty-state-scroll.mjs +8 -0
  77. package/dist/es/utils/highlight-element.mjs +62 -0
  78. package/dist/es/utils/index.mjs +13 -0
  79. package/dist/es/utils/playground-utils.mjs +43 -0
  80. package/dist/es/utils/progress-action-icon.mjs +30 -0
  81. package/dist/es/utils/prompt-input-utils.mjs +49 -0
  82. package/dist/es/utils/prompt-placeholder.mjs +19 -0
  83. package/dist/es/utils/replay-scripts.mjs +428 -0
  84. package/dist/lib/component/blackboard/highlights.js +84 -0
  85. package/dist/lib/component/blackboard/index.css +118 -0
  86. package/dist/lib/component/blackboard/index.js +169 -0
  87. package/dist/lib/component/config-selector/index.js +295 -0
  88. package/dist/lib/component/context-preview/index.js +82 -0
  89. package/dist/lib/component/env-config/index.js +271 -0
  90. package/dist/lib/component/env-config-reminder/index.css +30 -0
  91. package/dist/lib/component/env-config-reminder/index.js +61 -0
  92. package/dist/lib/component/form-field/index.js +204 -0
  93. package/dist/lib/component/history-selector/index.css +237 -0
  94. package/dist/lib/component/history-selector/index.js +243 -0
  95. package/dist/lib/component/index.js +58 -0
  96. package/dist/lib/component/logo/index.css +19 -0
  97. package/dist/lib/component/logo/index.js +67 -0
  98. package/dist/lib/component/logo/logo.js +24 -0
  99. package/dist/lib/component/misc/index.js +152 -0
  100. package/dist/lib/component/nav-actions/index.js +48 -0
  101. package/dist/lib/component/nav-actions/style.css +35 -0
  102. package/dist/lib/component/player/index.css +296 -0
  103. package/dist/lib/component/player/index.js +747 -0
  104. package/dist/lib/component/player/playback-controls.js +38 -0
  105. package/dist/lib/component/player/report-download.js +98 -0
  106. package/dist/lib/component/player/scenes/StepScene.js +228 -0
  107. package/dist/lib/component/player/scenes/derive-frame-state.js +266 -0
  108. package/dist/lib/component/player/scenes/export-branded-video.js +403 -0
  109. package/dist/lib/component/player/scenes/frame-calculator.js +186 -0
  110. package/dist/lib/component/player/scenes/playback-frame.js +40 -0
  111. package/dist/lib/component/player/scenes/playback-layout.js +46 -0
  112. package/dist/lib/component/player/scenes/pointer-layout.js +88 -0
  113. package/dist/lib/component/player/use-frame-player.js +121 -0
  114. package/dist/lib/component/playground/index.css +930 -0
  115. package/dist/lib/component/playground/playground-demo-ui-context.json +290 -0
  116. package/dist/lib/component/playground-result/index.css +92 -0
  117. package/dist/lib/component/playground-result/index.js +276 -0
  118. package/dist/lib/component/prompt-input/index.css +832 -0
  119. package/dist/lib/component/prompt-input/index.js +1005 -0
  120. package/dist/lib/component/screenshot-viewer/index.css +237 -0
  121. package/dist/lib/component/screenshot-viewer/index.js +353 -0
  122. package/dist/lib/component/service-mode-control/index.js +141 -0
  123. package/dist/lib/component/shiny-text/index.css +107 -0
  124. package/dist/lib/component/shiny-text/index.js +49 -0
  125. package/dist/lib/component/universal-playground/empty-state.js +39 -0
  126. package/dist/lib/component/universal-playground/index.css +619 -0
  127. package/dist/lib/component/universal-playground/index.js +607 -0
  128. package/dist/lib/component/universal-playground/providers/context-provider.js +133 -0
  129. package/dist/lib/component/universal-playground/providers/indexeddb-storage-provider.js +320 -0
  130. package/dist/lib/component/universal-playground/providers/storage-provider.js +337 -0
  131. package/dist/lib/component/universal-playground/universal-playground-electron.js +717 -0
  132. package/dist/lib/hooks/useMinimalTypeGate.js +81 -0
  133. package/dist/lib/hooks/usePlaygroundExecution.js +478 -0
  134. package/dist/lib/hooks/usePlaygroundState.js +312 -0
  135. package/dist/lib/hooks/useSafeOverrideAIConfig.js +57 -0
  136. package/dist/lib/hooks/useServerValid.js +89 -0
  137. package/dist/lib/hooks/useTheme.js +59 -0
  138. package/dist/lib/icons/action-chevron.js +95 -0
  139. package/dist/lib/icons/avatar.js +104 -0
  140. package/dist/lib/icons/close.js +95 -0
  141. package/dist/lib/icons/global-perspective.js +92 -0
  142. package/dist/lib/icons/history.js +106 -0
  143. package/dist/lib/icons/magnifying-glass.js +115 -0
  144. package/dist/lib/icons/player-setting.js +102 -0
  145. package/dist/lib/icons/prompt-history.js +104 -0
  146. package/dist/lib/icons/setting.js +96 -0
  147. package/dist/lib/icons/show-marker.js +92 -0
  148. package/dist/lib/index.js +204 -0
  149. package/dist/lib/static/image/logo.png +0 -0
  150. package/dist/lib/store/history.js +135 -0
  151. package/dist/lib/store/store.js +287 -0
  152. package/dist/lib/types.js +119 -0
  153. package/dist/lib/utils/action-label.js +52 -0
  154. package/dist/lib/utils/color.js +75 -0
  155. package/dist/lib/utils/constants.js +172 -0
  156. package/dist/lib/utils/device-capabilities.js +50 -0
  157. package/dist/lib/utils/empty-state-scroll.js +42 -0
  158. package/dist/lib/utils/highlight-element.js +99 -0
  159. package/dist/lib/utils/index.js +69 -0
  160. package/dist/lib/utils/playground-utils.js +86 -0
  161. package/dist/lib/utils/progress-action-icon.js +67 -0
  162. package/dist/lib/utils/prompt-input-utils.js +89 -0
  163. package/dist/lib/utils/prompt-placeholder.js +53 -0
  164. package/dist/lib/utils/replay-scripts.js +474 -0
  165. package/dist/types/component/blackboard/highlights.d.ts +11 -0
  166. package/dist/types/component/blackboard/index.d.ts +10 -0
  167. package/dist/types/component/config-selector/index.d.ts +15 -0
  168. package/dist/types/component/context-preview/index.d.ts +9 -0
  169. package/dist/types/component/env-config/index.d.ts +8 -0
  170. package/dist/types/component/env-config-reminder/index.d.ts +6 -0
  171. package/dist/types/component/form-field/index.d.ts +17 -0
  172. package/dist/types/component/history-selector/index.d.ts +13 -0
  173. package/dist/types/component/index.d.ts +1 -0
  174. package/dist/types/component/logo/index.d.ts +5 -0
  175. package/dist/types/component/misc/index.d.ts +6 -0
  176. package/dist/types/component/nav-actions/index.d.ts +12 -0
  177. package/dist/types/component/player/index.d.ts +15 -0
  178. package/dist/types/component/player/playback-controls.d.ts +1 -0
  179. package/dist/types/component/player/report-download.d.ts +32 -0
  180. package/dist/types/component/player/scenes/StepScene.d.ts +9 -0
  181. package/dist/types/component/player/scenes/derive-frame-state.d.ts +40 -0
  182. package/dist/types/component/player/scenes/export-branded-video.d.ts +33 -0
  183. package/dist/types/component/player/scenes/frame-calculator.d.ts +40 -0
  184. package/dist/types/component/player/scenes/playback-frame.d.ts +3 -0
  185. package/dist/types/component/player/scenes/playback-layout.d.ts +7 -0
  186. package/dist/types/component/player/scenes/pointer-layout.d.ts +20 -0
  187. package/dist/types/component/player/use-frame-player.d.ts +17 -0
  188. package/dist/types/component/playground-result/index.d.ts +22 -0
  189. package/dist/types/component/prompt-input/index.d.ts +23 -0
  190. package/dist/types/component/screenshot-viewer/index.d.ts +23 -0
  191. package/dist/types/component/service-mode-control/index.d.ts +6 -0
  192. package/dist/types/component/shiny-text/index.d.ts +12 -0
  193. package/dist/types/component/universal-playground/empty-state.d.ts +3 -0
  194. package/dist/types/component/universal-playground/index.d.ts +4 -0
  195. package/dist/types/component/universal-playground/providers/context-provider.d.ts +37 -0
  196. package/dist/types/component/universal-playground/providers/indexeddb-storage-provider.d.ts +71 -0
  197. package/dist/types/component/universal-playground/providers/storage-provider.d.ts +58 -0
  198. package/dist/types/component/universal-playground/universal-playground-electron.d.ts +4 -0
  199. package/dist/types/hooks/useMinimalTypeGate.d.ts +72 -0
  200. package/dist/types/hooks/usePlaygroundExecution.d.ts +40 -0
  201. package/dist/types/hooks/usePlaygroundState.d.ts +26 -0
  202. package/dist/types/hooks/useSafeOverrideAIConfig.d.ts +16 -0
  203. package/dist/types/hooks/useServerValid.d.ts +1 -0
  204. package/dist/types/hooks/useTheme.d.ts +7 -0
  205. package/dist/types/index.d.ts +29 -0
  206. package/dist/types/store/history.d.ts +16 -0
  207. package/dist/types/store/store.d.ts +57 -0
  208. package/dist/types/types.d.ts +278 -0
  209. package/dist/types/utils/action-label.d.ts +11 -0
  210. package/dist/types/utils/color.d.ts +4 -0
  211. package/dist/types/utils/constants.d.ts +80 -0
  212. package/dist/types/utils/device-capabilities.d.ts +9 -0
  213. package/dist/types/utils/empty-state-scroll.d.ts +11 -0
  214. package/dist/types/utils/highlight-element.d.ts +3 -0
  215. package/dist/types/utils/index.d.ts +5 -0
  216. package/dist/types/utils/playground-utils.d.ts +11 -0
  217. package/dist/types/utils/progress-action-icon.d.ts +12 -0
  218. package/dist/types/utils/prompt-input-utils.d.ts +24 -0
  219. package/dist/types/utils/prompt-placeholder.d.ts +1 -0
  220. package/dist/types/utils/replay-scripts.d.ts +50 -0
  221. package/package.json +82 -0
@@ -0,0 +1,237 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { SettingOutlined } from "@ant-design/icons";
3
+ import { Alert, Button, Input, Modal, Tooltip, message } from "antd";
4
+ import { useEffect, useRef, useState } from "react";
5
+ import { useEnvConfig } from "../../store/store.mjs";
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 }) {
33
+ const { config, configString, loadConfig, syncFromStorage } = useEnvConfig();
34
+ const [isModalOpen, setIsModalOpen] = useState(false);
35
+ const [tempConfigString, setTempConfigString] = useState(configString);
36
+ const [connectivityResult, setConnectivityResult] = useState(null);
37
+ const [connectivityLoading, setConnectivityLoading] = useState(false);
38
+ const midsceneModelName = config.MIDSCENE_MODEL_NAME;
39
+ const canRunConnectivityTest = !!(null == playgroundSDK ? void 0 : playgroundSDK.runConnectivityTest) && !!(null == playgroundSDK ? void 0 : playgroundSDK.overrideConfig);
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
+ };
48
+ const showModal = (e)=>{
49
+ syncFromStorage();
50
+ clearCloseTimer();
51
+ setIsModalOpen(true);
52
+ e.preventDefault();
53
+ e.stopPropagation();
54
+ };
55
+ const handleOk = ()=>{
56
+ clearCloseTimer();
57
+ setIsModalOpen(false);
58
+ loadConfig(tempConfigString);
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
+ })();
100
+ const handleCancel = ()=>{
101
+ clearCloseTimer();
102
+ setIsModalOpen(false);
103
+ };
104
+ useEffect(()=>{
105
+ if (isModalOpen) {
106
+ setTempConfigString(configString);
107
+ setConnectivityResult(null);
108
+ }
109
+ }, [
110
+ isModalOpen,
111
+ configString
112
+ ]);
113
+ useEffect(()=>()=>{
114
+ clearCloseTimer();
115
+ }, []);
116
+ return /*#__PURE__*/ jsxs("div", {
117
+ style: {
118
+ display: 'flex',
119
+ justifyContent: 'flex-end',
120
+ gap: '10px',
121
+ alignItems: 'center',
122
+ height: '100%',
123
+ minHeight: '32px'
124
+ },
125
+ ref: componentRef,
126
+ children: [
127
+ showModelName ? midsceneModelName : null,
128
+ /*#__PURE__*/ jsx(Tooltip, {
129
+ title: "Please set up your environment variables before using.",
130
+ placement: tooltipPlacement,
131
+ align: {
132
+ offset: [
133
+ -10,
134
+ 5
135
+ ]
136
+ },
137
+ getPopupContainer: ()=>componentRef.current,
138
+ open: isModalOpen ? false : showTooltipWhenEmpty ? 0 === Object.keys(config).length : void 0,
139
+ children: 'icon' === mode ? /*#__PURE__*/ jsx(SettingOutlined, {
140
+ onClick: showModal
141
+ }) : /*#__PURE__*/ jsx("span", {
142
+ onClick: showModal,
143
+ style: {
144
+ color: '#006AFF',
145
+ cursor: 'pointer'
146
+ },
147
+ children: "set up"
148
+ })
149
+ }),
150
+ /*#__PURE__*/ jsxs(Modal, {
151
+ title: "Model Env Config",
152
+ open: isModalOpen,
153
+ onOk: handleOk,
154
+ onCancel: handleCancel,
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
+ }),
177
+ style: {
178
+ width: '800px',
179
+ height: '100%',
180
+ marginTop: '10%'
181
+ },
182
+ destroyOnClose: true,
183
+ maskClosable: true,
184
+ centered: true,
185
+ children: [
186
+ /*#__PURE__*/ jsx(Input.TextArea, {
187
+ rows: 7,
188
+ placeholder: 'MIDSCENE_MODEL_API_KEY=sk-...\nMIDSCENE_MODEL_NAME=gpt-4o-2024-08-06\n...',
189
+ value: tempConfigString,
190
+ onChange: (e)=>setTempConfigString(e.target.value),
191
+ style: {
192
+ whiteSpace: 'nowrap',
193
+ wordWrap: 'break-word'
194
+ }
195
+ }),
196
+ /*#__PURE__*/ jsxs("div", {
197
+ children: [
198
+ /*#__PURE__*/ jsx("p", {
199
+ children: "The format is KEY=VALUE and separated by new lines."
200
+ }),
201
+ /*#__PURE__*/ jsxs("p", {
202
+ children: [
203
+ "These data will be saved ",
204
+ /*#__PURE__*/ jsx("strong", {
205
+ children: "locally in your browser"
206
+ }),
207
+ "."
208
+ ]
209
+ })
210
+ ]
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
232
+ ]
233
+ })
234
+ ]
235
+ });
236
+ }
237
+ export { EnvConfig };
@@ -0,0 +1,30 @@
1
+ .env-config-reminder {
2
+ background: #fff2e8;
3
+ border-radius: 12px;
4
+ align-items: center;
5
+ gap: 12px;
6
+ margin-bottom: 12px;
7
+ padding: 12px 16px;
8
+ display: flex;
9
+ }
10
+
11
+ .env-config-reminder .reminder-icon {
12
+ color: #fa541c;
13
+ width: 16px;
14
+ height: 16px;
15
+ }
16
+
17
+ .env-config-reminder .reminder-text {
18
+ color: #000;
19
+ flex: 1;
20
+ font-size: 14px;
21
+ }
22
+
23
+ [data-theme="dark"] .env-config-reminder {
24
+ background: rgba(82, 38, 7, .3);
25
+ }
26
+
27
+ [data-theme="dark"] .env-config-reminder .reminder-text {
28
+ color: #f8fafd;
29
+ }
30
+
@@ -0,0 +1,27 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { ExclamationCircleFilled } from "@ant-design/icons";
3
+ import { useEnvConfig } from "../../store/store.mjs";
4
+ import { EnvConfig } from "../env-config/index.mjs";
5
+ import "./index.css";
6
+ const EnvConfigReminder = ({ className = '' })=>{
7
+ const { config } = useEnvConfig();
8
+ const configAlreadySet = Object.keys(config || {}).length >= 1;
9
+ if (configAlreadySet) return null;
10
+ return /*#__PURE__*/ jsxs("div", {
11
+ className: `env-config-reminder ${className}`,
12
+ children: [
13
+ /*#__PURE__*/ jsx(ExclamationCircleFilled, {
14
+ className: "reminder-icon"
15
+ }),
16
+ /*#__PURE__*/ jsx("span", {
17
+ className: "reminder-text",
18
+ children: "Please set up your environment variables before using."
19
+ }),
20
+ /*#__PURE__*/ jsx(EnvConfig, {
21
+ mode: "text",
22
+ showTooltipWhenEmpty: false
23
+ })
24
+ ]
25
+ });
26
+ };
27
+ export { EnvConfigReminder };
@@ -0,0 +1,158 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Form, Input, InputNumber, Select } from "antd";
3
+ const { TextArea } = Input;
4
+ const renderLabel = (label, isOptional)=>`${label}${isOptional ? ' (Optional)' : ''}`;
5
+ const TextField = ({ name, label, isRequired, marginBottom, placeholder: customPlaceholder })=>{
6
+ const placeholder = customPlaceholder || `Enter ${name}`;
7
+ return /*#__PURE__*/ jsx(Form.Item, {
8
+ name: [
9
+ 'params',
10
+ name
11
+ ],
12
+ label: renderLabel(label, !isRequired),
13
+ rules: isRequired ? [
14
+ {
15
+ required: true,
16
+ message: `Please input ${name}`
17
+ }
18
+ ] : [],
19
+ style: {
20
+ marginBottom
21
+ },
22
+ colon: false,
23
+ children: /*#__PURE__*/ jsx(Input, {
24
+ placeholder: placeholder
25
+ })
26
+ }, name);
27
+ };
28
+ const LocateField = ({ name, label, isRequired, marginBottom, placeholder: customPlaceholder })=>{
29
+ const placeholder = customPlaceholder || `Describe the ${name}, use natural language`;
30
+ return /*#__PURE__*/ jsx(Form.Item, {
31
+ name: [
32
+ 'params',
33
+ name
34
+ ],
35
+ label: renderLabel(label, !isRequired),
36
+ rules: isRequired ? [
37
+ {
38
+ required: true,
39
+ message: `The ${name} is required`
40
+ }
41
+ ] : [],
42
+ style: {
43
+ marginBottom
44
+ },
45
+ colon: false,
46
+ children: /*#__PURE__*/ jsx(TextArea, {
47
+ rows: 2,
48
+ placeholder: placeholder
49
+ })
50
+ }, name);
51
+ };
52
+ const EnumField = ({ name, label, fieldSchema, isRequired, marginBottom, placeholder: customPlaceholder })=>{
53
+ var _fieldSchema__def;
54
+ const enumValues = (null == (_fieldSchema__def = fieldSchema._def) ? void 0 : _fieldSchema__def.values) || [];
55
+ const selectOptions = enumValues.map((value)=>({
56
+ value,
57
+ label: value.charAt(0).toUpperCase() + value.slice(1)
58
+ }));
59
+ return /*#__PURE__*/ jsx(Form.Item, {
60
+ name: [
61
+ 'params',
62
+ name
63
+ ],
64
+ label: label,
65
+ rules: isRequired ? [
66
+ {
67
+ required: true,
68
+ message: `Please select ${name}`
69
+ }
70
+ ] : [],
71
+ style: {
72
+ marginBottom
73
+ },
74
+ colon: false,
75
+ children: /*#__PURE__*/ jsx(Select, {
76
+ placeholder: customPlaceholder || `Select ${name}`,
77
+ options: selectOptions
78
+ })
79
+ }, name);
80
+ };
81
+ const NumberField = ({ name, label, isRequired, marginBottom, placeholder: customPlaceholder })=>{
82
+ const defaultPlaceholder = 'distance' === name ? 500 : 0;
83
+ const placeholderValue = customPlaceholder ? Number(customPlaceholder) || defaultPlaceholder : defaultPlaceholder;
84
+ const min = 0;
85
+ const max = 'distance' === name ? 10000 : void 0;
86
+ return /*#__PURE__*/ jsx(Form.Item, {
87
+ name: [
88
+ 'params',
89
+ name
90
+ ],
91
+ label: `${label}${'distance' === name ? ' (px)' : ''}`,
92
+ rules: isRequired ? [
93
+ {
94
+ required: true,
95
+ message: `Please input ${name}`
96
+ },
97
+ {
98
+ type: 'number',
99
+ min,
100
+ message: `${label} must be at least ${min}`
101
+ }
102
+ ] : [
103
+ {
104
+ type: 'number',
105
+ min,
106
+ message: `${label} must be at least ${min}`
107
+ }
108
+ ],
109
+ style: {
110
+ flex: 'distance' === name ? 1 : void 0,
111
+ marginBottom
112
+ },
113
+ colon: false,
114
+ children: /*#__PURE__*/ jsx(InputNumber, {
115
+ placeholder: placeholderValue.toString(),
116
+ min: min,
117
+ max: max,
118
+ step: 'distance' === name ? 10 : 1,
119
+ style: {
120
+ width: '100%'
121
+ }
122
+ })
123
+ }, name);
124
+ };
125
+ const BooleanField = ({ name, label, isRequired, marginBottom, placeholder: customPlaceholder })=>{
126
+ const selectOptions = [
127
+ {
128
+ value: true,
129
+ label: 'True'
130
+ },
131
+ {
132
+ value: false,
133
+ label: 'False'
134
+ }
135
+ ];
136
+ return /*#__PURE__*/ jsx(Form.Item, {
137
+ name: [
138
+ 'params',
139
+ name
140
+ ],
141
+ label: renderLabel(label, !isRequired),
142
+ rules: isRequired ? [
143
+ {
144
+ required: true,
145
+ message: `Please select ${name}`
146
+ }
147
+ ] : [],
148
+ style: {
149
+ marginBottom
150
+ },
151
+ colon: false,
152
+ children: /*#__PURE__*/ jsx(Select, {
153
+ placeholder: customPlaceholder || `Select ${name}`,
154
+ options: selectOptions
155
+ })
156
+ }, name);
157
+ };
158
+ export { BooleanField, EnumField, LocateField, NumberField, TextField };
@@ -0,0 +1,237 @@
1
+ .history-selector-wrapper {
2
+ position: relative;
3
+ }
4
+
5
+ .history-modal-overlay {
6
+ z-index: 9999;
7
+ background: #fff;
8
+ border: 1px solid rgba(0, 0, 0, .08);
9
+ border-radius: 12px;
10
+ width: 320px;
11
+ max-width: min(320px, 100vw - 32px);
12
+ height: 400px;
13
+ position: fixed;
14
+ box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
15
+ }
16
+
17
+ .history-modal-container {
18
+ border-radius: 12px;
19
+ flex-direction: column;
20
+ width: 100%;
21
+ height: 100%;
22
+ display: flex;
23
+ overflow: hidden;
24
+ }
25
+
26
+ .history-modal-container .history-modal-header {
27
+ justify-content: space-between;
28
+ align-items: center;
29
+ height: 48px;
30
+ padding: 0 25px;
31
+ line-height: 48px;
32
+ display: flex;
33
+ }
34
+
35
+ .history-modal-container .history-modal-header .close-button {
36
+ justify-content: center;
37
+ align-items: center;
38
+ margin-right: -4px;
39
+ padding: 4px;
40
+ display: flex;
41
+ }
42
+
43
+ .history-modal-container .history-modal-header .close-button .anticon {
44
+ color: #999;
45
+ font-size: 18px;
46
+ }
47
+
48
+ .history-modal-container .history-modal-header .close-button:hover .anticon {
49
+ color: #666;
50
+ }
51
+
52
+ .history-modal-container .history-search-section {
53
+ background: #fff;
54
+ padding: 16px 20px;
55
+ }
56
+
57
+ .history-modal-container .history-search-section .search-input-wrapper {
58
+ color: rgba(0, 0, 0, .25);
59
+ align-items: center;
60
+ gap: 12px;
61
+ display: flex;
62
+ }
63
+
64
+ .history-modal-container .history-search-section .search-input-wrapper .search-input {
65
+ background: #f1f2f3;
66
+ border: none;
67
+ border-radius: 16px;
68
+ flex: 1;
69
+ height: 36px;
70
+ }
71
+
72
+ .history-modal-container .history-search-section .search-input-wrapper .search-input .ant-input {
73
+ box-shadow: none;
74
+ background: none;
75
+ border: none;
76
+ }
77
+
78
+ .history-modal-container .history-search-section .search-input-wrapper .search-input:hover {
79
+ background: #fff;
80
+ border-color: #d9d9d9;
81
+ }
82
+
83
+ .history-modal-container .history-search-section .search-input-wrapper .search-input:focus-within {
84
+ background: #fff;
85
+ border-color: #d9d9d9;
86
+ }
87
+
88
+ .history-modal-container .history-search-section .search-input-wrapper .clear-button {
89
+ color: #1890ff;
90
+ height: auto;
91
+ padding: 0;
92
+ }
93
+
94
+ .history-modal-container .history-search-section .search-input-wrapper .clear-button:hover {
95
+ color: #40a9ff;
96
+ }
97
+
98
+ .history-modal-container .history-content {
99
+ flex: 1;
100
+ padding: 0 25px 25px;
101
+ overflow-y: auto;
102
+ }
103
+
104
+ .history-modal-container .history-content .history-group {
105
+ margin-bottom: 10px;
106
+ }
107
+
108
+ .history-modal-container .history-content .history-group .history-group-title {
109
+ color: rgba(0, 0, 0, .45);
110
+ height: 40px;
111
+ font-size: 12px;
112
+ font-weight: 400;
113
+ line-height: 40px;
114
+ }
115
+
116
+ .history-modal-container .history-content .history-group .history-item {
117
+ cursor: pointer;
118
+ color: rgba(0, 0, 0, .85);
119
+ white-space: nowrap;
120
+ text-overflow: ellipsis;
121
+ height: 40px;
122
+ font-size: 14px;
123
+ line-height: 40px;
124
+ overflow: hidden;
125
+ }
126
+
127
+ .history-modal-container .history-content .history-group .history-item:hover {
128
+ background: #f2f4f7;
129
+ margin: 0 -8px;
130
+ padding: 0 8px;
131
+ }
132
+
133
+ .history-modal-container .history-content .no-results {
134
+ text-align: center;
135
+ color: #999;
136
+ padding: 40px 20px;
137
+ }
138
+
139
+ [data-theme="dark"] .history-modal-overlay {
140
+ background: #16181d !important;
141
+ border-color: rgba(255, 255, 255, .12) !important;
142
+ box-shadow: 0 16px 40px rgba(0, 0, 0, .45) !important;
143
+ }
144
+
145
+ [data-theme="dark"] .history-modal-container {
146
+ background: #16181d !important;
147
+ }
148
+
149
+ [data-theme="dark"] .history-modal-container .history-modal-header .ant-typography {
150
+ color: rgba(255, 255, 255, .92) !important;
151
+ }
152
+
153
+ [data-theme="dark"] .history-modal-container .history-modal-header .close-button .anticon {
154
+ color: rgba(255, 255, 255, .48);
155
+ }
156
+
157
+ [data-theme="dark"] .history-modal-container .history-modal-header .close-button:hover .anticon {
158
+ color: rgba(255, 255, 255, .78);
159
+ }
160
+
161
+ [data-theme="dark"] .history-modal-container .history-search-section {
162
+ background: #16181d !important;
163
+ }
164
+
165
+ [data-theme="dark"] .history-modal-container .history-search-section .search-input-wrapper {
166
+ color: rgba(255, 255, 255, .38);
167
+ }
168
+
169
+ [data-theme="dark"] .history-modal-container .history-search-section .search-input-wrapper .search-input, [data-theme="dark"] .history-modal-container .history-search-section .search-input-wrapper .search-input.ant-input-affix-wrapper {
170
+ box-shadow: none !important;
171
+ background: rgba(255, 255, 255, .08) !important;
172
+ border-color: rgba(255, 255, 255, .12) !important;
173
+ }
174
+
175
+ [data-theme="dark"] .history-modal-container .history-search-section .search-input-wrapper .search-input .ant-input, [data-theme="dark"] .history-modal-container .history-search-section .search-input-wrapper .search-input.ant-input-affix-wrapper .ant-input, [data-theme="dark"] .history-modal-container .history-search-section .search-input-wrapper .search-input .ant-input-prefix, [data-theme="dark"] .history-modal-container .history-search-section .search-input-wrapper .search-input.ant-input-affix-wrapper .ant-input-prefix, [data-theme="dark"] .history-modal-container .history-search-section .search-input-wrapper .search-input .ant-input-clear-icon, [data-theme="dark"] .history-modal-container .history-search-section .search-input-wrapper .search-input.ant-input-affix-wrapper .ant-input-clear-icon {
176
+ color: rgba(255, 255, 255, .72) !important;
177
+ }
178
+
179
+ [data-theme="dark"] .history-modal-container .history-search-section .search-input-wrapper .search-input .ant-input, [data-theme="dark"] .history-modal-container .history-search-section .search-input-wrapper .search-input.ant-input-affix-wrapper .ant-input {
180
+ background: none !important;
181
+ }
182
+
183
+ [data-theme="dark"] .history-modal-container .history-search-section .search-input-wrapper .search-input .ant-input::-webkit-input-placeholder {
184
+ color: rgba(255, 255, 255, .38) !important;
185
+ }
186
+
187
+ [data-theme="dark"] .history-modal-container .history-search-section .search-input-wrapper .search-input .ant-input::placeholder {
188
+ color: rgba(255, 255, 255, .38) !important;
189
+ }
190
+
191
+ [data-theme="dark"] .history-modal-container .history-search-section .search-input-wrapper .search-input.ant-input-affix-wrapper .ant-input::-webkit-input-placeholder {
192
+ color: rgba(255, 255, 255, .38) !important;
193
+ }
194
+
195
+ [data-theme="dark"] .history-modal-container .history-search-section .search-input-wrapper .search-input.ant-input-affix-wrapper .ant-input::placeholder {
196
+ color: rgba(255, 255, 255, .38) !important;
197
+ }
198
+
199
+ [data-theme="dark"] .history-modal-container .history-search-section .search-input-wrapper .search-input:hover, [data-theme="dark"] .history-modal-container .history-search-section .search-input-wrapper .search-input.ant-input-affix-wrapper:hover {
200
+ background: rgba(255, 255, 255, .12) !important;
201
+ border-color: rgba(255, 255, 255, .16) !important;
202
+ }
203
+
204
+ [data-theme="dark"] .history-modal-container .history-search-section .search-input-wrapper .search-input:focus-within {
205
+ background: rgba(255, 255, 255, .12) !important;
206
+ border-color: rgba(255, 255, 255, .16) !important;
207
+ }
208
+
209
+ [data-theme="dark"] .history-modal-container .history-search-section .search-input-wrapper .search-input.ant-input-affix-wrapper:focus-within {
210
+ background: rgba(255, 255, 255, .12) !important;
211
+ border-color: rgba(255, 255, 255, .16) !important;
212
+ }
213
+
214
+ [data-theme="dark"] .history-modal-container .history-search-section .search-input-wrapper .clear-button {
215
+ color: #77b7ff !important;
216
+ }
217
+
218
+ [data-theme="dark"] .history-modal-container .history-search-section .search-input-wrapper .clear-button:hover {
219
+ color: #9cccff !important;
220
+ }
221
+
222
+ [data-theme="dark"] .history-modal-container .history-content .history-group .history-group-title {
223
+ color: rgba(255, 255, 255, .45) !important;
224
+ }
225
+
226
+ [data-theme="dark"] .history-modal-container .history-content .history-group .history-item {
227
+ color: rgba(255, 255, 255, .88) !important;
228
+ }
229
+
230
+ [data-theme="dark"] .history-modal-container .history-content .history-group .history-item:hover {
231
+ background: rgba(255, 255, 255, .08) !important;
232
+ }
233
+
234
+ [data-theme="dark"] .history-modal-container .history-content .no-results, [data-theme="dark"] .history-modal-container .history-content .ant-typography.ant-typography-secondary {
235
+ color: rgba(255, 255, 255, .45) !important;
236
+ }
237
+