chore: optimize the code

This commit is contained in:
Dogtiti 2024-07-05 23:56:10 +08:00
parent 183ad2a34b
commit 14bc1b6aac
3 changed files with 5 additions and 5 deletions

View File

@ -162,7 +162,7 @@ export function getHeaders() {
Accept: "application/json",
};
const modelConfig = useChatStore.getState().currentSession().mask.modelConfig;
const isGoogle = modelConfig.providerName == ServiceProvider.Azure;
const isGoogle = modelConfig.providerName == ServiceProvider.Google;
const isAzure = modelConfig.providerName === ServiceProvider.Azure;
const isAnthropic = modelConfig.providerName === ServiceProvider.Anthropic;
const authHeader = isAzure

View File

@ -142,13 +142,12 @@ export class ChatGPTApi implements LLMApi {
try {
let chatPath = "";
if (modelConfig.providerName == ServiceProvider.Azure) {
if (modelConfig.providerName === ServiceProvider.Azure) {
// find model, and get displayName as deployName
const { models: configModels, customModels: configCustomModels } =
useAppConfig.getState();
const { defaultModel, customModels: accessCustomModels } =
useAccessStore.getState();
const models = collectModelsWithDefaultModel(
configModels,
[configCustomModels, accessCustomModels].join(","),
@ -156,8 +155,8 @@ export class ChatGPTApi implements LLMApi {
);
const model = models.find(
(model) =>
model.name == modelConfig.model &&
model?.provider?.providerName == ServiceProvider.Azure,
model.name === modelConfig.model &&
model?.provider?.providerName === ServiceProvider.Azure,
);
chatPath = this.path(
Azure.ChatPath(

View File

@ -153,6 +153,7 @@ const openaiModels = [
"gpt-4o-2024-05-13",
"gpt-4-vision-preview",
"gpt-4-turbo-2024-04-09",
"gpt-4-1106-preview",
];
const googleModels = [