mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-11-19 15:33:44 +08:00
feat: support gemini pro
This commit is contained in:
@@ -29,6 +29,9 @@ const DEFAULT_ACCESS_STATE = {
|
||||
azureApiKey: "",
|
||||
azureApiVersion: "2023-08-01-preview",
|
||||
|
||||
// google
|
||||
googleApiKey: "",
|
||||
|
||||
// server config
|
||||
needCode: true,
|
||||
hideUserApiKey: false,
|
||||
@@ -99,9 +102,11 @@ export const useAccessStore = createPersistStore(
|
||||
token: string;
|
||||
openaiApiKey: string;
|
||||
azureApiVersion: string;
|
||||
googleApiKey: string;
|
||||
};
|
||||
state.openaiApiKey = state.token;
|
||||
state.azureApiVersion = "2023-08-01-preview";
|
||||
state.googleApiKey = state.token;
|
||||
}
|
||||
|
||||
return persistedState as any;
|
||||
|
||||
@@ -323,6 +323,7 @@ export const useChatStore = createPersistStore(
|
||||
config.pluginConfig.enable &&
|
||||
session.mask.usePlugins &&
|
||||
allPlugins.length > 0 &&
|
||||
modelConfig.model.startsWith("gpt") &&
|
||||
modelConfig.model != "gpt-4-vision-preview"
|
||||
) {
|
||||
console.log("[ToolAgent] start");
|
||||
@@ -392,6 +393,7 @@ export const useChatStore = createPersistStore(
|
||||
});
|
||||
} else {
|
||||
// make request
|
||||
api.switch(modelConfig.model);
|
||||
api.llm.chat({
|
||||
messages: sendMessages,
|
||||
config: { ...modelConfig, stream: true },
|
||||
@@ -581,6 +583,7 @@ export const useChatStore = createPersistStore(
|
||||
content: Locale.Store.Prompt.Topic,
|
||||
}),
|
||||
);
|
||||
api.switch(session.mask.modelConfig.model);
|
||||
api.llm.chat({
|
||||
messages: topicMessages,
|
||||
config: {
|
||||
@@ -630,6 +633,7 @@ export const useChatStore = createPersistStore(
|
||||
historyMsgLength > modelConfig.compressMessageLengthThreshold &&
|
||||
modelConfig.sendMemory
|
||||
) {
|
||||
api.switch(modelConfig.model);
|
||||
api.llm.chat({
|
||||
messages: toBeSummarizedMsgs.concat(
|
||||
createMessage({
|
||||
|
||||
Reference in New Issue
Block a user