MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / initializeClient

Method initializeClient

src/api/providers/vscode-lm.ts:105–121  ·  view source on GitHub ↗

* Initializes the VS Code Language Model client. * This method is called during the constructor to set up the client. * This useful when the client is not created yet and call getModel() before the client is created. * @returns Promise * @throws Error when client initialization fails

()

Source from the content-addressed store, hash-verified

103 * @throws Error when client initialization fails
104 */
105 async initializeClient(): Promise<void> {
106 try {
107 // Check if the client is already initialized
108 if (this.client) {
109 console.debug("Roo Code <Language Model API>: Client already initialized")
110 return
111 }
112 // Create a new client instance
113 this.client = await this.createClient(this.options.vsCodeLmModelSelector || {})
114 console.debug("Roo Code <Language Model API>: Client initialized successfully")
115 } catch (error) {
116 // Handle errors during client initialization
117 const errorMessage = error instanceof Error ? error.message : "Unknown error"
118 console.error("Roo Code <Language Model API>: Client initialization failed:", errorMessage)
119 throw new Error(`Roo Code <Language Model API>: Failed to initialize client: ${errorMessage}`)
120 }
121 }
122 /**
123 * Creates a language model chat client based on the provided selector.
124 *

Callers 2

constructorMethod · 0.95
vscode-lm.spec.tsFile · 0.80

Calls 3

createClientMethod · 0.95
debugMethod · 0.65
errorMethod · 0.65

Tested by

no test coverage detected