vzcode 0.48.0 → 0.49.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/assets/index-dQA3GbFA.js +120 -0
- package/dist/assets/{index-NqGS0RuC.css → index-jLkbG0kp.css} +1 -1
- package/dist/index.html +2 -2
- package/package.json +1 -1
- package/src/client/AIAssist/AIAssistWidget/index.tsx +28 -12
- package/src/client/VZMiddle.tsx +6 -0
- package/src/client/bootstrap.ts +3 -1
- package/src/server/generateAIResponse.js +7 -3
- package/dist/assets/index-ohy9XGuy.js +0 -112
package/dist/index.html
CHANGED
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
href="https://unpkg.com/boxicons@2.0.7/css/boxicons.min.css"
|
|
25
25
|
rel="stylesheet"
|
|
26
26
|
/>
|
|
27
|
-
<script type="module" crossorigin src="/assets/index-
|
|
28
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
27
|
+
<script type="module" crossorigin src="/assets/index-dQA3GbFA.js"></script>
|
|
28
|
+
<link rel="stylesheet" crossorigin href="/assets/index-jLkbG0kp.css">
|
|
29
29
|
</head>
|
|
30
30
|
<body>
|
|
31
31
|
<div id="root"></div>
|
package/package.json
CHANGED
|
@@ -4,7 +4,11 @@ import {
|
|
|
4
4
|
ShareDBDoc,
|
|
5
5
|
VZCodeContent,
|
|
6
6
|
} from '../../../types';
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
Button,
|
|
9
|
+
OverlayTrigger,
|
|
10
|
+
Tooltip,
|
|
11
|
+
} from '../../bootstrap';
|
|
8
12
|
import { EditorCache } from '../../useEditorCache';
|
|
9
13
|
import { TabState } from '../../vzReducer';
|
|
10
14
|
import {
|
|
@@ -24,6 +28,8 @@ export const AIAssistWidget = ({
|
|
|
24
28
|
tabList,
|
|
25
29
|
aiAssistEndpoint,
|
|
26
30
|
aiAssistOptions,
|
|
31
|
+
aiAssistTooltipText = 'Start AI Assist',
|
|
32
|
+
aiAssistClickOverride,
|
|
27
33
|
}: {
|
|
28
34
|
activeFileId: FileId;
|
|
29
35
|
shareDBDoc: ShareDBDoc<VZCodeContent>;
|
|
@@ -31,6 +37,8 @@ export const AIAssistWidget = ({
|
|
|
31
37
|
tabList: Array<TabState>;
|
|
32
38
|
aiAssistEndpoint: string;
|
|
33
39
|
aiAssistOptions: { [key: string]: string };
|
|
40
|
+
aiAssistTooltipText?: string;
|
|
41
|
+
aiAssistClickOverride?: () => void;
|
|
34
42
|
}) => {
|
|
35
43
|
// The stream ID of the most recent request.
|
|
36
44
|
// * If `null`, no request has been made yet.
|
|
@@ -78,18 +86,26 @@ export const AIAssistWidget = ({
|
|
|
78
86
|
return (
|
|
79
87
|
showWidget && (
|
|
80
88
|
<div className="vz-code-ai-assist-widget">
|
|
81
|
-
<
|
|
82
|
-
|
|
83
|
-
|
|
89
|
+
<OverlayTrigger
|
|
90
|
+
placement="top"
|
|
91
|
+
overlay={
|
|
92
|
+
<Tooltip id="ai-assist-widget-tooltip">
|
|
93
|
+
{aiAssistTooltipText}
|
|
94
|
+
</Tooltip>
|
|
95
|
+
}
|
|
84
96
|
>
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
97
|
+
<Button
|
|
98
|
+
onClick={aiAssistClickOverride || handleClick}
|
|
99
|
+
>
|
|
100
|
+
{aiStreamId ? (
|
|
101
|
+
enableStopGeneration ? (
|
|
102
|
+
<StopSVG />
|
|
103
|
+
) : null
|
|
104
|
+
) : (
|
|
105
|
+
<SparklesSVG />
|
|
106
|
+
)}
|
|
107
|
+
</Button>
|
|
108
|
+
</OverlayTrigger>
|
|
93
109
|
</div>
|
|
94
110
|
)
|
|
95
111
|
);
|
package/src/client/VZMiddle.tsx
CHANGED
|
@@ -17,10 +17,14 @@ export const VZMiddle = ({
|
|
|
17
17
|
enableAIAssist = true,
|
|
18
18
|
aiAssistEndpoint,
|
|
19
19
|
aiAssistOptions,
|
|
20
|
+
aiAssistTooltipText,
|
|
21
|
+
aiAssistClickOverride,
|
|
20
22
|
}: {
|
|
21
23
|
enableAIAssist?: boolean;
|
|
22
24
|
aiAssistEndpoint: string;
|
|
23
25
|
aiAssistOptions: { [key: string]: string };
|
|
26
|
+
aiAssistTooltipText?: string;
|
|
27
|
+
aiAssistClickOverride?: () => void;
|
|
24
28
|
}) => {
|
|
25
29
|
const { codeEditorWidth } = useContext(
|
|
26
30
|
SplitPaneResizeContext,
|
|
@@ -88,6 +92,8 @@ export const VZMiddle = ({
|
|
|
88
92
|
tabList={tabList}
|
|
89
93
|
aiAssistEndpoint={aiAssistEndpoint}
|
|
90
94
|
aiAssistOptions={aiAssistOptions}
|
|
95
|
+
aiAssistTooltipText={aiAssistTooltipText}
|
|
96
|
+
aiAssistClickOverride={aiAssistClickOverride}
|
|
91
97
|
/>
|
|
92
98
|
) : null}
|
|
93
99
|
<CodeErrorOverlay
|
package/src/client/bootstrap.ts
CHANGED
|
@@ -4,8 +4,10 @@
|
|
|
4
4
|
import Form from 'react-bootstrap/cjs/Form.js';
|
|
5
5
|
import Button from 'react-bootstrap/cjs/Button.js';
|
|
6
6
|
import Modal from 'react-bootstrap/cjs/Modal.js';
|
|
7
|
+
import OverlayTrigger from 'react-bootstrap/cjs/OverlayTrigger.js';
|
|
8
|
+
import Tooltip from 'react-bootstrap/cjs/Tooltip.js';
|
|
7
9
|
|
|
8
10
|
// Pull in custom CSS from vizhub-ui.
|
|
9
11
|
import 'vizhub-ui/dist/vizhub-ui.css';
|
|
10
12
|
|
|
11
|
-
export { Form, Button, Modal };
|
|
13
|
+
export { Form, Button, Modal, OverlayTrigger, Tooltip };
|
|
@@ -65,16 +65,20 @@ export const generateAIResponse = async ({
|
|
|
65
65
|
content: [
|
|
66
66
|
'You are an expert programmer.',
|
|
67
67
|
'Your task is to output ONLY the code that replaces <FILL_ME> correctly.',
|
|
68
|
-
'Do not add any markdown.',
|
|
68
|
+
'Do not add any markdown around.',
|
|
69
69
|
'Do not duplicate the code before or after <FILL_ME>.',
|
|
70
70
|
'Do not make any changes outside of <FILL_ME>.',
|
|
71
|
+
'Do not enclose the output with backticks.',
|
|
72
|
+
'If any additional instructions are required, they will be provided in comments.',
|
|
71
73
|
].join(' '),
|
|
72
74
|
},
|
|
73
75
|
{ role: 'user', content: inputText },
|
|
74
76
|
];
|
|
75
77
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
+
if (debug) {
|
|
79
|
+
console.log('[generateAIResponse] messages:');
|
|
80
|
+
console.log(JSON.stringify(messages, null, 2));
|
|
81
|
+
}
|
|
78
82
|
|
|
79
83
|
streams[streamId] = await openai.chat.completions.create({
|
|
80
84
|
// model: 'gpt-3.5-turbo',
|