| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368 |
- export const OWNER = "ChatClientWeb";
- export const REPO = "chat-client-web";
- export const REPO_URL = `https://github.com/${OWNER}/${REPO}`;
- export const ISSUE_URL = `https://github.com/${OWNER}/${REPO}/issues`;
- export const UPDATE_URL = `${REPO_URL}#keep-updated`;
- export const RELEASE_URL = `${REPO_URL}/releases`;
- export const FETCH_COMMIT_URL = `https://api.github.com/repos/${OWNER}/${REPO}/commits?per_page=1`;
- export const FETCH_TAG_URL = `https://api.github.com/repos/${OWNER}/${REPO}/tags?per_page=1`;
- export const RUNTIME_CONFIG_DOM = "danger-runtime-config";
- export const STABILITY_BASE_URL = "https://api.stability.ai";
- export const DEFAULT_API_HOST = "https://api.nextchat.dev";
- export const OPENAI_BASE_URL = "https://api.openai.com";
- export const BAIDU_BASE_URL = "https://aip.baidubce.com";
- export const BAIDU_OATUH_URL = `${BAIDU_BASE_URL}/oauth/2.0/token`;
- export const BYTEDANCE_BASE_URL = "https://ark.cn-beijing.volces.com";
- export const ALIBABA_BASE_URL = "https://dashscope.aliyuncs.com/api/";
- export const TENCENT_BASE_URL = "https://hunyuan.tencentcloudapi.com";
- export const IFLYTEK_BASE_URL = "https://spark-api-open.xf-yun.com";
- export const CACHE_URL_PREFIX = "/api/cache";
- export const UPLOAD_URL = `${CACHE_URL_PREFIX}/upload`;
- export enum Path {
- Home = "/",
- Chat = "/chat",
- Settings = "/settings",
- MaskChat = "/mask-chat",
- Masks = "/masks",
- Auth = "/auth",
- Artifacts = "/artifacts",
- }
- export enum ApiPath {
- Cors = "",
- Azure = "/api/azure",
- OpenAI = "/api/openai",
- Baidu = "/api/baidu",
- ByteDance = "/api/bytedance",
- Alibaba = "/api/alibaba",
- Tencent = "/api/tencent",
- Iflytek = "/api/iflytek",
- Artifacts = "/api/artifacts",
- BigModel = "/api/bigModel",
- }
- export enum SlotID {
- AppBody = "app-body",
- CustomModel = "custom-model",
- }
- export enum FileName {
- Masks = "masks.json",
- Prompts = "prompts.json",
- }
- export enum Plugin {
- Artifacts = "artifacts",
- }
- export enum Plugin {
- BigModel = "bigModel",
- }
- export enum StoreKey {
- Chat = "chat-client-web-store",
- Access = "access-control",
- Config = "app-config",
- Mask = "mask-store",
- Prompt = "prompt-store",
- Update = "chat-update",
- Sync = "sync",
- }
- export const DEFAULT_SIDEBAR_WIDTH = 300;
- export const MAX_SIDEBAR_WIDTH = 500;
- export const MIN_SIDEBAR_WIDTH = 200;
- export const NARROW_SIDEBAR_WIDTH = 200;
- export const ACCESS_CODE_PREFIX = "nk-";
- export const LAST_INPUT_KEY = "last-input";
- export const UNFINISHED_INPUT = (id: string) => "unfinished-input-" + id;
- export const STORAGE_KEY = "chat-client-web";
- export const REQUEST_TIMEOUT_MS = 60000;
- export const EXPORT_MESSAGE_CLASS_NAME = "export-markdown";
- export enum ServiceProvider {
- BigModel = "BigModel",
- DeepSeek = "DeepSeek",
- OpenAI = "OpenAI",
- Azure = "Azure",
- Baidu = "Baidu",
- ByteDance = "ByteDance",
- Alibaba = "Alibaba",
- Tencent = "Tencent",
- Iflytek = "Iflytek",
- }
- export enum ModelProvider {
- BigModel = "bigModel",
- DeepSeek = "deepSeek",
- GPT = "GPT",
- Ernie = "Ernie",
- Doubao = "Doubao",
- Qwen = "Qwen",
- Hunyuan = "Hunyuan",
- Iflytek = "Iflytek",
- }
- export const OpenaiPath = {
- ChatPath: "v1/chat/completions",
- ImagePath: "v1/images/generations",
- UsagePath: "dashboard/billing/usage",
- SubsPath: "dashboard/billing/subscription",
- ListModelPath: "v1/models",
- };
- export const Azure = {
- ChatPath: (deployName: string, apiVersion: string) =>
- `deployments/${deployName}/chat/completions?api-version=${apiVersion}`,
- // https://<your_resource_name>.openai.azure.com/openai/deployments/<your_deployment_name>/images/generations?api-version=<api_version>
- ImagePath: (deployName: string, apiVersion: string) =>
- `deployments/${deployName}/images/generations?api-version=${apiVersion}`,
- ExampleEndpoint: "https://{resource-url}/openai",
- };
- export const Baidu = {
- 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";
- }
- if (modelName === "ernie-speed-8k") {
- endpoint = "ernie_speed";
- }
- return `rpc/2.0/ai_custom/v1/wenxinworkshop/chat/${endpoint}`;
- },
- };
- export const ByteDance = {
- ExampleEndpoint: "https://ark.cn-beijing.volces.com/api/",
- ChatPath: "api/v3/chat/completions",
- };
- export const Alibaba = {
- ExampleEndpoint: ALIBABA_BASE_URL,
- ChatPath: "v1/services/aigc/text-generation/generation",
- };
- export const Tencent = {
- ExampleEndpoint: TENCENT_BASE_URL,
- };
- export const Iflytek = {
- ExampleEndpoint: IFLYTEK_BASE_URL,
- ChatPath: "v1/chat/completions",
- };
- export const DEFAULT_INPUT_TEMPLATE = `{{input}}`; // input / time / model / lang
- // 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$$
- // `;
- export const DEFAULT_SYSTEM_TEMPLATE: any = null;
- // `
- // 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$$
- // `;
- export const SUMMARIZE_MODEL = "gpt-4o-mini";
- export const KnowledgeCutOffDate: Record<string, string> = {
- default: "2021-09",
- "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-mini": "2023-10",
- "gpt-4o-mini-2024-07-18": "2023-10",
- "gpt-4-vision-preview": "2023-04",
- // After improvements,
- // it's now easier to add "KnowledgeCutOffDate" instead of stupid hardcoding it, as was done previously.
- };
- 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",
- "gpt-4o",
- "gpt-4o-2024-05-13",
- "gpt-4o-2024-08-06",
- "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",
- ];
- const baiduModels = [
- "ernie-4.0-turbo-8k",
- "ernie-4.0-8k",
- "ernie-4.0-8k-preview",
- "ernie-4.0-8k-preview-0518",
- "ernie-4.0-8k-latest",
- "ernie-3.5-8k",
- "ernie-3.5-8k-0205",
- "ernie-speed-128k",
- "ernie-speed-8k",
- "ernie-lite-8k",
- "ernie-tiny-8k",
- ];
- const bytedanceModels = [
- "Doubao-lite-4k",
- "Doubao-lite-32k",
- "Doubao-lite-128k",
- "Doubao-pro-4k",
- "Doubao-pro-32k",
- "Doubao-pro-128k",
- ];
- const alibabaModes = [
- "qwen-turbo",
- "qwen-plus",
- "qwen-max",
- "qwen-max-longcontext",
- "qwen-vl-plus",
- "qwen-vl-max",
- ];
- const tencentModels = [
- "hunyuan-pro",
- "hunyuan-standard",
- "hunyuan-lite",
- "hunyuan-role",
- "hunyuan-functioncall",
- "hunyuan-code",
- "hunyuan-vision",
- ];
- const iflytekModels = [
- "general",
- "generalv3",
- "pro-128k",
- "generalv3.5",
- "4.0Ultra",
- ];
- let seq = 1000; // 内置的模型序号生成器从1000开始
- export const DEFAULT_MODELS = [
- ...openaiModels.map((name) => ({
- name,
- available: true,
- sorted: seq++, // Global sequence sort(index)
- provider: {
- id: "openai",
- providerName: "OpenAI",
- providerType: "openai",
- sorted: 1, // 这里是固定的,确保顺序与之前内置的版本一致
- },
- })),
- ...openaiModels.map((name) => ({
- name,
- available: true,
- sorted: seq++,
- provider: {
- id: "azure",
- providerName: "Azure",
- providerType: "azure",
- sorted: 2,
- },
- })),
- ...baiduModels.map((name) => ({
- name,
- available: true,
- sorted: seq++,
- provider: {
- id: "baidu",
- providerName: "Baidu",
- providerType: "baidu",
- sorted: 5,
- },
- })),
- ...bytedanceModels.map((name) => ({
- name,
- available: true,
- sorted: seq++,
- provider: {
- id: "bytedance",
- providerName: "ByteDance",
- providerType: "bytedance",
- sorted: 6,
- },
- })),
- ...alibabaModes.map((name) => ({
- name,
- available: true,
- sorted: seq++,
- provider: {
- id: "alibaba",
- providerName: "Alibaba",
- providerType: "alibaba",
- sorted: 7,
- },
- })),
- ...tencentModels.map((name) => ({
- name,
- available: true,
- sorted: seq++,
- provider: {
- id: "tencent",
- providerName: "Tencent",
- providerType: "tencent",
- sorted: 8,
- },
- })),
- ...iflytekModels.map((name) => ({
- name,
- available: true,
- sorted: seq++,
- provider: {
- id: "iflytek",
- providerName: "Iflytek",
- providerType: "iflytek",
- sorted: 10,
- },
- })),
- ] as const;
- export const CHAT_PAGE_SIZE = 15;
- export const MAX_RENDER_MSG_COUNT = 45;
- // some famous webdav endpoints
- export const internalAllowedWebDavEndpoints = [
- "https://dav.jianguoyun.com/dav/",
- "https://dav.dropdav.com/",
- "https://dav.box.com/dav",
- "https://nanao.teracloud.jp/dav/",
- "https://bora.teracloud.jp/dav/",
- "https://webdav.4shared.com/",
- "https://dav.idrivesync.com",
- "https://webdav.yandex.com",
- "https://app.koofr.net/dav/Koofr",
- ];
|