()
| 316 | } |
| 317 | |
| 318 | private async getClient(): Promise<vscode.LanguageModelChat> { |
| 319 | if (!this.client) { |
| 320 | console.debug("Roo Code <Language Model API>: Getting client with options:", { |
| 321 | vsCodeLmModelSelector: this.options.vsCodeLmModelSelector, |
| 322 | hasOptions: !!this.options, |
| 323 | selectorKeys: this.options.vsCodeLmModelSelector ? Object.keys(this.options.vsCodeLmModelSelector) : [], |
| 324 | }) |
| 325 | |
| 326 | try { |
| 327 | // Use default empty selector if none provided to get all available models |
| 328 | const selector = this.options?.vsCodeLmModelSelector || {} |
| 329 | console.debug("Roo Code <Language Model API>: Creating client with selector:", selector) |
| 330 | this.client = await this.createClient(selector) |
| 331 | } catch (error) { |
| 332 | const message = error instanceof Error ? error.message : "Unknown error" |
| 333 | console.error("Roo Code <Language Model API>: Client creation failed:", message) |
| 334 | throw new Error(`Roo Code <Language Model API>: Failed to create client: ${message}`) |
| 335 | } |
| 336 | } |
| 337 | |
| 338 | return this.client |
| 339 | } |
| 340 | |
| 341 | private cleanMessageContent(content: any): any { |
| 342 | if (!content) { |
no test coverage detected