remove legacy models and support new models

This commit is contained in:
Davidlasky 2025-04-01 17:45:33 -05:00
parent 2329d59c83
commit e30d90714b
5 changed files with 13 additions and 72 deletions

View File

@ -71,8 +71,6 @@ const ClaudeMapper = {
system: "user", system: "user",
} as const; } as const;
const keys = ["claude-2, claude-instant-1"];
export class ClaudeApi implements LLMApi { export class ClaudeApi implements LLMApi {
speech(options: SpeechOptions): Promise<ArrayBuffer> { speech(options: SpeechOptions): Promise<ArrayBuffer> {
throw new Error("Method not implemented."); throw new Error("Method not implemented.");

View File

@ -197,8 +197,6 @@ export class GeminiProApi implements LLMApi {
signal: controller.signal, signal: controller.signal,
headers: getHeaders(), headers: getHeaders(),
}; };
const isThinking = options.config.model.includes("-thinking");
// make a fetch request // make a fetch request
const requestTimeoutId = setTimeout( const requestTimeoutId = setTimeout(
() => controller.abort(), () => controller.abort(),

View File

@ -109,7 +109,7 @@ export const UNFINISHED_INPUT = (id: string) => "unfinished-input-" + id;
export const STORAGE_KEY = "chatgpt-next-web"; export const STORAGE_KEY = "chatgpt-next-web";
export const REQUEST_TIMEOUT_MS = 300000; export const REQUEST_TIMEOUT_MS = 60000;
export const REQUEST_TIMEOUT_MS_FOR_THINKING = REQUEST_TIMEOUT_MS * 5; export const REQUEST_TIMEOUT_MS_FOR_THINKING = REQUEST_TIMEOUT_MS * 5;
export const EXPORT_MESSAGE_CLASS_NAME = "export-markdown"; export const EXPORT_MESSAGE_CLASS_NAME = "export-markdown";
@ -408,35 +408,18 @@ You are an AI assistant with access to system tools. Your role is to help users
`; `;
export const SUMMARIZE_MODEL = "gpt-4o"; export const SUMMARIZE_MODEL = "gpt-4o-mini";
export const GEMINI_SUMMARIZE_MODEL = "gemini-pro"; export const GEMINI_SUMMARIZE_MODEL = "gemini-2.0-flash";
export const DEEPSEEK_SUMMARIZE_MODEL = "deepseek-chat"; export const DEEPSEEK_SUMMARIZE_MODEL = "deepseek-chat";
export const KnowledgeCutOffDate: Record<string, string> = { export const KnowledgeCutOffDate: Record<string, string> = {
default: "2023-10", default: "2023-10",
"gpt-4-turbo": "2023-12",
"gpt-4-turbo-2024-04-09": "2023-12",
"gpt-4-turbo-preview": "2023-12",
"gpt-4o": "2023-10",
"gpt-4o-2024-05-13": "2023-10",
"gpt-4o-2024-08-06": "2023-10",
"gpt-4o-2024-11-20": "2023-10",
"chatgpt-4o-latest": "2023-10",
"gpt-4o-mini": "2023-10",
"gpt-4o-mini-2024-07-18": "2023-10",
"gpt-4-vision-preview": "2023-04",
"o1-mini-2024-09-12": "2023-10",
"o1-mini": "2023-10",
"o1-preview-2024-09-12": "2023-10",
"o1-preview": "2023-10",
"o1-2024-12-17": "2023-10",
"o1": "2023-10",
"o3-mini-2025-01-31": "2023-10",
"o3-mini": "2023-10",
// 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-2.5-pro-exp-03-25": "2025-01",
"gemini-pro-vision": "2023-12", "gemini-2.0-flash": "2024-08",
"claude-3-7-sonnet-latest": "2024-10",
"claude-3-5-haiku-latest": "2024-10",
"deepseek-chat": "2024-07", "deepseek-chat": "2024-07",
"deepseek-coder": "2024-07", "deepseek-coder": "2024-07",
}; };
@ -462,6 +445,7 @@ export const VISION_MODEL_REGEXES = [
/gemini-1\.5/, /gemini-1\.5/,
/gemini-exp/, /gemini-exp/,
/gemini-2\.0/, /gemini-2\.0/,
/gemini-2\.5-pro/,
/learnlm/, /learnlm/,
/qwen-vl/, /qwen-vl/,
/qwen2-vl/, /qwen2-vl/,
@ -469,6 +453,7 @@ export const VISION_MODEL_REGEXES = [
/^dall-e-3$/, // Matches exactly "dall-e-3" /^dall-e-3$/, // Matches exactly "dall-e-3"
/glm-4v/, /glm-4v/,
/vl/i, /vl/i,
/o1/,
]; ];
export const EXCLUDE_VISION_MODEL_REGEXES = [/claude-3-5-haiku-20241022/]; export const EXCLUDE_VISION_MODEL_REGEXES = [/claude-3-5-haiku-20241022/];
@ -477,24 +462,8 @@ const openaiModels = [
// As of July 2024, gpt-4o-mini should be used in place of gpt-3.5-turbo, // As of July 2024, gpt-4o-mini should be used in place of gpt-3.5-turbo,
// as it is cheaper, more capable, multimodal, and just as fast. gpt-3.5-turbo is still available for use in the API. // as it is cheaper, more capable, multimodal, and just as fast. gpt-3.5-turbo is still available for use in the API.
"gpt-3.5-turbo", "gpt-3.5-turbo",
"gpt-3.5-turbo-1106",
"gpt-3.5-turbo-0125",
"gpt-4",
"gpt-4-0613",
"gpt-4-32k",
"gpt-4-32k-0613",
"gpt-4-turbo",
"gpt-4-turbo-preview",
"gpt-4o", "gpt-4o",
"gpt-4o-2024-05-13",
"gpt-4o-2024-08-06",
"gpt-4o-2024-11-20",
"chatgpt-4o-latest",
"gpt-4o-mini", "gpt-4o-mini",
"gpt-4o-mini-2024-07-18",
"gpt-4-vision-preview",
"gpt-4-turbo-2024-04-09",
"gpt-4-1106-preview",
"dall-e-3", "dall-e-3",
"o1-mini", "o1-mini",
"o1-preview", "o1-preview",
@ -504,41 +473,16 @@ const openaiModels = [
]; ];
const googleModels = [ const googleModels = [
"gemini-1.0-pro", // Deprecated on 2/15/2025
"gemini-1.5-pro-latest",
"gemini-1.5-pro", "gemini-1.5-pro",
"gemini-1.5-pro-002",
"gemini-1.5-pro-exp-0827",
"gemini-1.5-flash-latest",
"gemini-1.5-flash-8b-latest",
"gemini-1.5-flash", "gemini-1.5-flash",
"gemini-1.5-flash-8b", "gemini-1.5-flash-8b",
"gemini-1.5-flash-002",
"gemini-1.5-flash-exp-0827",
"learnlm-1.5-pro-experimental",
"gemini-exp-1114",
"gemini-exp-1121",
"gemini-exp-1206",
"gemini-2.0-flash", "gemini-2.0-flash",
"gemini-2.0-flash-exp", "gemini-2.0-flash-lite",
"gemini-2.0-flash-lite-preview-02-05",
"gemini-2.0-flash-thinking-exp",
"gemini-2.0-flash-thinking-exp-1219",
"gemini-2.0-flash-thinking-exp-01-21",
"gemini-2.0-pro-exp",
"gemini-2.0-pro-exp-02-05",
"gemini-2.5-pro-exp-03-25", "gemini-2.5-pro-exp-03-25",
]; ];
const anthropicModels = [ const anthropicModels = [
"claude-instant-1.2",
"claude-2.0",
"claude-2.1",
"claude-3-sonnet-20240229",
"claude-3-opus-20240229",
"claude-3-opus-latest", "claude-3-opus-latest",
"claude-3-haiku-20240307",
"claude-3-5-haiku-20241022",
"claude-3-5-haiku-latest", "claude-3-5-haiku-latest",
"claude-3-5-sonnet-latest", "claude-3-5-sonnet-latest",
"claude-3-7-sonnet-latest", "claude-3-7-sonnet-latest",

View File

@ -3,7 +3,7 @@ import { isModelNotavailableInServer } from "../app/utils/model";
describe("isModelNotavailableInServer", () => { describe("isModelNotavailableInServer", () => {
test("test model will return false, which means the model is available", () => { test("test model will return false, which means the model is available", () => {
const customModels = ""; const customModels = "";
const modelName = "gpt-4"; const modelName = "gpt-4o";
const providerNames = "OpenAI"; const providerNames = "OpenAI";
const result = isModelNotavailableInServer( const result = isModelNotavailableInServer(
customModels, customModels,

View File

@ -15,10 +15,11 @@ describe("isVisionModel", () => {
test("should identify vision models using regex patterns", () => { test("should identify vision models using regex patterns", () => {
const visionModels = [ const visionModels = [
"gpt-4-vision", "gpt-4o",
"claude-3-opus", "claude-3-opus",
"gemini-1.5-pro", "gemini-1.5-pro",
"gemini-2.0", "gemini-2.0",
"gemini-2.5-pro",
"gemini-exp-vision", "gemini-exp-vision",
"learnlm-vision", "learnlm-vision",
"qwen-vl-max", "qwen-vl-max",