vzcode 1.52.0 → 1.54.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/index.html CHANGED
@@ -20,7 +20,7 @@
20
20
  href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap"
21
21
  rel="stylesheet"
22
22
  />
23
- <script type="module" crossorigin src="/assets/index-CoGL485l.js"></script>
23
+ <script type="module" crossorigin src="/assets/index-BxRNGHcB.js"></script>
24
24
  <link rel="stylesheet" crossorigin href="/assets/index-L1AANcDx.css">
25
25
  </head>
26
26
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vzcode",
3
- "version": "1.52.0",
3
+ "version": "1.54.0",
4
4
  "description": "Multiplayer code editor system",
5
5
  "main": "src/index.ts",
6
6
  "type": "module",
@@ -10,6 +10,7 @@ import {
10
10
  ButtonGroup,
11
11
  ToggleButton,
12
12
  } from '../../bootstrap';
13
+ import { enableAskMode } from '../../featureFlags';
13
14
 
14
15
  interface ChatInputProps {
15
16
  aiChatMessage: string;
@@ -58,50 +59,52 @@ const ChatInputComponent = ({
58
59
 
59
60
  return (
60
61
  <div className="ai-chat-input-container">
61
- <div
62
- className="ai-chat-mode-toggle"
63
- style={{ marginBottom: '8px' }}
64
- >
65
- <ButtonGroup size="sm">
66
- <ToggleButton
67
- id="ai-chat-mode-ask"
68
- type="radio"
69
- variant={
70
- aiChatMode === 'ask'
71
- ? 'primary'
72
- : 'outline-primary'
73
- }
74
- name="ai-chat-mode"
75
- value="ask"
76
- checked={aiChatMode === 'ask'}
77
- onChange={() => setAIChatMode('ask')}
78
- disabled={isLoading}
79
- >
80
- 💬 Ask
81
- </ToggleButton>
82
- <ToggleButton
83
- id="ai-chat-mode-edit"
84
- type="radio"
85
- variant={
86
- aiChatMode === 'edit'
87
- ? 'primary'
88
- : 'outline-primary'
89
- }
90
- name="ai-chat-mode"
91
- value="edit"
92
- checked={aiChatMode === 'edit'}
93
- onChange={() => setAIChatMode('edit')}
94
- disabled={isLoading}
95
- >
96
- ✏️ Edit
97
- </ToggleButton>
98
- </ButtonGroup>
99
- <div className="ai-chat-mode-description">
100
- {aiChatMode === 'ask'
101
- ? 'Ask questions without editing files'
102
- : 'Get answers and code edits'}
62
+ {enableAskMode && (
63
+ <div
64
+ className="ai-chat-mode-toggle"
65
+ style={{ marginBottom: '8px' }}
66
+ >
67
+ <ButtonGroup size="sm">
68
+ <ToggleButton
69
+ id="ai-chat-mode-ask"
70
+ type="radio"
71
+ variant={
72
+ aiChatMode === 'ask'
73
+ ? 'primary'
74
+ : 'outline-primary'
75
+ }
76
+ name="ai-chat-mode"
77
+ value="ask"
78
+ checked={aiChatMode === 'ask'}
79
+ onChange={() => setAIChatMode('ask')}
80
+ disabled={isLoading}
81
+ >
82
+ 💬 Ask
83
+ </ToggleButton>
84
+ <ToggleButton
85
+ id="ai-chat-mode-edit"
86
+ type="radio"
87
+ variant={
88
+ aiChatMode === 'edit'
89
+ ? 'primary'
90
+ : 'outline-primary'
91
+ }
92
+ name="ai-chat-mode"
93
+ value="edit"
94
+ checked={aiChatMode === 'edit'}
95
+ onChange={() => setAIChatMode('edit')}
96
+ disabled={isLoading}
97
+ >
98
+ ✏️ Edit
99
+ </ToggleButton>
100
+ </ButtonGroup>
101
+ <div className="ai-chat-mode-description">
102
+ {aiChatMode === 'ask'
103
+ ? 'Ask questions without editing files'
104
+ : 'Get answers and code edits'}
105
+ </div>
103
106
  </div>
104
- </div>
107
+ )}
105
108
  <Form.Group className="ai-chat-input-group">
106
109
  <Form.Control
107
110
  as="textarea"
@@ -164,39 +164,41 @@ export const AIChat = () => {
164
164
  useEffect(() => {
165
165
  DEBUG &&
166
166
  console.log('AIChat: Checking for stored AI prompt');
167
- const storedPrompt = getStoredAIPrompt();
168
- DEBUG &&
169
- console.log(
170
- 'AIChat: Stored prompt result:',
171
- storedPrompt,
172
- );
173
- if (storedPrompt) {
174
- // Restore the prompt and mode
167
+ if (getStoredAIPrompt) {
168
+ const storedPrompt = getStoredAIPrompt();
175
169
  DEBUG &&
176
- console.log('AIChat: Restoring prompt and mode');
177
- setAIChatMessage(storedPrompt.prompt);
178
- setAIChatMode(
179
- storedPrompt.modelName === 'ask' ? 'ask' : 'edit',
180
- );
170
+ console.log(
171
+ 'AIChat: Stored prompt result:',
172
+ storedPrompt,
173
+ );
174
+ if (storedPrompt) {
175
+ // Restore the prompt and mode
176
+ DEBUG &&
177
+ console.log('AIChat: Restoring prompt and mode');
178
+ setAIChatMessage(storedPrompt.prompt);
179
+ setAIChatMode(
180
+ storedPrompt.modelName === 'ask' ? 'ask' : 'edit',
181
+ );
181
182
 
182
- // Clear the stored prompt
183
- DEBUG &&
184
- console.log('AIChat: Clearing stored prompt');
185
- clearStoredAIPrompt();
183
+ // Clear the stored prompt
184
+ DEBUG &&
185
+ console.log('AIChat: Clearing stored prompt');
186
+ clearStoredAIPrompt();
186
187
 
187
- // Auto-submit the restored prompt after a short delay
188
- DEBUG &&
189
- console.log('AIChat: Scheduling auto-submit');
190
- setTimeout(() => {
188
+ // Auto-submit the restored prompt after a short delay
191
189
  DEBUG &&
192
- console.log(
193
- 'AIChat: Auto-submitting restored prompt',
194
- );
195
- handleSendMessage(storedPrompt.prompt);
196
- }, 100);
197
- } else {
198
- DEBUG &&
199
- console.log('AIChat: No stored prompt found');
190
+ console.log('AIChat: Scheduling auto-submit');
191
+ setTimeout(() => {
192
+ DEBUG &&
193
+ console.log(
194
+ 'AIChat: Auto-submitting restored prompt',
195
+ );
196
+ handleSendMessage(storedPrompt.prompt);
197
+ }, 100);
198
+ } else {
199
+ DEBUG &&
200
+ console.log('AIChat: No stored prompt found');
201
+ }
200
202
  }
201
203
  }, [
202
204
  getStoredAIPrompt,
@@ -4,3 +4,5 @@ export const enableLiveKit =
4
4
  export const enableAIChat = true;
5
5
 
6
6
  export const enableDiffView = true;
7
+
8
+ export const enableAskMode = false;
@@ -2,7 +2,6 @@ import {
2
2
  parseMarkdownFiles,
3
3
  StreamingMarkdownParser,
4
4
  } from 'llm-code-format';
5
- import { ChatOpenAI } from '@langchain/openai';
6
5
  import OpenAI from 'openai';
7
6
  import fs from 'fs';
8
7
  import { generateRunId } from '@vizhub/viz-utils';
@@ -52,7 +51,9 @@ export const createLLMFunction = ({
52
51
  chatId: VizChatId;
53
52
  }) => {
54
53
  return async (fullPrompt: string) => {
55
- const localPresence = createAIEditLocalPresence();
54
+ const localPresence = enableStreamingEditing
55
+ ? createAIEditLocalPresence()
56
+ : null;
56
57
 
57
58
  // Create OpenRouter client for reasoning token support
58
59
  const openRouterClient = new OpenAI({
@@ -154,14 +155,19 @@ export const createLLMFunction = ({
154
155
  ],
155
156
  };
156
157
 
157
- localPresence.submit(filePresence, (error) => {
158
- if (error) {
159
- console.warn(
160
- 'AI Editor line presence submission error:',
161
- error,
162
- );
163
- }
164
- });
158
+ if (localPresence) {
159
+ localPresence.submit(
160
+ filePresence,
161
+ (error) => {
162
+ if (error) {
163
+ console.warn(
164
+ 'AI Editor line presence submission error:',
165
+ error,
166
+ );
167
+ }
168
+ },
169
+ );
170
+ }
165
171
  }
166
172
  }
167
173
  },
@@ -196,14 +202,13 @@ export const createLLMFunction = ({
196
202
  )({
197
203
  model: modelName,
198
204
  messages: [{ role: 'user', content: fullPrompt }],
199
- max_tokens: 8192,
200
205
  reasoning: {
201
206
  effort: 'medium',
202
207
  exclude: false,
203
208
  },
204
209
  provider: {
205
210
  sort: 'throughput',
206
- }, // New parameter for OpenRouter routing
211
+ },
207
212
  usage: { include: true },
208
213
  stream: true,
209
214
  });
@@ -283,15 +288,17 @@ export const createLLMFunction = ({
283
288
  console.log(
284
289
  'AI editing done, clearing AI Editor presence',
285
290
  );
286
- localPresence.submit(null, (error) => {
287
- DEBUG && console.log('AI Editor presence cleared');
288
- if (error) {
289
- console.warn(
290
- 'AI Editor presence cleanup error:',
291
- error,
292
- );
293
- }
294
- });
291
+ if (localPresence) {
292
+ localPresence.submit(null, (error) => {
293
+ DEBUG && console.log('AI Editor presence cleared');
294
+ if (error) {
295
+ console.warn(
296
+ 'AI Editor presence cleanup error:',
297
+ error,
298
+ );
299
+ }
300
+ });
301
+ }
295
302
 
296
303
  // If streaming editing is not enabled, we need to
297
304
  // apply all the edits at once