| 388 | } |
| 389 | |
| 390 | async generateCode(request: GenerateCodeRequest, options?: {signal?: AbortSignal}): |
| 391 | Promise<GenerateCodeResponse|null> { |
| 392 | // Disable logging for now. |
| 393 | // For context, see b/454563259#comment35. |
| 394 | // We should be able to remove this ~end of April. |
| 395 | if (Root.Runtime.hostConfig.devToolsGeminiRebranding?.enabled) { |
| 396 | request.metadata.disable_user_content_logging = true; |
| 397 | } |
| 398 | |
| 399 | if (this.#gcaClient.enabled()) { |
| 400 | // Inline and remove the else clause after migration |
| 401 | return await this.#gcaClient.generateCode(request, options); |
| 402 | } |
| 403 | const response = await DispatchHttpRequestClient.makeHttpRequest<GenerateCodeResponse>( |
| 404 | { |
| 405 | service: SERVICE_NAME, |
| 406 | path: '/v1/aida:generateCode', |
| 407 | method: 'POST', |
| 408 | body: JSON.stringify(request), |
| 409 | }, |
| 410 | options); |
| 411 | |
| 412 | return response; |
| 413 | } |
| 414 | } |
| 415 | |
| 416 | export function convertToUserTierEnum(userTier: string|undefined): UserTier { |