vzcode 1.33.0 → 1.35.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-ajiBaTmx.js +263 -0
- package/dist/assets/{index-DnunmWjy.css → index-lvLw6dCW.css} +1 -1
- package/dist/index.html +2 -2
- package/package.json +7 -2
- package/src/client/VZSidebar/AIChat/ChatInput.tsx +65 -0
- package/src/client/VZSidebar/AIChat/Message.tsx +36 -0
- package/src/client/VZSidebar/AIChat/MessageList.tsx +62 -0
- package/src/client/VZSidebar/AIChat/StreamingMessage.tsx +25 -0
- package/src/client/VZSidebar/AIChat/TypingIndicator.tsx +13 -0
- package/src/client/VZSidebar/AIChat/index.tsx +75 -0
- package/src/client/VZSidebar/AIChat/styles.scss +256 -0
- package/src/client/VZSidebar/index.tsx +1 -1
- package/src/client/VZSidebar/styles.scss +0 -170
- package/src/client/diff.js +1 -1
- package/src/client/featureFlags.ts +1 -1
- package/src/ot.js +10 -2
- package/src/server/aiChatHandler/aiEditing.js +42 -0
- package/src/server/aiChatHandler/chatOperations.js +195 -0
- package/src/server/aiChatHandler/errorHandling.js +53 -0
- package/src/server/aiChatHandler/index.js +91 -0
- package/src/server/aiChatHandler/llmStreaming.js +105 -0
- package/src/server/aiChatHandler/validation.js +24 -0
- package/src/server/handleAIChatMessage.js +2 -0
- package/src/server/index.js +8 -0
- package/dist/assets/index-DPIrco_g.js +0 -235
- package/src/client/VZSidebar/AIChat.tsx +0 -142
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validates incoming request data for AI chat messages
|
|
3
|
+
*/
|
|
4
|
+
export const validateRequest = (req, res) => {
|
|
5
|
+
const { content, chatId } = req.body;
|
|
6
|
+
|
|
7
|
+
if (!content || typeof content !== 'string') {
|
|
8
|
+
res.status(400).json({
|
|
9
|
+
error:
|
|
10
|
+
'Invalid request: content is required and must be a string',
|
|
11
|
+
});
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if (!chatId || typeof chatId !== 'string') {
|
|
16
|
+
res.status(400).json({
|
|
17
|
+
error:
|
|
18
|
+
'Invalid request: chatId is required and must be a string',
|
|
19
|
+
});
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return true;
|
|
24
|
+
};
|
package/src/server/index.js
CHANGED
|
@@ -14,6 +14,7 @@ import { json1Presence } from '../ot.js';
|
|
|
14
14
|
import { computeInitialDocument } from './computeInitialDocument.js';
|
|
15
15
|
import { handleAIAssist } from './handleAIAssist.js';
|
|
16
16
|
import { handleAICopilot } from './handleAICopilot.js';
|
|
17
|
+
import { handleAIChatMessage } from './handleAIChatMessage.js';
|
|
17
18
|
import { isDirectory } from './isDirectory.js';
|
|
18
19
|
import { createToken } from './livekit.js';
|
|
19
20
|
import './setupEnv.js';
|
|
@@ -112,6 +113,13 @@ app.post(
|
|
|
112
113
|
handleAICopilot(),
|
|
113
114
|
);
|
|
114
115
|
|
|
116
|
+
// Handle AI Chat Message requests.
|
|
117
|
+
app.post(
|
|
118
|
+
'/ai-chat-message',
|
|
119
|
+
bodyParser.json(),
|
|
120
|
+
handleAIChatMessage(shareDBDoc),
|
|
121
|
+
);
|
|
122
|
+
|
|
115
123
|
// Livekit Token Generator
|
|
116
124
|
app.get('/livekit-token', async (req, res) => {
|
|
117
125
|
const { room, username } = req.query;
|