-
-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
allow model selection from available providers
- Loading branch information
1 parent
96560b2
commit 36c6211
Showing
10 changed files
with
188 additions
and
66 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { WebSocket } from 'ws' | ||
import * as vscode from 'vscode' | ||
import { EVENT_NAME, URL_SYMMETRY_WS } from '../common/constants' | ||
|
||
export class SymmetryWs { | ||
private ws: WebSocket | null = null | ||
private view: vscode.WebviewView | undefined | ||
|
||
constructor(view: vscode.WebviewView | undefined) { | ||
this.view = view | ||
} | ||
|
||
public connectSymmetryWs = () => { | ||
this.ws = new WebSocket(URL_SYMMETRY_WS) | ||
|
||
this.ws.on('message', (data) => { | ||
try { | ||
const parsedData = JSON.parse(data.toString()) | ||
this.view?.webview.postMessage({ | ||
type: EVENT_NAME.twinnySymmetryModeles, | ||
value: { | ||
data: parsedData?.allPeers | ||
} | ||
}) | ||
} catch (error) { | ||
console.error('Error parsing WebSocket message:', error) | ||
} | ||
}) | ||
|
||
this.ws.on('error', (error) => { | ||
console.error('WebSocket error:', error) | ||
}) | ||
} | ||
|
||
public dispose() { | ||
if (this.ws) { | ||
this.ws.close() | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.