mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-05-19 20:20:16 +09:00
Merge pull request #4412 from RubuJam/main
Gemini will generate the request address based on the selected model name and supports Gemini 1.5 Pro (gemini-1.5-pro-latest).
This commit is contained in:
commit
1e2a662fa6
@ -112,8 +112,8 @@ export class GeminiProApi implements LLMApi {
|
|||||||
options.onController?.(controller);
|
options.onController?.(controller);
|
||||||
try {
|
try {
|
||||||
let googleChatPath = visionModel
|
let googleChatPath = visionModel
|
||||||
? Google.VisionChatPath
|
? Google.VisionChatPath(modelConfig.model)
|
||||||
: Google.ChatPath;
|
: Google.ChatPath(modelConfig.model);
|
||||||
let chatPath = this.path(googleChatPath);
|
let chatPath = this.path(googleChatPath);
|
||||||
|
|
||||||
// let baseUrl = accessStore.googleUrl;
|
// let baseUrl = accessStore.googleUrl;
|
||||||
|
@ -98,10 +98,8 @@ export const Azure = {
|
|||||||
|
|
||||||
export const Google = {
|
export const Google = {
|
||||||
ExampleEndpoint: "https://generativelanguage.googleapis.com/",
|
ExampleEndpoint: "https://generativelanguage.googleapis.com/",
|
||||||
ChatPath: "v1beta/models/gemini-pro:generateContent",
|
ChatPath: (modelName: string) => `v1beta/models/${modelName}:generateContent`,
|
||||||
VisionChatPath: "v1beta/models/gemini-pro-vision:generateContent",
|
VisionChatPath: (modelName: string) => `v1beta/models/${modelName}:generateContent`,
|
||||||
|
|
||||||
// /api/openai/v1/chat/completions
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const DEFAULT_INPUT_TEMPLATE = `{{input}}`; // input / time / model / lang
|
export const DEFAULT_INPUT_TEMPLATE = `{{input}}`; // input / time / model / lang
|
||||||
@ -136,6 +134,7 @@ export const KnowledgeCutOffDate: Record<string, string> = {
|
|||||||
// After improvements,
|
// After improvements,
|
||||||
// it's now easier to add "KnowledgeCutOffDate" instead of stupid hardcoding it, as was done previously.
|
// it's now easier to add "KnowledgeCutOffDate" instead of stupid hardcoding it, as was done previously.
|
||||||
"gemini-pro": "2023-12",
|
"gemini-pro": "2023-12",
|
||||||
|
"gemini-pro-vision": "2023-12",
|
||||||
};
|
};
|
||||||
|
|
||||||
export const DEFAULT_MODELS = [
|
export const DEFAULT_MODELS = [
|
||||||
@ -311,7 +310,16 @@ export const DEFAULT_MODELS = [
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "gemini-pro",
|
name: "gemini-1.0-pro",
|
||||||
|
available: true,
|
||||||
|
provider: {
|
||||||
|
id: "google",
|
||||||
|
providerName: "Google",
|
||||||
|
providerType: "google",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "gemini-1.5-pro-latest",
|
||||||
available: true,
|
available: true,
|
||||||
provider: {
|
provider: {
|
||||||
id: "google",
|
id: "google",
|
||||||
|
10
app/utils.ts
10
app/utils.ts
@ -290,7 +290,15 @@ export function getMessageImages(message: RequestMessage): string[] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function isVisionModel(model: string) {
|
export function isVisionModel(model: string) {
|
||||||
const visionKeywords = ["vision", "claude-3"];
|
|
||||||
|
// Note: This is a better way using the TypeScript feature instead of `&&` or `||` (ts v5.5.0-dev.20240314 I've been using)
|
||||||
|
|
||||||
|
const visionKeywords = [
|
||||||
|
"vision",
|
||||||
|
"claude-3",
|
||||||
|
"gemini-1.5-pro",
|
||||||
|
];
|
||||||
|
|
||||||
const isGpt4Turbo = model.includes("gpt-4-turbo") && !model.includes("preview");
|
const isGpt4Turbo = model.includes("gpt-4-turbo") && !model.includes("preview");
|
||||||
|
|
||||||
return visionKeywords.some((keyword) => model.includes(keyword)) || isGpt4Turbo;
|
return visionKeywords.some((keyword) => model.includes(keyword)) || isGpt4Turbo;
|
||||||
|
Loading…
Reference in New Issue
Block a user