update: sync local changes with latest features
This commit is contained in:
@@ -116,8 +116,20 @@ export class BaseExecutor {
|
||||
|
||||
for (let urlIndex = 0; urlIndex < fallbackCount; urlIndex++) {
|
||||
const url = this.buildUrl(model, stream, urlIndex, credentials);
|
||||
const transformedBody = this.transformRequest(model, body, stream, credentials);
|
||||
const headers = this.buildHeaders(credentials, stream);
|
||||
|
||||
// Merge extra body params from provider-specific data (request body takes priority)
|
||||
let mergedBody = this.transformRequest(model, body, stream, credentials);
|
||||
const extraBodyParams = credentials?.providerSpecificData?.bodyParams;
|
||||
if (extraBodyParams && typeof extraBodyParams === "object" && !Array.isArray(extraBodyParams)) {
|
||||
mergedBody = { ...extraBodyParams, ...mergedBody };
|
||||
}
|
||||
|
||||
// Merge extra header params from provider-specific data (request headers take priority)
|
||||
let headers = this.buildHeaders(credentials, stream);
|
||||
const extraHeaderParams = credentials?.providerSpecificData?.headerParams;
|
||||
if (extraHeaderParams && typeof extraHeaderParams === "object" && !Array.isArray(extraHeaderParams)) {
|
||||
headers = { ...extraHeaderParams, ...headers };
|
||||
}
|
||||
|
||||
if (!retryAttemptsByUrl[urlIndex]) retryAttemptsByUrl[urlIndex] = 0;
|
||||
|
||||
@@ -128,7 +140,7 @@ export class BaseExecutor {
|
||||
const mergedSignal = signal ? AbortSignal.any([signal, connectCtrl.signal]) : connectCtrl.signal;
|
||||
|
||||
try {
|
||||
const bodyStr = JSON.stringify(transformedBody);
|
||||
const bodyStr = JSON.stringify(mergedBody);
|
||||
const fetchT0 = Date.now();
|
||||
dbg("FETCH", `${this.provider.toUpperCase()} → ${url} | body=${bodyStr.length}B | connectTimeout=${timeoutMs}ms`);
|
||||
const response = await proxyAwareFetch(url, {
|
||||
@@ -150,7 +162,7 @@ export class BaseExecutor {
|
||||
continue;
|
||||
}
|
||||
|
||||
return { response, url, headers, transformedBody };
|
||||
return { response, url, headers, transformedBody: mergedBody };
|
||||
} catch (error) {
|
||||
clearTimeout(connectTimer);
|
||||
lastError = error;
|
||||
|
||||
Reference in New Issue
Block a user