mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-05-26 07:30:18 +09:00
fix: USE_OPENAI_ENDPOINT_FOR_ALL_MODELS
This commit is contained in:
parent
740ece39da
commit
bc9679335d
@ -218,7 +218,7 @@ export function getHeaders(ignoreHeaders?: boolean) {
|
|||||||
const modelConfig = useChatStore.getState().currentSession().mask.modelConfig;
|
const modelConfig = useChatStore.getState().currentSession().mask.modelConfig;
|
||||||
const isGoogle =
|
const isGoogle =
|
||||||
modelConfig.model.startsWith("gemini") &&
|
modelConfig.model.startsWith("gemini") &&
|
||||||
!accessStore.useOpenAIEndpointForAllModels();
|
!accessStore.isUseOpenAIEndpointForAllModels;
|
||||||
if (!ignoreHeaders && !isGoogle) {
|
if (!ignoreHeaders && !isGoogle) {
|
||||||
headers = {
|
headers = {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
|
@ -1,5 +1,11 @@
|
|||||||
/* eslint-disable @next/next/no-img-element */
|
/* eslint-disable @next/next/no-img-element */
|
||||||
import { ChatMessage, ModelType, useAppConfig, useChatStore } from "../store";
|
import {
|
||||||
|
ChatMessage,
|
||||||
|
ModelType,
|
||||||
|
useAccessStore,
|
||||||
|
useAppConfig,
|
||||||
|
useChatStore,
|
||||||
|
} from "../store";
|
||||||
import Locale from "../locales";
|
import Locale from "../locales";
|
||||||
import styles from "./exporter.module.scss";
|
import styles from "./exporter.module.scss";
|
||||||
import {
|
import {
|
||||||
|
@ -392,8 +392,7 @@ export const useChatStore = createPersistStore(
|
|||||||
session.messages.push(botMessage);
|
session.messages.push(botMessage);
|
||||||
});
|
});
|
||||||
const isEnableRAG = attachFiles && attachFiles?.length > 0;
|
const isEnableRAG = attachFiles && attachFiles?.length > 0;
|
||||||
var api: ClientApi;
|
var api: ClientApi = getClientApi(modelConfig.model);
|
||||||
api = new ClientApi(ModelProvider.GPT);
|
|
||||||
if (
|
if (
|
||||||
config.pluginConfig.enable &&
|
config.pluginConfig.enable &&
|
||||||
session.mask.usePlugins &&
|
session.mask.usePlugins &&
|
||||||
@ -660,7 +659,7 @@ export const useChatStore = createPersistStore(
|
|||||||
const session = get().currentSession();
|
const session = get().currentSession();
|
||||||
const modelConfig = session.mask.modelConfig;
|
const modelConfig = session.mask.modelConfig;
|
||||||
|
|
||||||
var api: ClientApi = getClientApi(config.modelConfig.model);
|
var api: ClientApi = getClientApi(modelConfig.model);
|
||||||
|
|
||||||
// remove error messages if any
|
// remove error messages if any
|
||||||
const messages = session.messages;
|
const messages = session.messages;
|
||||||
|
@ -284,8 +284,9 @@ export function isSupportRAGModel(modelName: string) {
|
|||||||
|
|
||||||
export function getClientApi(modelName: string): ClientApi {
|
export function getClientApi(modelName: string): ClientApi {
|
||||||
const accessStore = useAccessStore.getState();
|
const accessStore = useAccessStore.getState();
|
||||||
if (accessStore.useOpenAIEndpointForAllModels())
|
if (accessStore.isUseOpenAIEndpointForAllModels) {
|
||||||
return new ClientApi(ModelProvider.GPT);
|
return new ClientApi(ModelProvider.GPT);
|
||||||
|
}
|
||||||
var api: ClientApi;
|
var api: ClientApi;
|
||||||
if (modelName.startsWith("gemini")) {
|
if (modelName.startsWith("gemini")) {
|
||||||
api = new ClientApi(ModelProvider.GeminiPro);
|
api = new ClientApi(ModelProvider.GeminiPro);
|
||||||
|
Loading…
Reference in New Issue
Block a user