mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-02-11 17:40:35 +08:00
chore: optimize the code
This commit is contained in:
parent
183ad2a34b
commit
14bc1b6aac
@ -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
|
||||
|
@ -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(
|
||||
|
@ -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 = [
|
||||
|
Loading…
Reference in New Issue
Block a user