feat(ai): pass provider-resolved env to APIs
This commit is contained in:
@@ -192,11 +192,13 @@ class ImagesModelsImpl implements MutableImagesModels {
|
||||
|
||||
const requestModel = auth.baseUrl ? { ...model, baseUrl: auth.baseUrl } : model;
|
||||
|
||||
// Explicit request options win per-field; headers merge per header.
|
||||
// Explicit request options win per-field; headers/env merge per key.
|
||||
const apiKey = options?.apiKey ?? auth.apiKey;
|
||||
const headers = auth.headers || options?.headers ? { ...auth.headers, ...options?.headers } : undefined;
|
||||
const env =
|
||||
resolution.env || options?.env ? { ...(resolution.env ?? {}), ...(options?.env ?? {}) } : undefined;
|
||||
|
||||
return await provider.generateImages(requestModel, context, { ...options, apiKey, headers });
|
||||
return await provider.generateImages(requestModel, context, { ...options, apiKey, headers, env });
|
||||
} catch (error) {
|
||||
return {
|
||||
api: model.api,
|
||||
|
||||
Reference in New Issue
Block a user