@midscene/visualizer 0.14.3 → 0.14.4-beta-20250414114024.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/color.js +1 -1
- package/dist/es/component/env-config.js +81 -62
- package/dist/es/component/player.css +42 -28
- package/dist/es/component/player.js +79 -41
- package/dist/es/component/playground/HistorySelector.js +1 -4
- package/dist/es/component/playground/PlaygroundResult.js +13 -1
- package/dist/es/component/playground/PromptInput.js +25 -14
- package/dist/es/component/playground/index.css +64 -9
- package/dist/es/component/playground/playground-constants.js +2 -1
- package/dist/es/component/playground/playground-utils.js +28 -3
- package/dist/es/index.js +20 -0
- package/dist/index.css +106 -37
- package/dist/index.js +1 -1
- package/dist/lib/component/color.js +1 -1
- package/dist/lib/component/env-config.js +80 -61
- package/dist/lib/component/player.css +42 -28
- package/dist/lib/component/player.js +78 -40
- package/dist/lib/component/playground/HistorySelector.js +1 -4
- package/dist/lib/component/playground/PlaygroundResult.js +13 -1
- package/dist/lib/component/playground/PromptInput.js +20 -12
- package/dist/lib/component/playground/index.css +64 -9
- package/dist/lib/component/playground/playground-constants.js +2 -1
- package/dist/lib/component/playground/playground-utils.js +30 -3
- package/dist/lib/index.js +19 -0
- package/dist/types/component/playground/playground-constants.d.ts +1 -0
- package/dist/types/component/playground/playground-utils.d.ts +3 -1
- package/dist/types/index.d.ts +1 -0
- package/package.json +4 -4
|
@@ -5,7 +5,8 @@ var buffer = {
|
|
|
5
5
|
Buffer
|
|
6
6
|
};
|
|
7
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
-
import {
|
|
8
|
+
import { SettingOutlined } from "@ant-design/icons";
|
|
9
|
+
import { Input, Modal, Tooltip } from "antd";
|
|
9
10
|
import { useState } from "react";
|
|
10
11
|
import { iconForStatus } from "./misc";
|
|
11
12
|
import { useEnvConfig } from "./store/store";
|
|
@@ -25,71 +26,89 @@ function EnvConfig() {
|
|
|
25
26
|
const handleCancel = () => {
|
|
26
27
|
setIsModalOpen(false);
|
|
27
28
|
};
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
29
|
+
const configTip = Object.keys(config).length === 0 ? /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Tooltip, { title: "No Config", children: iconForStatus("failed") }) }) : /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
30
|
+
Tooltip,
|
|
31
|
+
{
|
|
32
|
+
overlayInnerStyle: {
|
|
33
|
+
width: "fit-content"
|
|
34
|
+
},
|
|
35
|
+
title: /* @__PURE__ */ jsx("div", { children: Object.entries(config).map(([key, value]) => /* @__PURE__ */ jsxs(
|
|
36
|
+
"div",
|
|
37
|
+
{
|
|
38
|
+
style: {
|
|
39
|
+
lineHeight: "1.8",
|
|
40
|
+
display: "flex",
|
|
41
|
+
alignItems: "center",
|
|
42
|
+
marginBottom: "5px"
|
|
43
|
+
},
|
|
44
|
+
children: [
|
|
45
|
+
/* @__PURE__ */ jsx("span", { style: { color: "#52c41a", marginRight: "8px" }, children: iconForStatus("success") }),
|
|
46
|
+
/* @__PURE__ */ jsxs("span", { style: { whiteSpace: "nowrap" }, children: [
|
|
47
|
+
key,
|
|
48
|
+
": ",
|
|
49
|
+
key === "MIDSCENE_MODEL_NAME" ? value : "***"
|
|
50
|
+
] })
|
|
51
|
+
]
|
|
52
|
+
},
|
|
53
|
+
key
|
|
54
|
+
)) }),
|
|
55
|
+
children: iconForStatus("success")
|
|
56
|
+
}
|
|
57
|
+
) });
|
|
58
|
+
return /* @__PURE__ */ jsxs(
|
|
43
59
|
"div",
|
|
44
60
|
{
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
" ",
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
61
|
+
style: {
|
|
62
|
+
display: "flex",
|
|
63
|
+
justifyContent: "space-between",
|
|
64
|
+
alignItems: "center",
|
|
65
|
+
width: "100%"
|
|
66
|
+
},
|
|
67
|
+
children: [
|
|
68
|
+
/* @__PURE__ */ jsx("div", { style: { marginRight: "8px" }, children: configTip }),
|
|
69
|
+
/* @__PURE__ */ jsx(
|
|
70
|
+
Tooltip,
|
|
71
|
+
{
|
|
72
|
+
title: "Please set up your environment variables before using.",
|
|
73
|
+
placement: "bottom",
|
|
74
|
+
open: Object.keys(config).length === 0,
|
|
75
|
+
children: /* @__PURE__ */ jsx(SettingOutlined, { onClick: showModal })
|
|
76
|
+
}
|
|
77
|
+
),
|
|
78
|
+
/* @__PURE__ */ jsxs(
|
|
79
|
+
Modal,
|
|
80
|
+
{
|
|
81
|
+
title: "Env Config",
|
|
82
|
+
open: isModalOpen,
|
|
83
|
+
onOk: handleOk,
|
|
84
|
+
onCancel: handleCancel,
|
|
85
|
+
okText: "Save",
|
|
86
|
+
style: { width: "800px" },
|
|
87
|
+
children: [
|
|
88
|
+
/* @__PURE__ */ jsx(
|
|
89
|
+
Input.TextArea,
|
|
90
|
+
{
|
|
91
|
+
rows: 7,
|
|
92
|
+
placeholder: "OPENAI_API_KEY=sk-...\nMIDSCENE_MODEL_NAME=gpt-4o-2024-08-06\n...",
|
|
93
|
+
value: tempConfigString,
|
|
94
|
+
onChange: (e) => setTempConfigString(e.target.value),
|
|
95
|
+
style: { whiteSpace: "nowrap", wordWrap: "break-word" }
|
|
96
|
+
}
|
|
97
|
+
),
|
|
98
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
99
|
+
/* @__PURE__ */ jsx("p", { children: "The format is KEY=VALUE and separated by new lines." }),
|
|
100
|
+
/* @__PURE__ */ jsxs("p", { children: [
|
|
101
|
+
"These data will be saved ",
|
|
102
|
+
/* @__PURE__ */ jsx("strong", { children: "locally in your browser" }),
|
|
103
|
+
"."
|
|
104
|
+
] })
|
|
105
|
+
] })
|
|
106
|
+
]
|
|
107
|
+
}
|
|
108
|
+
)
|
|
109
|
+
]
|
|
57
110
|
}
|
|
58
111
|
);
|
|
59
|
-
return /* @__PURE__ */ jsxs("div", { children: [
|
|
60
|
-
configTip,
|
|
61
|
-
/* @__PURE__ */ jsxs(
|
|
62
|
-
Modal,
|
|
63
|
-
{
|
|
64
|
-
title: "Env Config",
|
|
65
|
-
open: isModalOpen,
|
|
66
|
-
onOk: handleOk,
|
|
67
|
-
onCancel: handleCancel,
|
|
68
|
-
okText: "Save",
|
|
69
|
-
style: { width: "800px" },
|
|
70
|
-
children: [
|
|
71
|
-
/* @__PURE__ */ jsx(
|
|
72
|
-
Input.TextArea,
|
|
73
|
-
{
|
|
74
|
-
rows: 7,
|
|
75
|
-
placeholder: "OPENAI_API_KEY=sk-...\nMIDSCENE_MODEL_NAME=gpt-4o-2024-08-06\n...",
|
|
76
|
-
value: tempConfigString,
|
|
77
|
-
onChange: (e) => setTempConfigString(e.target.value),
|
|
78
|
-
style: { whiteSpace: "nowrap", wordWrap: "break-word" }
|
|
79
|
-
}
|
|
80
|
-
),
|
|
81
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
82
|
-
/* @__PURE__ */ jsx("p", { children: "The format is KEY=VALUE and separated by new lines." }),
|
|
83
|
-
/* @__PURE__ */ jsxs("p", { children: [
|
|
84
|
-
"These data will be saved ",
|
|
85
|
-
/* @__PURE__ */ jsx("strong", { children: "locally in your browser" }),
|
|
86
|
-
"."
|
|
87
|
-
] })
|
|
88
|
-
] })
|
|
89
|
-
]
|
|
90
|
-
}
|
|
91
|
-
)
|
|
92
|
-
] });
|
|
93
112
|
}
|
|
94
113
|
export {
|
|
95
114
|
EnvConfig
|
|
@@ -1,26 +1,33 @@
|
|
|
1
1
|
.player-container {
|
|
2
|
-
width:
|
|
2
|
+
width: 100%;
|
|
3
|
+
height: 100%;
|
|
3
4
|
max-width: 100%;
|
|
4
5
|
max-height: 100%;
|
|
5
|
-
padding:
|
|
6
|
-
|
|
7
|
-
background: #434443DD;
|
|
6
|
+
padding: 8px;
|
|
7
|
+
background: #fff;
|
|
8
8
|
box-sizing: border-box;
|
|
9
|
-
border: 1px solid #
|
|
10
|
-
border-radius:
|
|
9
|
+
border: 1px solid #0000000F;
|
|
10
|
+
border-radius: 8px;
|
|
11
11
|
line-height: 100%;
|
|
12
12
|
margin: 0 auto;
|
|
13
13
|
display: flex;
|
|
14
14
|
flex-direction: column;
|
|
15
|
-
overflow:
|
|
15
|
+
overflow: visible;
|
|
16
|
+
min-height: 300px;
|
|
16
17
|
}
|
|
17
18
|
.player-container .canvas-container {
|
|
18
|
-
flex
|
|
19
|
+
flex: none;
|
|
20
|
+
min-height: 200px;
|
|
21
|
+
max-height: calc(100% - 4px - 42px - 15px * 2 - 12px);
|
|
19
22
|
display: flex;
|
|
20
|
-
align-items: center;
|
|
21
23
|
justify-content: center;
|
|
24
|
+
align-items: center;
|
|
22
25
|
overflow: hidden;
|
|
23
|
-
padding:
|
|
26
|
+
padding: 8px;
|
|
27
|
+
margin-bottom: 12px;
|
|
28
|
+
position: relative;
|
|
29
|
+
background-color: #F5F5F5;
|
|
30
|
+
border-radius: inherit;
|
|
24
31
|
}
|
|
25
32
|
.player-container .canvas-container canvas {
|
|
26
33
|
max-width: 100%;
|
|
@@ -28,13 +35,20 @@
|
|
|
28
35
|
box-sizing: border-box;
|
|
29
36
|
display: block;
|
|
30
37
|
margin: 0 auto;
|
|
38
|
+
object-fit: contain;
|
|
39
|
+
}
|
|
40
|
+
.player-container .player-timeline-wrapper {
|
|
41
|
+
width: 100%;
|
|
42
|
+
flex-shrink: 0;
|
|
43
|
+
margin-bottom: 2px;
|
|
44
|
+
position: relative;
|
|
31
45
|
}
|
|
32
46
|
.player-container .player-timeline {
|
|
33
47
|
width: 100%;
|
|
34
48
|
height: 4px;
|
|
35
49
|
background: #666;
|
|
36
50
|
position: relative;
|
|
37
|
-
|
|
51
|
+
flex-shrink: 0;
|
|
38
52
|
}
|
|
39
53
|
.player-container .player-timeline .player-timeline-progress {
|
|
40
54
|
transition-timing-function: linear;
|
|
@@ -42,36 +56,40 @@
|
|
|
42
56
|
top: 0;
|
|
43
57
|
left: 0;
|
|
44
58
|
height: 4px;
|
|
45
|
-
background: #
|
|
59
|
+
background: #00B4AC;
|
|
60
|
+
}
|
|
61
|
+
.player-container .player-tools-wrapper {
|
|
62
|
+
width: 100%;
|
|
63
|
+
flex-shrink: 0;
|
|
64
|
+
position: relative;
|
|
46
65
|
}
|
|
47
66
|
.player-container .player-tools {
|
|
48
67
|
margin-top: 15px;
|
|
49
68
|
margin-bottom: 15px;
|
|
50
69
|
max-width: 100%;
|
|
51
70
|
overflow: hidden;
|
|
52
|
-
color: #
|
|
53
|
-
font-size:
|
|
71
|
+
color: #000;
|
|
72
|
+
font-size: 14px;
|
|
54
73
|
box-sizing: border-box;
|
|
55
74
|
display: flex;
|
|
56
75
|
flex-direction: row;
|
|
57
76
|
padding: 0 12px;
|
|
58
77
|
justify-content: space-between;
|
|
59
|
-
height:
|
|
78
|
+
height: 42px;
|
|
60
79
|
flex-shrink: 0;
|
|
61
80
|
}
|
|
62
81
|
.player-container .player-tools .player-control {
|
|
63
82
|
flex-grow: 1;
|
|
64
83
|
display: flex;
|
|
65
84
|
flex-direction: row;
|
|
66
|
-
align-items:
|
|
85
|
+
align-items: center;
|
|
67
86
|
}
|
|
68
87
|
.player-container .player-tools .status-icon {
|
|
69
88
|
transition: 0.2s;
|
|
70
|
-
width:
|
|
71
|
-
height:
|
|
89
|
+
width: 32px;
|
|
90
|
+
height: 32px;
|
|
72
91
|
margin-right: 12px;
|
|
73
|
-
|
|
74
|
-
border-radius: 6px;
|
|
92
|
+
border-radius: 8px;
|
|
75
93
|
display: flex;
|
|
76
94
|
align-items: center;
|
|
77
95
|
justify-content: center;
|
|
@@ -81,29 +99,25 @@
|
|
|
81
99
|
flex-grow: 1;
|
|
82
100
|
overflow: hidden;
|
|
83
101
|
position: relative;
|
|
102
|
+
height: 100%;
|
|
103
|
+
display: flex;
|
|
104
|
+
flex-direction: column;
|
|
105
|
+
justify-content: space-between;
|
|
84
106
|
}
|
|
85
107
|
.player-container .player-tools .title {
|
|
86
108
|
font-weight: bold;
|
|
87
|
-
height: 20px;
|
|
88
109
|
line-height: 20px;
|
|
89
110
|
overflow: hidden;
|
|
90
111
|
text-overflow: ellipsis;
|
|
91
112
|
white-space: nowrap;
|
|
92
|
-
position: absolute;
|
|
93
|
-
top: 0;
|
|
94
|
-
left: 0;
|
|
95
113
|
width: 100%;
|
|
96
114
|
}
|
|
97
115
|
.player-container .player-tools .subtitle {
|
|
98
|
-
height: 20px;
|
|
99
116
|
line-height: 20px;
|
|
100
117
|
width: 100%;
|
|
101
118
|
overflow: hidden;
|
|
102
119
|
text-overflow: ellipsis;
|
|
103
120
|
white-space: nowrap;
|
|
104
|
-
position: absolute;
|
|
105
|
-
top: 18px;
|
|
106
|
-
left: 0;
|
|
107
121
|
}
|
|
108
122
|
.player-container .player-tools .player-tools-item {
|
|
109
123
|
height: 100%;
|
|
@@ -52,7 +52,7 @@ import {
|
|
|
52
52
|
DownloadOutlined,
|
|
53
53
|
LoadingOutlined
|
|
54
54
|
} from "@ant-design/icons";
|
|
55
|
-
import { Button,
|
|
55
|
+
import { Button, Spin } from "antd";
|
|
56
56
|
import { rectMarkForItem } from "./blackboard";
|
|
57
57
|
import { getTextureFromCache, loadTexture } from "./pixi-loader";
|
|
58
58
|
const canvasPaddingLeft = 0;
|
|
@@ -431,14 +431,67 @@ function Player(props) {
|
|
|
431
431
|
frame(animate);
|
|
432
432
|
});
|
|
433
433
|
});
|
|
434
|
+
const updateCanvasSize = () => {
|
|
435
|
+
if (!divContainerRef.current || !app)
|
|
436
|
+
return;
|
|
437
|
+
const container = divContainerRef.current.parentElement;
|
|
438
|
+
if (!container)
|
|
439
|
+
return;
|
|
440
|
+
const parentContainerHeight = container.clientHeight;
|
|
441
|
+
const containerWidth = divContainerRef.current.clientWidth;
|
|
442
|
+
if (containerWidth <= 0 || parentContainerHeight <= 0)
|
|
443
|
+
return;
|
|
444
|
+
const timelineHeight = 4;
|
|
445
|
+
const toolsHeight = 40;
|
|
446
|
+
const toolsMargin = 15 * 2;
|
|
447
|
+
const paddingHeight = 12;
|
|
448
|
+
const reservedHeight = timelineHeight + toolsHeight + toolsMargin + paddingHeight;
|
|
449
|
+
const availableContainerHeight = Math.max(
|
|
450
|
+
200,
|
|
451
|
+
parentContainerHeight - reservedHeight
|
|
452
|
+
);
|
|
453
|
+
const aspectRatio = imageWidth / imageHeight;
|
|
454
|
+
let targetWidth = containerWidth;
|
|
455
|
+
let targetHeight = containerWidth / aspectRatio;
|
|
456
|
+
if (targetHeight > availableContainerHeight) {
|
|
457
|
+
targetHeight = availableContainerHeight;
|
|
458
|
+
targetWidth = targetHeight * aspectRatio;
|
|
459
|
+
}
|
|
460
|
+
const maxSize = 600;
|
|
461
|
+
if (targetWidth > maxSize) {
|
|
462
|
+
targetWidth = maxSize;
|
|
463
|
+
targetHeight = maxSize / aspectRatio;
|
|
464
|
+
}
|
|
465
|
+
if (targetHeight > maxSize) {
|
|
466
|
+
targetHeight = maxSize;
|
|
467
|
+
targetWidth = maxSize * aspectRatio;
|
|
468
|
+
}
|
|
469
|
+
targetWidth = Math.floor(targetWidth);
|
|
470
|
+
targetHeight = Math.floor(targetHeight);
|
|
471
|
+
if (app.canvas) {
|
|
472
|
+
app.canvas.style.width = `${targetWidth}px`;
|
|
473
|
+
app.canvas.style.height = `${targetHeight}px`;
|
|
474
|
+
}
|
|
475
|
+
const safeCanvasHeight = Math.min(targetHeight, availableContainerHeight);
|
|
476
|
+
divContainerRef.current.style.height = `${safeCanvasHeight}px`;
|
|
477
|
+
const playerContainer = divContainerRef.current.closest(".player-container");
|
|
478
|
+
if (playerContainer && playerContainer instanceof HTMLElement) {
|
|
479
|
+
const totalHeight = safeCanvasHeight + reservedHeight;
|
|
480
|
+
playerContainer.style.minHeight = `${totalHeight}px`;
|
|
481
|
+
}
|
|
482
|
+
};
|
|
434
483
|
const init = () => __async(this, null, function* () {
|
|
435
484
|
if (!divContainerRef.current || !scripts)
|
|
436
485
|
return;
|
|
437
486
|
yield app.init({
|
|
438
|
-
width:
|
|
439
|
-
height:
|
|
440
|
-
background: 16053492
|
|
487
|
+
width: imageWidth,
|
|
488
|
+
height: imageHeight,
|
|
489
|
+
background: 16053492,
|
|
490
|
+
autoDensity: true,
|
|
491
|
+
antialias: true
|
|
441
492
|
});
|
|
493
|
+
if (!divContainerRef.current)
|
|
494
|
+
return;
|
|
442
495
|
divContainerRef.current.appendChild(app.canvas);
|
|
443
496
|
windowContentContainer.x = 0;
|
|
444
497
|
windowContentContainer.y = 0;
|
|
@@ -589,15 +642,15 @@ function Player(props) {
|
|
|
589
642
|
let statusOnClick = () => {
|
|
590
643
|
};
|
|
591
644
|
if (animationProgress < 1) {
|
|
592
|
-
statusIconElement = /* @__PURE__ */ jsx(Spin, { indicator: /* @__PURE__ */ jsx(LoadingOutlined, { spin: true }), size: "default" });
|
|
645
|
+
statusIconElement = /* @__PURE__ */ jsx(Spin, { indicator: /* @__PURE__ */ jsx(LoadingOutlined, { spin: true, color: "#333" }), size: "default" });
|
|
593
646
|
} else if (mouseOverStatusIcon) {
|
|
594
|
-
statusIconElement = /* @__PURE__ */ jsx(Spin, { indicator: /* @__PURE__ */ jsx(CaretRightOutlined, {}), size: "default" });
|
|
647
|
+
statusIconElement = /* @__PURE__ */ jsx(Spin, { indicator: /* @__PURE__ */ jsx(CaretRightOutlined, { color: "#333" }), size: "default" });
|
|
595
648
|
statusStyle.cursor = "pointer";
|
|
596
|
-
statusStyle.background = "#
|
|
649
|
+
statusStyle.background = "#F0f0f0";
|
|
597
650
|
statusOnClick = () => setReplayMark(Date.now());
|
|
598
651
|
} else {
|
|
599
652
|
statusIconElement = // <Spin indicator={<CheckCircleOutlined />} size="default" />
|
|
600
|
-
/* @__PURE__ */ jsx(Spin, { indicator: /* @__PURE__ */ jsx(CaretRightOutlined, {}), size: "default" });
|
|
653
|
+
/* @__PURE__ */ jsx(Spin, { indicator: /* @__PURE__ */ jsx(CaretRightOutlined, { color: "#333" }), size: "default" });
|
|
601
654
|
}
|
|
602
655
|
const playerTopToolbar = (props == null ? void 0 : props.reportFileContent) ? /* @__PURE__ */ jsx("div", { className: "player-tools-right", children: /* @__PURE__ */ jsx("div", { className: "player-tools-item", children: /* @__PURE__ */ jsx(
|
|
603
656
|
Button,
|
|
@@ -612,7 +665,7 @@ function Player(props) {
|
|
|
612
665
|
) }) }) : null;
|
|
613
666
|
return /* @__PURE__ */ jsxs("div", { className: "player-container", children: [
|
|
614
667
|
/* @__PURE__ */ jsx("div", { className: "canvas-container", ref: divContainerRef }),
|
|
615
|
-
/* @__PURE__ */ jsx("div", { className: "player-timeline", children: /* @__PURE__ */ jsx(
|
|
668
|
+
/* @__PURE__ */ jsx("div", { className: "player-timeline-wrapper", children: /* @__PURE__ */ jsx("div", { className: "player-timeline", children: /* @__PURE__ */ jsx(
|
|
616
669
|
"div",
|
|
617
670
|
{
|
|
618
671
|
className: "player-timeline-progress",
|
|
@@ -621,40 +674,25 @@ function Player(props) {
|
|
|
621
674
|
transition: transitionStyle
|
|
622
675
|
}
|
|
623
676
|
}
|
|
624
|
-
) }),
|
|
625
|
-
/* @__PURE__ */
|
|
626
|
-
/* @__PURE__ */ jsxs("div", { className: "
|
|
627
|
-
/* @__PURE__ */ jsx(
|
|
628
|
-
|
|
629
|
-
{
|
|
630
|
-
className: "status-icon",
|
|
631
|
-
onMouseEnter: () => setMouseOverStatusIcon(true),
|
|
632
|
-
onMouseLeave: () => setMouseOverStatusIcon(false),
|
|
633
|
-
style: statusStyle,
|
|
634
|
-
onClick: statusOnClick,
|
|
635
|
-
children: /* @__PURE__ */ jsx(
|
|
636
|
-
ConfigProvider,
|
|
637
|
-
{
|
|
638
|
-
theme: {
|
|
639
|
-
components: {
|
|
640
|
-
Spin: {
|
|
641
|
-
dotSize: 24,
|
|
642
|
-
colorPrimary: "rgb(6,177,171)"
|
|
643
|
-
}
|
|
644
|
-
}
|
|
645
|
-
},
|
|
646
|
-
children: statusIconElement
|
|
647
|
-
}
|
|
648
|
-
)
|
|
649
|
-
}
|
|
650
|
-
),
|
|
651
|
-
/* @__PURE__ */ jsxs("div", { className: "status-text", children: [
|
|
652
|
-
/* @__PURE__ */ jsx("div", { className: "title", children: titleText }),
|
|
653
|
-
/* @__PURE__ */ jsx("div", { className: "subtitle", children: subTitleText })
|
|
654
|
-
] })
|
|
677
|
+
) }) }),
|
|
678
|
+
/* @__PURE__ */ jsx("div", { className: "player-tools-wrapper", children: /* @__PURE__ */ jsx("div", { className: "player-tools", children: /* @__PURE__ */ jsxs("div", { className: "player-control", children: [
|
|
679
|
+
/* @__PURE__ */ jsxs("div", { className: "status-text", children: [
|
|
680
|
+
/* @__PURE__ */ jsx("div", { className: "title", children: titleText }),
|
|
681
|
+
/* @__PURE__ */ jsx("div", { className: "subtitle", children: subTitleText })
|
|
655
682
|
] }),
|
|
683
|
+
/* @__PURE__ */ jsx(
|
|
684
|
+
"div",
|
|
685
|
+
{
|
|
686
|
+
className: "status-icon",
|
|
687
|
+
onMouseEnter: () => setMouseOverStatusIcon(true),
|
|
688
|
+
onMouseLeave: () => setMouseOverStatusIcon(false),
|
|
689
|
+
style: statusStyle,
|
|
690
|
+
onClick: statusOnClick,
|
|
691
|
+
children: statusIconElement
|
|
692
|
+
}
|
|
693
|
+
),
|
|
656
694
|
playerTopToolbar
|
|
657
|
-
] })
|
|
695
|
+
] }) }) })
|
|
658
696
|
] });
|
|
659
697
|
}
|
|
660
698
|
export {
|
|
@@ -33,10 +33,7 @@ const HistorySelector = ({
|
|
|
33
33
|
label: /* @__PURE__ */ jsx("a", { onClick: () => clearHistory(), children: /* @__PURE__ */ jsx(Space, { children: "Clear History" }) }),
|
|
34
34
|
key: "clear"
|
|
35
35
|
});
|
|
36
|
-
return /* @__PURE__ */ jsx("div", { className: "history-selector", children: /* @__PURE__ */ jsx(Dropdown, { menu: { items }, children: /* @__PURE__ */
|
|
37
|
-
/* @__PURE__ */ jsx(HistoryOutlined, {}),
|
|
38
|
-
"history"
|
|
39
|
-
] }) }) });
|
|
36
|
+
return /* @__PURE__ */ jsx("div", { className: "history-selector", children: /* @__PURE__ */ jsx(Dropdown, { menu: { items }, children: /* @__PURE__ */ jsx(Space, { children: /* @__PURE__ */ jsx(HistoryOutlined, { style: { fontSize: 14 } }) }) }) });
|
|
40
37
|
};
|
|
41
38
|
export {
|
|
42
39
|
HistorySelector
|
|
@@ -50,7 +50,19 @@ const PlaygroundResultView = ({
|
|
|
50
50
|
} else if (result == null ? void 0 : result.error) {
|
|
51
51
|
resultDataToShow = /* @__PURE__ */ jsx("pre", { children: result == null ? void 0 : result.error });
|
|
52
52
|
}
|
|
53
|
-
return /* @__PURE__ */ jsx(
|
|
53
|
+
return /* @__PURE__ */ jsx(
|
|
54
|
+
"div",
|
|
55
|
+
{
|
|
56
|
+
className: resultWrapperClassName,
|
|
57
|
+
style: {
|
|
58
|
+
height: "100%",
|
|
59
|
+
display: "flex",
|
|
60
|
+
flexDirection: "column",
|
|
61
|
+
flex: "1 1 auto"
|
|
62
|
+
},
|
|
63
|
+
children: resultDataToShow
|
|
64
|
+
}
|
|
65
|
+
);
|
|
54
66
|
};
|
|
55
67
|
export {
|
|
56
68
|
PlaygroundResultView
|
|
@@ -5,8 +5,11 @@ var buffer = {
|
|
|
5
5
|
Buffer
|
|
6
6
|
};
|
|
7
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
-
import {
|
|
9
|
-
|
|
8
|
+
import {
|
|
9
|
+
BorderOutlined,
|
|
10
|
+
SendOutlined
|
|
11
|
+
} from "@ant-design/icons";
|
|
12
|
+
import { Button, Form, Input, Radio, Space, Tooltip } from "antd";
|
|
10
13
|
import { useCallback, useEffect, useState } from "react";
|
|
11
14
|
import { useHistoryStore } from "../store/history";
|
|
12
15
|
import { ConfigSelector } from "./ConfigSelector";
|
|
@@ -107,16 +110,27 @@ const PromptInput = ({
|
|
|
107
110
|
stoppable
|
|
108
111
|
]);
|
|
109
112
|
return /* @__PURE__ */ jsxs("div", { className: "form-part input-wrapper", children: [
|
|
110
|
-
/* @__PURE__ */
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
113
|
+
/* @__PURE__ */ jsxs(Space, { className: "mode-radio-group-wrapper", children: [
|
|
114
|
+
/* @__PURE__ */ jsx(Form.Item, { name: "type", style: { margin: 0 }, children: /* @__PURE__ */ jsxs(
|
|
115
|
+
Radio.Group,
|
|
116
|
+
{
|
|
117
|
+
buttonStyle: "solid",
|
|
118
|
+
disabled: !runButtonEnabled,
|
|
119
|
+
className: "mode-radio-group",
|
|
120
|
+
children: [
|
|
121
|
+
/* @__PURE__ */ jsx(Radio.Button, { value: "aiAction", children: actionNameForType("aiAction") }),
|
|
122
|
+
/* @__PURE__ */ jsx(Radio.Button, { value: "aiQuery", children: actionNameForType("aiQuery") }),
|
|
123
|
+
/* @__PURE__ */ jsx(Radio.Button, { value: "aiAssert", children: actionNameForType("aiAssert") })
|
|
124
|
+
]
|
|
125
|
+
}
|
|
126
|
+
) }),
|
|
127
|
+
/* @__PURE__ */ jsx(HistorySelector, { onSelect: handleSelectHistory })
|
|
128
|
+
] }),
|
|
116
129
|
/* @__PURE__ */ jsxs("div", { className: "main-side-console-input", children: [
|
|
117
|
-
/* @__PURE__ */ jsx(Form.Item, { name: "prompt", children: /* @__PURE__ */ jsx(
|
|
130
|
+
/* @__PURE__ */ jsx(Form.Item, { name: "prompt", style: { margin: 0 }, children: /* @__PURE__ */ jsx(
|
|
118
131
|
TextArea,
|
|
119
132
|
{
|
|
133
|
+
className: "main-side-console-input-textarea",
|
|
120
134
|
disabled: !runButtonEnabled,
|
|
121
135
|
rows: 4,
|
|
122
136
|
placeholder,
|
|
@@ -125,16 +139,13 @@ const PromptInput = ({
|
|
|
125
139
|
}
|
|
126
140
|
) }),
|
|
127
141
|
/* @__PURE__ */ jsxs("div", { className: "form-controller-wrapper", children: [
|
|
128
|
-
/* @__PURE__ */
|
|
142
|
+
/* @__PURE__ */ jsx(
|
|
129
143
|
"div",
|
|
130
144
|
{
|
|
131
145
|
className: hoveringSettings ? "settings-wrapper settings-wrapper-hover" : "settings-wrapper",
|
|
132
146
|
onMouseEnter: handleMouseEnter,
|
|
133
147
|
onMouseLeave: handleMouseLeave,
|
|
134
|
-
children:
|
|
135
|
-
/* @__PURE__ */ jsx(HistorySelector, { onSelect: handleSelectHistory }),
|
|
136
|
-
/* @__PURE__ */ jsx(ConfigSelector, { serviceMode })
|
|
137
|
-
]
|
|
148
|
+
children: /* @__PURE__ */ jsx(ConfigSelector, { serviceMode })
|
|
138
149
|
}
|
|
139
150
|
),
|
|
140
151
|
renderActionButton()
|