Skip to content

Commit 34c4b10

Browse files
committed
Type cast incoming WebSocket messages to WebSocketMessage and update chatbot URL property access
1 parent dbe1b44 commit 34c4b10

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

apps/editor/src/services/websocket-manager.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import * as path from 'path'
55
import * as net from 'net'
66
import {
77
ConnectedBrowser,
8-
InitializeChatMessage
8+
InitializeChatMessage,
9+
WebSocketMessage
910
} from '@shared/types/websocket-message'
1011
import { CHATBOTS } from '@shared/constants/chatbots'
1112
import { DEFAULT_PORT, SECURITY_TOKENS } from '@shared/constants/websocket'
@@ -142,7 +143,7 @@ export class WebSocketManager {
142143

143144
this.client.on('message', async (data) => {
144145
try {
145-
const message = JSON.parse(data.toString())
146+
const message = JSON.parse(data.toString()) as WebSocketMessage
146147
Logger.info({
147148
function_name: '_connect_as_client',
148149
message: 'Incoming WS message',
@@ -159,7 +160,7 @@ export class WebSocketManager {
159160
vscode.commands.executeCommand('codeWebChat.applyChatResponse', {
160161
raw_instructions: message.raw_instructions,
161162
edit_format: message.edit_format,
162-
chatbot_url: message.chatbot_url
163+
chatbot_url: message.url
163164
})
164165
}
165166
} catch (error) {

0 commit comments

Comments
 (0)