2023-03-24 02:00:33 +09:00
|
|
|
export const OWNER = "Yidadaa";
|
|
|
|
export const REPO = "ChatGPT-Next-Web";
|
|
|
|
export const REPO_URL = `https://github.com/${OWNER}/${REPO}`;
|
2023-04-03 14:29:37 +09:00
|
|
|
export const ISSUE_URL = `https://github.com/${OWNER}/${REPO}/issues`;
|
2023-04-06 01:41:44 +09:00
|
|
|
export const UPDATE_URL = `${REPO_URL}#keep-updated`;
|
2023-06-30 01:26:03 +09:00
|
|
|
export const RELEASE_URL = `${REPO_URL}/releases`;
|
2023-03-24 02:00:33 +09:00
|
|
|
export const FETCH_COMMIT_URL = `https://api.github.com/repos/${OWNER}/${REPO}/commits?per_page=1`;
|
2023-03-31 01:46:17 +09:00
|
|
|
export const FETCH_TAG_URL = `https://api.github.com/repos/${OWNER}/${REPO}/tags?per_page=1`;
|
2023-04-11 02:21:34 +09:00
|
|
|
export const RUNTIME_CONFIG_DOM = "danger-runtime-config";
|
2023-09-13 03:51:02 +09:00
|
|
|
|
2024-02-07 14:17:11 +09:00
|
|
|
export const DEFAULT_API_HOST = "https://api.nextchat.dev";
|
2023-11-08 01:20:34 +09:00
|
|
|
export const OPENAI_BASE_URL = "https://api.openai.com";
|
2024-04-07 12:32:57 +09:00
|
|
|
export const ANTHROPIC_BASE_URL = "https://api.anthropic.com";
|
2023-04-21 02:12:39 +09:00
|
|
|
|
2023-12-24 03:15:30 +09:00
|
|
|
export const GEMINI_BASE_URL = "https://generativelanguage.googleapis.com/";
|
|
|
|
|
2024-07-06 14:05:09 +09:00
|
|
|
export const BAIDU_BASE_URL = "https://aip.baidubce.com";
|
|
|
|
|
|
|
|
export const BAIDU_OATUH_URL = `${BAIDU_BASE_URL}/oauth/2.0/token`;
|
|
|
|
|
2023-04-21 02:12:39 +09:00
|
|
|
export enum Path {
|
|
|
|
Home = "/",
|
|
|
|
Chat = "/chat",
|
|
|
|
Settings = "/settings",
|
2023-04-24 02:15:44 +09:00
|
|
|
NewChat = "/new-chat",
|
2023-04-25 01:49:27 +09:00
|
|
|
Masks = "/masks",
|
2023-06-07 03:18:24 +09:00
|
|
|
Auth = "/auth",
|
2023-04-24 02:15:44 +09:00
|
|
|
}
|
|
|
|
|
2023-09-13 03:51:02 +09:00
|
|
|
export enum ApiPath {
|
2024-03-14 02:33:41 +09:00
|
|
|
Cors = "",
|
2024-07-05 20:59:45 +09:00
|
|
|
Azure = "/api/azure",
|
2023-11-10 03:43:30 +09:00
|
|
|
OpenAI = "/api/openai",
|
2023-11-08 00:22:11 +09:00
|
|
|
Anthropic = "/api/anthropic",
|
2024-07-06 14:05:09 +09:00
|
|
|
Baidu = "/api/baidu",
|
2023-09-13 03:51:02 +09:00
|
|
|
}
|
|
|
|
|
2023-04-24 02:15:44 +09:00
|
|
|
export enum SlotID {
|
|
|
|
AppBody = "app-body",
|
2023-11-10 03:43:30 +09:00
|
|
|
CustomModel = "custom-model",
|
2023-04-21 02:12:39 +09:00
|
|
|
}
|
2023-04-21 03:52:53 +09:00
|
|
|
|
2023-04-27 02:16:21 +09:00
|
|
|
export enum FileName {
|
|
|
|
Masks = "masks.json",
|
|
|
|
Prompts = "prompts.json",
|
|
|
|
}
|
|
|
|
|
2023-04-27 03:00:22 +09:00
|
|
|
export enum StoreKey {
|
|
|
|
Chat = "chat-next-web-store",
|
|
|
|
Access = "access-control",
|
|
|
|
Config = "app-config",
|
|
|
|
Mask = "mask-store",
|
|
|
|
Prompt = "prompt-store",
|
|
|
|
Update = "chat-update",
|
2023-06-28 01:34:01 +09:00
|
|
|
Sync = "sync",
|
2023-04-27 03:00:22 +09:00
|
|
|
}
|
|
|
|
|
2023-09-19 02:47:15 +09:00
|
|
|
export const DEFAULT_SIDEBAR_WIDTH = 300;
|
2023-04-21 03:52:53 +09:00
|
|
|
export const MAX_SIDEBAR_WIDTH = 500;
|
|
|
|
export const MIN_SIDEBAR_WIDTH = 230;
|
|
|
|
export const NARROW_SIDEBAR_WIDTH = 100;
|
2023-05-04 23:50:07 +09:00
|
|
|
|
2023-08-09 16:27:08 +09:00
|
|
|
export const ACCESS_CODE_PREFIX = "nk-";
|
2023-05-10 00:01:17 +09:00
|
|
|
|
|
|
|
export const LAST_INPUT_KEY = "last-input";
|
2023-09-05 02:54:28 +09:00
|
|
|
export const UNFINISHED_INPUT = (id: string) => "unfinished-input-" + id;
|
2023-05-15 00:00:17 +09:00
|
|
|
|
2023-09-13 03:51:02 +09:00
|
|
|
export const STORAGE_KEY = "chatgpt-next-web";
|
|
|
|
|
2023-05-15 00:00:17 +09:00
|
|
|
export const REQUEST_TIMEOUT_MS = 60000;
|
2023-05-25 02:04:37 +09:00
|
|
|
|
|
|
|
export const EXPORT_MESSAGE_CLASS_NAME = "export-markdown";
|
2023-06-13 01:39:29 +09:00
|
|
|
|
2023-11-10 03:43:30 +09:00
|
|
|
export enum ServiceProvider {
|
|
|
|
OpenAI = "OpenAI",
|
|
|
|
Azure = "Azure",
|
2023-12-24 03:15:30 +09:00
|
|
|
Google = "Google",
|
2024-04-07 12:32:57 +09:00
|
|
|
Anthropic = "Anthropic",
|
2024-07-06 14:05:09 +09:00
|
|
|
Baidu = "Baidu",
|
2023-12-24 03:15:30 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
export enum ModelProvider {
|
|
|
|
GPT = "GPT",
|
2023-12-24 05:22:12 +09:00
|
|
|
GeminiPro = "GeminiPro",
|
2024-04-07 12:32:57 +09:00
|
|
|
Claude = "Claude",
|
2024-07-06 14:05:09 +09:00
|
|
|
Ernie = "Ernie",
|
2023-11-10 03:43:30 +09:00
|
|
|
}
|
|
|
|
|
2024-04-07 12:32:57 +09:00
|
|
|
export const Anthropic = {
|
|
|
|
ChatPath: "v1/messages",
|
|
|
|
ChatPath1: "v1/complete",
|
|
|
|
ExampleEndpoint: "https://api.anthropic.com",
|
|
|
|
Vision: "2023-06-01",
|
|
|
|
};
|
|
|
|
|
2023-06-13 01:39:29 +09:00
|
|
|
export const OpenaiPath = {
|
|
|
|
ChatPath: "v1/chat/completions",
|
|
|
|
UsagePath: "dashboard/billing/usage",
|
|
|
|
SubsPath: "dashboard/billing/subscription",
|
2023-07-05 00:16:24 +09:00
|
|
|
ListModelPath: "v1/models",
|
2023-06-13 01:39:29 +09:00
|
|
|
};
|
2023-06-24 01:07:46 +09:00
|
|
|
|
2023-11-10 03:43:30 +09:00
|
|
|
export const Azure = {
|
2024-07-05 20:59:45 +09:00
|
|
|
ChatPath: (deployName: string, apiVersion: string) =>
|
|
|
|
`deployments/${deployName}/chat/completions?api-version=${apiVersion}`,
|
2023-11-10 03:43:30 +09:00
|
|
|
ExampleEndpoint: "https://{resource-url}/openai/deployments/{deploy-id}",
|
|
|
|
};
|
|
|
|
|
2023-12-24 03:15:30 +09:00
|
|
|
export const Google = {
|
2023-12-31 19:02:04 +09:00
|
|
|
ExampleEndpoint: "https://generativelanguage.googleapis.com/",
|
2024-03-28 16:51:06 +09:00
|
|
|
ChatPath: (modelName: string) => `v1beta/models/${modelName}:generateContent`,
|
2023-12-24 03:15:30 +09:00
|
|
|
};
|
|
|
|
|
2024-07-06 14:05:09 +09:00
|
|
|
export const Baidu = {
|
2024-07-09 13:27:44 +09:00
|
|
|
ExampleEndpoint: BAIDU_BASE_URL,
|
|
|
|
ChatPath: (modelName: string) => {
|
|
|
|
let endpoint = modelName;
|
|
|
|
if (modelName === "ernie-4.0-8k") {
|
|
|
|
endpoint = "completions_pro";
|
|
|
|
}
|
|
|
|
if (modelName === "ernie-4.0-8k-preview-0518") {
|
|
|
|
endpoint = "completions_adv_pro";
|
|
|
|
}
|
|
|
|
if (modelName === "ernie-3.5-8k") {
|
|
|
|
endpoint = "completions";
|
|
|
|
}
|
|
|
|
return `/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/${endpoint}`;
|
|
|
|
},
|
2024-07-06 14:05:09 +09:00
|
|
|
};
|
|
|
|
|
2023-06-24 17:50:05 +09:00
|
|
|
export const DEFAULT_INPUT_TEMPLATE = `{{input}}`; // input / time / model / lang
|
2024-04-08 20:27:22 +09:00
|
|
|
// export const DEFAULT_SYSTEM_TEMPLATE = `
|
|
|
|
// You are ChatGPT, a large language model trained by {{ServiceProvider}}.
|
|
|
|
// Knowledge cutoff: {{cutoff}}
|
|
|
|
// Current model: {{model}}
|
|
|
|
// Current time: {{time}}
|
|
|
|
// Latex inline: $x^2$
|
|
|
|
// Latex block: $$e=mc^2$$
|
|
|
|
// `;
|
2023-06-26 14:18:59 +09:00
|
|
|
export const DEFAULT_SYSTEM_TEMPLATE = `
|
2024-02-05 14:35:51 +09:00
|
|
|
You are ChatGPT, a large language model trained by {{ServiceProvider}}.
|
2023-11-08 00:54:30 +09:00
|
|
|
Knowledge cutoff: {{cutoff}}
|
2023-06-26 14:18:59 +09:00
|
|
|
Current model: {{model}}
|
2023-11-07 08:42:55 +09:00
|
|
|
Current time: {{time}}
|
2024-04-09 11:45:09 +09:00
|
|
|
Latex inline: \\(x^2\\)
|
2023-11-12 20:33:19 +09:00
|
|
|
Latex block: $$e=mc^2$$
|
2023-11-07 08:42:55 +09:00
|
|
|
`;
|
2023-07-05 00:16:24 +09:00
|
|
|
|
2023-08-28 01:02:52 +09:00
|
|
|
export const SUMMARIZE_MODEL = "gpt-3.5-turbo";
|
2024-02-20 19:04:32 +09:00
|
|
|
export const GEMINI_SUMMARIZE_MODEL = "gemini-pro";
|
2023-08-28 01:02:52 +09:00
|
|
|
|
2023-11-08 00:54:30 +09:00
|
|
|
export const KnowledgeCutOffDate: Record<string, string> = {
|
|
|
|
default: "2021-09",
|
2024-04-10 18:18:39 +09:00
|
|
|
"gpt-4-turbo": "2023-12",
|
2024-04-12 23:44:26 +09:00
|
|
|
"gpt-4-turbo-2024-04-09": "2023-12",
|
2024-02-27 11:28:54 +09:00
|
|
|
"gpt-4-turbo-preview": "2023-12",
|
2024-05-14 06:28:13 +09:00
|
|
|
"gpt-4o": "2023-10",
|
|
|
|
"gpt-4o-2024-05-13": "2023-10",
|
2023-11-08 00:54:30 +09:00
|
|
|
"gpt-4-vision-preview": "2023-04",
|
2024-02-07 14:17:11 +09:00
|
|
|
// After improvements,
|
2024-02-05 15:44:46 +09:00
|
|
|
// it's now easier to add "KnowledgeCutOffDate" instead of stupid hardcoding it, as was done previously.
|
|
|
|
"gemini-pro": "2023-12",
|
2024-03-28 16:51:06 +09:00
|
|
|
"gemini-pro-vision": "2023-12",
|
2023-11-08 00:54:30 +09:00
|
|
|
};
|
|
|
|
|
2024-04-15 19:14:14 +09:00
|
|
|
const openaiModels = [
|
|
|
|
"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",
|
2024-05-14 06:28:13 +09:00
|
|
|
"gpt-4o",
|
|
|
|
"gpt-4o-2024-05-13",
|
2024-04-15 19:14:14 +09:00
|
|
|
"gpt-4-vision-preview",
|
2024-06-07 04:28:00 +09:00
|
|
|
"gpt-4-turbo-2024-04-09",
|
2024-07-06 00:56:10 +09:00
|
|
|
"gpt-4-1106-preview",
|
2024-04-15 19:14:14 +09:00
|
|
|
];
|
|
|
|
|
|
|
|
const googleModels = [
|
|
|
|
"gemini-1.0-pro",
|
|
|
|
"gemini-1.5-pro-latest",
|
2024-05-15 16:29:38 +09:00
|
|
|
"gemini-1.5-flash-latest",
|
2024-04-15 19:14:14 +09:00
|
|
|
"gemini-pro-vision",
|
|
|
|
];
|
|
|
|
|
|
|
|
const anthropicModels = [
|
|
|
|
"claude-instant-1.2",
|
|
|
|
"claude-2.0",
|
|
|
|
"claude-2.1",
|
|
|
|
"claude-3-sonnet-20240229",
|
|
|
|
"claude-3-opus-20240229",
|
|
|
|
"claude-3-haiku-20240307",
|
2024-06-21 19:05:28 +09:00
|
|
|
"claude-3-5-sonnet-20240620",
|
2024-04-15 19:14:14 +09:00
|
|
|
];
|
|
|
|
|
2024-07-06 14:05:09 +09:00
|
|
|
const baiduModels = [
|
|
|
|
"ernie-4.0-turbo-8k",
|
2024-07-09 13:27:44 +09:00
|
|
|
"ernie-4.0-8k",
|
2024-07-06 14:05:09 +09:00
|
|
|
"ernie-4.0-8k-preview",
|
2024-07-09 13:27:44 +09:00
|
|
|
"ernie-4.0-8k-preview-0518",
|
2024-07-06 14:05:09 +09:00
|
|
|
"ernie-4.0-8k-latest",
|
2024-07-09 13:27:44 +09:00
|
|
|
"ernie-3.5-8k",
|
2024-07-06 14:05:09 +09:00
|
|
|
"ernie-3.5-8k-0205",
|
|
|
|
];
|
|
|
|
|
2023-07-05 00:16:24 +09:00
|
|
|
export const DEFAULT_MODELS = [
|
2024-04-15 19:14:14 +09:00
|
|
|
...openaiModels.map((name) => ({
|
|
|
|
name,
|
2024-01-26 16:00:02 +09:00
|
|
|
available: true,
|
|
|
|
provider: {
|
|
|
|
id: "openai",
|
|
|
|
providerName: "OpenAI",
|
|
|
|
providerType: "openai",
|
|
|
|
},
|
2024-04-15 19:14:14 +09:00
|
|
|
})),
|
2024-07-05 20:59:45 +09:00
|
|
|
...openaiModels.map((name) => ({
|
|
|
|
name,
|
|
|
|
available: true,
|
|
|
|
provider: {
|
|
|
|
id: "azure",
|
|
|
|
providerName: "Azure",
|
|
|
|
providerType: "azure",
|
|
|
|
},
|
|
|
|
})),
|
2024-04-15 19:14:14 +09:00
|
|
|
...googleModels.map((name) => ({
|
|
|
|
name,
|
2023-12-24 03:15:30 +09:00
|
|
|
available: true,
|
|
|
|
provider: {
|
|
|
|
id: "google",
|
|
|
|
providerName: "Google",
|
|
|
|
providerType: "google",
|
|
|
|
},
|
2024-04-15 19:14:14 +09:00
|
|
|
})),
|
|
|
|
...anthropicModels.map((name) => ({
|
|
|
|
name,
|
2024-02-20 19:04:32 +09:00
|
|
|
available: true,
|
|
|
|
provider: {
|
2024-04-07 12:32:57 +09:00
|
|
|
id: "anthropic",
|
|
|
|
providerName: "Anthropic",
|
|
|
|
providerType: "anthropic",
|
2024-02-20 19:04:32 +09:00
|
|
|
},
|
2024-04-15 19:14:14 +09:00
|
|
|
})),
|
2024-07-06 14:05:09 +09:00
|
|
|
...baiduModels.map((name) => ({
|
|
|
|
name,
|
|
|
|
available: true,
|
|
|
|
provider: {
|
|
|
|
id: "baidu",
|
|
|
|
providerName: "Baidu",
|
|
|
|
providerType: "baidu",
|
|
|
|
},
|
|
|
|
})),
|
2023-07-05 00:16:24 +09:00
|
|
|
] as const;
|
2023-08-04 03:16:44 +09:00
|
|
|
|
2023-08-04 20:24:10 +09:00
|
|
|
export const CHAT_PAGE_SIZE = 15;
|
|
|
|
export const MAX_RENDER_MSG_COUNT = 45;
|
2024-04-09 19:05:56 +09:00
|
|
|
|
2024-04-09 21:49:51 +09:00
|
|
|
// some famous webdav endpoints
|
2024-05-06 20:26:39 +09:00
|
|
|
export const internalAllowedWebDavEndpoints = [
|
2024-04-09 21:49:51 +09:00
|
|
|
"https://dav.jianguoyun.com/dav/",
|
|
|
|
"https://dav.dropdav.com/",
|
|
|
|
"https://dav.box.com/dav",
|
|
|
|
"https://nanao.teracloud.jp/dav/",
|
2024-06-07 04:28:00 +09:00
|
|
|
"https://bora.teracloud.jp/dav/",
|
2024-04-09 21:49:51 +09:00
|
|
|
"https://webdav.4shared.com/",
|
|
|
|
"https://dav.idrivesync.com",
|
|
|
|
"https://webdav.yandex.com",
|
|
|
|
"https://app.koofr.net/dav/Koofr",
|
|
|
|
];
|