* 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
()
| 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 | * |
no test coverage detected