Skip to content

Commit

Permalink
chore: optimize the code
Browse files Browse the repository at this point in the history
  • Loading branch information
Dogtiti committed Jul 5, 2024
1 parent 183ad2a commit 14bc1b6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/client/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 3 additions & 4 deletions app/client/platforms/openai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,22 +142,21 @@ 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(","),
defaultModel,
);
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(
Expand Down
1 change: 1 addition & 0 deletions app/constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down

0 comments on commit 14bc1b6

Please sign in to comment.