vzcode 1.52.0 → 1.53.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.53.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({
@@ -196,14 +197,13 @@ export const createLLMFunction = ({
196
197
  )({
197
198
  model: modelName,
198
199
  messages: [{ role: 'user', content: fullPrompt }],
199
- max_tokens: 8192,
200
200
  reasoning: {
201
201
  effort: 'medium',
202
202
  exclude: false,
203
203
  },
204
204
  provider: {
205
205
  sort: 'throughput',
206
- }, // New parameter for OpenRouter routing
206
+ },
207
207
  usage: { include: true },
208
208
  stream: true,
209
209
  });