fix: fix bugs when choosing azure api version.

This commit is contained in:
Duang Cheng 2023-04-19 20:04:38 +08:00
parent ffe4c91be9
commit 45e077cd18
2 changed files with 6 additions and 10 deletions

View File

@ -23,7 +23,6 @@ import {
useUpdateStore, useUpdateStore,
useAccessStore, useAccessStore,
ModalConfigValidator, ModalConfigValidator,
AZURE_API_VERSION,
} from "../store"; } from "../store";
import { Avatar } from "./chat"; import { Avatar } from "./chat";
@ -617,13 +616,11 @@ export function Settings(props: { closeSettings: () => void }) {
); );
}} }}
> >
{(accessStore.enableAOAI ? AZURE_API_VERSION : ALL_MODELS).map( {ALL_MODELS.map((v) => (
(v) => ( <option value={v.name} key={v.name} disabled={!v.available}>
<option value={v.name} key={v.name} disabled={!v.available}> {v.name}
{v.name} </option>
</option> ))}
),
)}
</select> </select>
</SettingItem> </SettingItem>
<SettingItem <SettingItem

View File

@ -52,10 +52,9 @@ function getRequestPath() {
const OPENAI_REQUEST_PATH = "v1/chat/completions"; const OPENAI_REQUEST_PATH = "v1/chat/completions";
const { enableAOAI, azureDeployName } = useAccessStore.getState(); const { enableAOAI, azureDeployName } = useAccessStore.getState();
const { modelConfig } = useChatStore.getState().config;
if (!enableAOAI) return OPENAI_REQUEST_PATH; if (!enableAOAI) return OPENAI_REQUEST_PATH;
const AZURE_REQUEST_PATH = `openai/deployments/${azureDeployName}/chat/completions?api-version=${modelConfig.model}`; const AZURE_REQUEST_PATH = `openai/deployments/${azureDeployName}/chat/completions?api-version=2023-03-15-preview`;
return AZURE_REQUEST_PATH; return AZURE_REQUEST_PATH;
} }