fix: update Azure OpenAI API version references to v1 in configuration and translations (#10799)

* fix: update Azure OpenAI API version references to v1 in configuration and translations

* fix: support Azure OpenAI API v1 in client compatibility check

* fix: lint/ format
This commit is contained in:
SuYao 2025-11-14 13:10:13 +08:00 committed by GitHub
parent 75fcf8fbb5
commit 4e699c48bc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 15 additions and 12 deletions

View File

@ -90,7 +90,7 @@ export class OpenAIResponseAPIClient extends OpenAIBaseClient<
if (isOpenAILLMModel(model) && !isOpenAIChatCompletionOnlyModel(model)) {
if (this.provider.id === 'azure-openai' || this.provider.type === 'azure-openai') {
this.provider = { ...this.provider, apiHost: this.formatApiHost() }
if (this.provider.apiVersion === 'preview') {
if (this.provider.apiVersion === 'preview' || this.provider.apiVersion === 'v1') {
return this
} else {
return this.client

View File

@ -189,9 +189,11 @@ export function providerToAiSdkConfig(
}
}
// azure
// https://learn.microsoft.com/en-us/azure/ai-foundry/openai/latest
// https://learn.microsoft.com/en-us/azure/ai-foundry/openai/how-to/responses?tabs=python-key#responses-api
if (aiSdkProviderId === 'azure' || actualProvider.type === 'azure-openai') {
// extraOptions.apiVersion = actualProvider.apiVersion 默认使用v1不使用azure endpoint
if (actualProvider.apiVersion === 'preview') {
// extraOptions.apiVersion = actualProvider.apiVersion === 'preview' ? 'v1' : actualProvider.apiVersion 默认使用v1不使用azure endpoint
if (actualProvider.apiVersion === 'preview' || actualProvider.apiVersion === 'v1') {
extraOptions.mode = 'responses'
} else {
extraOptions.mode = 'chat'

View File

@ -4343,7 +4343,7 @@
},
"azure": {
"apiversion": {
"tip": "The API version of Azure OpenAI, if you want to use Response API, please enter the preview version"
"tip": "The API version of Azure OpenAI, if you want to use Response API, please enter the v1 version"
}
},
"basic_auth": {

View File

@ -4343,7 +4343,7 @@
},
"azure": {
"apiversion": {
"tip": "Azure OpenAI 的 API 版本,如果想要使用 Response API请输入 preview 版本"
"tip": "Azure OpenAI 的 API 版本,如果想要使用 Response API请输入 v1 版本"
}
},
"basic_auth": {

View File

@ -4343,7 +4343,7 @@
},
"azure": {
"apiversion": {
"tip": "Azure OpenAI 的 API 版本,如果想要使用 Response API請輸入 preview 版本"
"tip": "Azure OpenAI 的 API 版本,如果想要使用 Response API請輸入 v1 版本"
}
},
"basic_auth": {

View File

@ -4343,7 +4343,7 @@
},
"azure": {
"apiversion": {
"tip": "Η έκδοση του API για Azure OpenAI. Αν θέλετε να χρησιμοποιήσετε το Response API, εισάγετε μια προεπισκόπηση έκδοσης"
"tip": "Η έκδοση του API για Azure OpenAI. Αν θέλετε να χρησιμοποιήσετε το Response API, εισάγετε μια v1 έκδοσης"
}
},
"basic_auth": {

View File

@ -4343,7 +4343,7 @@
},
"azure": {
"apiversion": {
"tip": "Version de l'API Azure OpenAI, veuillez saisir une version preview si vous souhaitez utiliser l'API de réponse"
"tip": "Version de l'API Azure OpenAI, veuillez saisir une version v1 si vous souhaitez utiliser l'API de réponse"
}
},
"basic_auth": {

View File

@ -4343,7 +4343,7 @@
},
"azure": {
"apiversion": {
"tip": "Azure OpenAIのAPIバージョン。Response APIを使用する場合は、previewバージョンを入力してください"
"tip": "Azure OpenAIのAPIバージョン。Response APIを使用する場合は、v1バージョンを入力してください"
}
},
"basic_auth": {

View File

@ -4343,7 +4343,7 @@
},
"azure": {
"apiversion": {
"tip": "Versão da API do Azure OpenAI. Se desejar usar a API de Resposta, insira a versão de visualização"
"tip": "Versão da API do Azure OpenAI. Se desejar usar a API de Resposta, insira a versão de v1"
}
},
"basic_auth": {

View File

@ -4343,7 +4343,7 @@
},
"azure": {
"apiversion": {
"tip": "Версия API Azure OpenAI. Если вы хотите использовать Response API, введите версию preview"
"tip": "Версия API Azure OpenAI. Если вы хотите использовать Response API, введите версию v1"
}
},
"basic_auth": {

View File

@ -11,7 +11,8 @@ import type { Topic } from '@renderer/types'
import type { Message } from '@renderer/types/newMessage'
import { classNames } from '@renderer/utils'
import { Popover } from 'antd'
import { ComponentProps, memo, useCallback, useEffect, useMemo, useState } from 'react'
import type { ComponentProps } from 'react'
import { memo, useCallback, useEffect, useMemo, useState } from 'react'
import styled from 'styled-components'
import { useChatMaxWidth } from '../Chat'