mirror of https://github.com/openclaw/openclaw.git
fix: add api-version query param for Azure verification
This commit is contained in:
parent
960cc11513
commit
068260bbea
|
|
@ -254,10 +254,15 @@ async function requestOpenAiVerification(params: {
|
||||||
const resolvedUrl = isAzureUrl(params.baseUrl)
|
const resolvedUrl = isAzureUrl(params.baseUrl)
|
||||||
? transformAzureUrl(params.baseUrl, params.modelId)
|
? transformAzureUrl(params.baseUrl, params.modelId)
|
||||||
: params.baseUrl;
|
: params.baseUrl;
|
||||||
const endpoint = new URL(
|
const endpointUrl = new URL(
|
||||||
"chat/completions",
|
"chat/completions",
|
||||||
resolvedUrl.endsWith("/") ? resolvedUrl : `${resolvedUrl}/`,
|
resolvedUrl.endsWith("/") ? resolvedUrl : `${resolvedUrl}/`,
|
||||||
).href;
|
);
|
||||||
|
// Azure requires api-version query parameter
|
||||||
|
if (isAzureUrl(params.baseUrl)) {
|
||||||
|
endpointUrl.searchParams.set("api-version", "2024-10-21");
|
||||||
|
}
|
||||||
|
const endpoint = endpointUrl.href;
|
||||||
try {
|
try {
|
||||||
const res = await fetchWithTimeout(
|
const res = await fetchWithTimeout(
|
||||||
endpoint,
|
endpoint,
|
||||||
|
|
@ -290,8 +295,15 @@ async function requestAnthropicVerification(params: {
|
||||||
const resolvedUrl = isAzureUrl(params.baseUrl)
|
const resolvedUrl = isAzureUrl(params.baseUrl)
|
||||||
? transformAzureUrl(params.baseUrl, params.modelId)
|
? transformAzureUrl(params.baseUrl, params.modelId)
|
||||||
: params.baseUrl;
|
: params.baseUrl;
|
||||||
const endpoint = new URL("messages", resolvedUrl.endsWith("/") ? resolvedUrl : `${resolvedUrl}/`)
|
const endpointUrl = new URL(
|
||||||
.href;
|
"messages",
|
||||||
|
resolvedUrl.endsWith("/") ? resolvedUrl : `${resolvedUrl}/`,
|
||||||
|
);
|
||||||
|
// Azure requires api-version query parameter
|
||||||
|
if (isAzureUrl(params.baseUrl)) {
|
||||||
|
endpointUrl.searchParams.set("api-version", "2024-10-21");
|
||||||
|
}
|
||||||
|
const endpoint = endpointUrl.href;
|
||||||
try {
|
try {
|
||||||
const res = await fetchWithTimeout(
|
const res = await fetchWithTimeout(
|
||||||
endpoint,
|
endpoint,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue