MCPcopy Create free account
hub / github.com/chieapp/chie / sendMessage

Method sendMessage

src/extensions/bingchat/bingchat-api.ts:43–67  ·  view source on GitHub ↗
(text: string, options: ChatAPIOptions)

Source from the content-addressed store, hash-verified

41 super(credential);
42 }
43
44 async sendMessage(text: string, options: ChatAPIOptions) {
45 if (!this.session)
46 await this.#createConversation(options);
47 this.#lastContentLength = 0;
48 this.#lastLinks = null;
49
50 const ws = new WebSocket(sydneyWebSocketURL);
51
52 // Handle abort signals.
53 const handler = ws.terminate.bind(ws);
54 if (options.signal)
55 options.signal.addEventListener('abort', handler);
56
57 try {
58 await this.#createWebSocketConnection(ws, options);
59 await this.#sendMessageToWebSocket(ws, text, options);
60 ws.close();
61 } catch (error) {
62 ws.terminate();
63 throw error;
64 } finally {
65 if (options.signal)
66 options.signal.removeEventListener('abort', handler);
67 }
68 }
69
70 async #createConversation(options) {

Callers 6

enterConversationFunction · 0.45
executeToolFunction · 0.45
#onEnterMethod · 0.45
#sendReplyMethod · 0.45

Calls 4

#createConversationMethod · 0.95
closeMethod · 0.80

Tested by

no test coverage detected