constant.ts 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863
  1. export const OWNER = "ChatGPTNextWeb";
  2. export const REPO = "ChatGPT-Next-Web";
  3. export const REPO_URL = `https://github.com/${OWNER}/${REPO}`;
  4. export const PLUGINS_REPO_URL = `https://github.com/${OWNER}/NextChat-Awesome-Plugins`;
  5. export const ISSUE_URL = `https://github.com/${OWNER}/${REPO}/issues`;
  6. export const UPDATE_URL = `${REPO_URL}#keep-updated`;
  7. export const RELEASE_URL = `${REPO_URL}/releases`;
  8. export const FETCH_COMMIT_URL = `https://api.github.com/repos/${OWNER}/${REPO}/commits?per_page=1`;
  9. export const FETCH_TAG_URL = `https://api.github.com/repos/${OWNER}/${REPO}/tags?per_page=1`;
  10. export const RUNTIME_CONFIG_DOM = "danger-runtime-config";
  11. export const STABILITY_BASE_URL = "https://api.stability.ai";
  12. export const OPENAI_BASE_URL = "https://api.openai.com";
  13. export const ANTHROPIC_BASE_URL = "https://api.anthropic.com";
  14. export const GEMINI_BASE_URL = "https://generativelanguage.googleapis.com/";
  15. export const BAIDU_BASE_URL = "https://aip.baidubce.com";
  16. export const BAIDU_OATUH_URL = `${BAIDU_BASE_URL}/oauth/2.0/token`;
  17. export const BYTEDANCE_BASE_URL = "https://ark.cn-beijing.volces.com";
  18. export const ALIBABA_BASE_URL = "https://dashscope.aliyuncs.com/api/";
  19. export const TENCENT_BASE_URL = "https://hunyuan.tencentcloudapi.com";
  20. export const MOONSHOT_BASE_URL = "https://api.moonshot.cn";
  21. export const IFLYTEK_BASE_URL = "https://spark-api-open.xf-yun.com";
  22. export const DEEPSEEK_BASE_URL = "https://api.deepseek.com";
  23. export const XAI_BASE_URL = "https://api.x.ai";
  24. export const CHATGLM_BASE_URL = "https://open.bigmodel.cn";
  25. export const SILICONFLOW_BASE_URL = "https://api.siliconflow.cn";
  26. export const CACHE_URL_PREFIX = "/api/cache";
  27. export const UPLOAD_URL = `${CACHE_URL_PREFIX}/upload`;
  28. export enum Path {
  29. Home = "/",
  30. Chat = "/chat",
  31. Settings = "/settings",
  32. NewChat = "/new-chat",
  33. Masks = "/masks",
  34. Plugins = "/plugins",
  35. Auth = "/auth",
  36. Sd = "/sd",
  37. SdNew = "/sd-new",
  38. Artifacts = "/artifacts",
  39. SearchChat = "/search-chat",
  40. McpMarket = "/mcp-market",
  41. }
  42. export enum ApiPath {
  43. Cors = "",
  44. Azure = "/api/azure",
  45. OpenAI = "/api/openai",
  46. Anthropic = "/api/anthropic",
  47. Google = "/api/google",
  48. Baidu = "/api/baidu",
  49. ByteDance = "/api/bytedance",
  50. Alibaba = "/api/alibaba",
  51. Tencent = "/api/tencent",
  52. Moonshot = "/api/moonshot",
  53. Iflytek = "/api/iflytek",
  54. Stability = "/api/stability",
  55. Artifacts = "/api/artifacts",
  56. XAI = "/api/xai",
  57. ChatGLM = "/api/chatglm",
  58. DeepSeek = "/api/deepseek",
  59. SiliconFlow = "/api/siliconflow",
  60. }
  61. export enum SlotID {
  62. AppBody = "app-body",
  63. CustomModel = "custom-model",
  64. }
  65. export enum FileName {
  66. Masks = "masks.json",
  67. Prompts = "prompts.json",
  68. }
  69. export enum StoreKey {
  70. Chat = "chat-next-web-store",
  71. Plugin = "chat-next-web-plugin",
  72. Access = "access-control",
  73. Config = "app-config",
  74. Mask = "mask-store",
  75. Prompt = "prompt-store",
  76. Update = "chat-update",
  77. Sync = "sync",
  78. SdList = "sd-list",
  79. Mcp = "mcp-store",
  80. }
  81. export const DEFAULT_SIDEBAR_WIDTH = 300;
  82. export const MAX_SIDEBAR_WIDTH = 500;
  83. export const MIN_SIDEBAR_WIDTH = 230;
  84. export const NARROW_SIDEBAR_WIDTH = 100;
  85. export const ACCESS_CODE_PREFIX = "nk-";
  86. export const LAST_INPUT_KEY = "last-input";
  87. export const UNFINISHED_INPUT = (id: string) => "unfinished-input-" + id;
  88. export const STORAGE_KEY = "chatgpt-next-web";
  89. export const REQUEST_TIMEOUT_MS = 60000;
  90. export const REQUEST_TIMEOUT_MS_FOR_THINKING = REQUEST_TIMEOUT_MS * 5;
  91. export const EXPORT_MESSAGE_CLASS_NAME = "export-markdown";
  92. export enum ServiceProvider {
  93. OpenAI = "OpenAI",
  94. Azure = "Azure",
  95. Google = "Google",
  96. Anthropic = "Anthropic",
  97. Baidu = "Baidu",
  98. ByteDance = "ByteDance",
  99. Alibaba = "Alibaba",
  100. Tencent = "Tencent",
  101. Moonshot = "Moonshot",
  102. Stability = "Stability",
  103. Iflytek = "Iflytek",
  104. XAI = "XAI",
  105. ChatGLM = "ChatGLM",
  106. DeepSeek = "DeepSeek",
  107. SiliconFlow = "SiliconFlow",
  108. }
  109. // Google API safety settings, see https://ai.google.dev/gemini-api/docs/safety-settings
  110. // BLOCK_NONE will not block any content, and BLOCK_ONLY_HIGH will block only high-risk content.
  111. export enum GoogleSafetySettingsThreshold {
  112. BLOCK_NONE = "BLOCK_NONE",
  113. BLOCK_ONLY_HIGH = "BLOCK_ONLY_HIGH",
  114. BLOCK_MEDIUM_AND_ABOVE = "BLOCK_MEDIUM_AND_ABOVE",
  115. BLOCK_LOW_AND_ABOVE = "BLOCK_LOW_AND_ABOVE",
  116. }
  117. export enum ModelProvider {
  118. Stability = "Stability",
  119. GPT = "GPT",
  120. GeminiPro = "GeminiPro",
  121. Claude = "Claude",
  122. Ernie = "Ernie",
  123. Doubao = "Doubao",
  124. Qwen = "Qwen",
  125. Hunyuan = "Hunyuan",
  126. Moonshot = "Moonshot",
  127. Iflytek = "Iflytek",
  128. XAI = "XAI",
  129. ChatGLM = "ChatGLM",
  130. DeepSeek = "DeepSeek",
  131. SiliconFlow = "SiliconFlow",
  132. }
  133. export const Stability = {
  134. GeneratePath: "v2beta/stable-image/generate",
  135. ExampleEndpoint: "https://api.stability.ai",
  136. };
  137. export const Anthropic = {
  138. ChatPath: "v1/messages",
  139. ChatPath1: "v1/complete",
  140. ExampleEndpoint: "https://api.anthropic.com",
  141. Vision: "2023-06-01",
  142. };
  143. export const OpenaiPath = {
  144. ChatPath: "v1/chat/completions",
  145. SpeechPath: "v1/audio/speech",
  146. ImagePath: "v1/images/generations",
  147. UsagePath: "dashboard/billing/usage",
  148. SubsPath: "dashboard/billing/subscription",
  149. ListModelPath: "v1/models",
  150. };
  151. export const Azure = {
  152. ChatPath: (deployName: string, apiVersion: string) =>
  153. `deployments/${deployName}/chat/completions?api-version=${apiVersion}`,
  154. // https://<your_resource_name>.openai.azure.com/openai/deployments/<your_deployment_name>/images/generations?api-version=<api_version>
  155. ImagePath: (deployName: string, apiVersion: string) =>
  156. `deployments/${deployName}/images/generations?api-version=${apiVersion}`,
  157. ExampleEndpoint: "https://{resource-url}/openai",
  158. };
  159. export const Google = {
  160. ExampleEndpoint: "https://generativelanguage.googleapis.com/",
  161. ChatPath: (modelName: string) =>
  162. `v1beta/models/${modelName}:streamGenerateContent`,
  163. };
  164. export const Baidu = {
  165. ExampleEndpoint: BAIDU_BASE_URL,
  166. ChatPath: (modelName: string) => {
  167. let endpoint = modelName;
  168. if (modelName === "ernie-4.0-8k") {
  169. endpoint = "completions_pro";
  170. }
  171. if (modelName === "ernie-4.0-8k-preview-0518") {
  172. endpoint = "completions_adv_pro";
  173. }
  174. if (modelName === "ernie-3.5-8k") {
  175. endpoint = "completions";
  176. }
  177. if (modelName === "ernie-speed-8k") {
  178. endpoint = "ernie_speed";
  179. }
  180. return `rpc/2.0/ai_custom/v1/wenxinworkshop/chat/${endpoint}`;
  181. },
  182. };
  183. export const ByteDance = {
  184. ExampleEndpoint: "https://ark.cn-beijing.volces.com/api/",
  185. ChatPath: "api/v3/chat/completions",
  186. };
  187. export const Alibaba = {
  188. ExampleEndpoint: ALIBABA_BASE_URL,
  189. ChatPath: (modelName: string) => {
  190. if (modelName.includes("vl") || modelName.includes("omni")) {
  191. return "v1/services/aigc/multimodal-generation/generation";
  192. }
  193. return `v1/services/aigc/text-generation/generation`;
  194. },
  195. };
  196. export const Tencent = {
  197. ExampleEndpoint: TENCENT_BASE_URL,
  198. };
  199. export const Moonshot = {
  200. ExampleEndpoint: MOONSHOT_BASE_URL,
  201. ChatPath: "v1/chat/completions",
  202. };
  203. export const Iflytek = {
  204. ExampleEndpoint: IFLYTEK_BASE_URL,
  205. ChatPath: "v1/chat/completions",
  206. };
  207. export const DeepSeek = {
  208. ExampleEndpoint: DEEPSEEK_BASE_URL,
  209. ChatPath: "chat/completions",
  210. };
  211. export const XAI = {
  212. ExampleEndpoint: XAI_BASE_URL,
  213. ChatPath: "v1/chat/completions",
  214. };
  215. export const ChatGLM = {
  216. ExampleEndpoint: CHATGLM_BASE_URL,
  217. ChatPath: "api/paas/v4/chat/completions",
  218. ImagePath: "api/paas/v4/images/generations",
  219. VideoPath: "api/paas/v4/videos/generations",
  220. };
  221. export const SiliconFlow = {
  222. ExampleEndpoint: SILICONFLOW_BASE_URL,
  223. ChatPath: "v1/chat/completions",
  224. ListModelPath: "v1/models?&sub_type=chat",
  225. };
  226. export const DEFAULT_INPUT_TEMPLATE = `{{input}}`; // input / time / model / lang
  227. // export const DEFAULT_SYSTEM_TEMPLATE = `
  228. // You are ChatGPT, a large language model trained by {{ServiceProvider}}.
  229. // Knowledge cutoff: {{cutoff}}
  230. // Current model: {{model}}
  231. // Current time: {{time}}
  232. // Latex inline: $x^2$
  233. // Latex block: $$e=mc^2$$
  234. // `;
  235. export const DEFAULT_SYSTEM_TEMPLATE = `
  236. You are ChatGPT, a large language model trained by {{ServiceProvider}}.
  237. Knowledge cutoff: {{cutoff}}
  238. Current model: {{model}}
  239. Current time: {{time}}
  240. Latex inline: \\(x^2\\)
  241. Latex block: $$e=mc^2$$
  242. `;
  243. export const MCP_TOOLS_TEMPLATE = `
  244. [clientId]
  245. {{ clientId }}
  246. [tools]
  247. {{ tools }}
  248. `;
  249. export const MCP_SYSTEM_TEMPLATE = `
  250. You are an AI assistant with access to system tools. Your role is to help users by combining natural language understanding with tool operations when needed.
  251. 1. AVAILABLE TOOLS:
  252. {{ MCP_TOOLS }}
  253. 2. WHEN TO USE TOOLS:
  254. - ALWAYS USE TOOLS when they can help answer user questions
  255. - DO NOT just describe what you could do - TAKE ACTION immediately
  256. - If you're not sure whether to use a tool, USE IT
  257. - Common triggers for tool use:
  258. * Questions about files or directories
  259. * Requests to check, list, or manipulate system resources
  260. * Any query that can be answered with available tools
  261. 3. HOW TO USE TOOLS:
  262. A. Tool Call Format:
  263. - Use markdown code blocks with format: \`\`\`json:mcp:{clientId}\`\`\`
  264. - Always include:
  265. * method: "tools/call"(Only this method is supported)
  266. * params:
  267. - name: must match an available primitive name
  268. - arguments: required parameters for the primitive
  269. B. Response Format:
  270. - Tool responses will come as user messages
  271. - Format: \`\`\`json:mcp-response:{clientId}\`\`\`
  272. - Wait for response before making another tool call
  273. C. Important Rules:
  274. - Only use tools/call method
  275. - Only ONE tool call per message
  276. - ALWAYS TAKE ACTION instead of just describing what you could do
  277. - Include the correct clientId in code block language tag
  278. - Verify arguments match the primitive's requirements
  279. 4. INTERACTION FLOW:
  280. A. When user makes a request:
  281. - IMMEDIATELY use appropriate tool if available
  282. - DO NOT ask if user wants you to use the tool
  283. - DO NOT just describe what you could do
  284. B. After receiving tool response:
  285. - Explain results clearly
  286. - Take next appropriate action if needed
  287. C. If tools fail:
  288. - Explain the error
  289. - Try alternative approach immediately
  290. 5. EXAMPLE INTERACTION:
  291. good example:
  292. \`\`\`json:mcp:filesystem
  293. {
  294. "method": "tools/call",
  295. "params": {
  296. "name": "list_allowed_directories",
  297. "arguments": {}
  298. }
  299. }
  300. \`\`\`"
  301. \`\`\`json:mcp-response:filesystem
  302. {
  303. "method": "tools/call",
  304. "params": {
  305. "name": "write_file",
  306. "arguments": {
  307. "path": "/Users/river/dev/nextchat/test/joke.txt",
  308. "content": "为什么数学书总是感到忧伤?因为它有太多的问题。"
  309. }
  310. }
  311. }
  312. \`\`\`
  313. follwing is the wrong! mcp json example:
  314. \`\`\`json:mcp:filesystem
  315. {
  316. "method": "write_file",
  317. "params": {
  318. "path": "NextChat_Information.txt",
  319. "content": "1"
  320. }
  321. }
  322. \`\`\`
  323. This is wrong because the method is not tools/call.
  324. \`\`\`{
  325. "method": "search_repositories",
  326. "params": {
  327. "query": "2oeee"
  328. }
  329. }
  330. \`\`\`
  331. This is wrong because the method is not tools/call.!!!!!!!!!!!
  332. the right format is:
  333. \`\`\`json:mcp:filesystem
  334. {
  335. "method": "tools/call",
  336. "params": {
  337. "name": "search_repositories",
  338. "arguments": {
  339. "query": "2oeee"
  340. }
  341. }
  342. }
  343. \`\`\`
  344. please follow the format strictly ONLY use tools/call method!!!!!!!!!!!
  345. `;
  346. export const SUMMARIZE_MODEL = "gpt-4o-mini";
  347. export const GEMINI_SUMMARIZE_MODEL = "gemini-pro";
  348. export const DEEPSEEK_SUMMARIZE_MODEL = "deepseek-chat";
  349. export const KnowledgeCutOffDate: Record<string, string> = {
  350. default: "2021-09",
  351. "gpt-4-turbo": "2023-12",
  352. "gpt-4-turbo-2024-04-09": "2023-12",
  353. "gpt-4-turbo-preview": "2023-12",
  354. "gpt-4.1": "2024-06",
  355. "gpt-4.1-2025-04-14": "2024-06",
  356. "gpt-4.1-mini": "2024-06",
  357. "gpt-4.1-mini-2025-04-14": "2024-06",
  358. "gpt-4.1-nano": "2024-06",
  359. "gpt-4.1-nano-2025-04-14": "2024-06",
  360. "gpt-4.5-preview": "2023-10",
  361. "gpt-4.5-preview-2025-02-27": "2023-10",
  362. "gpt-4o": "2023-10",
  363. "gpt-4o-2024-05-13": "2023-10",
  364. "gpt-4o-2024-08-06": "2023-10",
  365. "gpt-4o-2024-11-20": "2023-10",
  366. "chatgpt-4o-latest": "2023-10",
  367. "gpt-4o-mini": "2023-10",
  368. "gpt-4o-mini-2024-07-18": "2023-10",
  369. "gpt-4-vision-preview": "2023-04",
  370. "o1-mini-2024-09-12": "2023-10",
  371. "o1-mini": "2023-10",
  372. "o1-preview-2024-09-12": "2023-10",
  373. "o1-preview": "2023-10",
  374. "o1-2024-12-17": "2023-10",
  375. o1: "2023-10",
  376. "o3-mini-2025-01-31": "2023-10",
  377. "o3-mini": "2023-10",
  378. // After improvements,
  379. // it's now easier to add "KnowledgeCutOffDate" instead of stupid hardcoding it, as was done previously.
  380. "gemini-pro": "2023-12",
  381. "gemini-pro-vision": "2023-12",
  382. "deepseek-chat": "2024-07",
  383. "deepseek-coder": "2024-07",
  384. };
  385. export const DEFAULT_TTS_ENGINE = "OpenAI-TTS";
  386. export const DEFAULT_TTS_ENGINES = ["OpenAI-TTS", "Edge-TTS"];
  387. export const DEFAULT_TTS_MODEL = "tts-1";
  388. export const DEFAULT_TTS_VOICE = "alloy";
  389. export const DEFAULT_TTS_MODELS = ["tts-1", "tts-1-hd"];
  390. export const DEFAULT_TTS_VOICES = [
  391. "alloy",
  392. "echo",
  393. "fable",
  394. "onyx",
  395. "nova",
  396. "shimmer",
  397. ];
  398. export const VISION_MODEL_REGEXES = [
  399. /vision/,
  400. /gpt-4o/,
  401. /gpt-4\.1/,
  402. /claude-3/,
  403. /gemini-1\.5/,
  404. /gemini-exp/,
  405. /gemini-2\.0/,
  406. /learnlm/,
  407. /qwen-vl/,
  408. /qwen2-vl/,
  409. /gpt-4-turbo(?!.*preview)/, // Matches "gpt-4-turbo" but not "gpt-4-turbo-preview"
  410. /^dall-e-3$/, // Matches exactly "dall-e-3"
  411. /glm-4v/,
  412. /vl/i,
  413. /o3/,
  414. /o4-mini/,
  415. ];
  416. export const EXCLUDE_VISION_MODEL_REGEXES = [/claude-3-5-haiku-20241022/];
  417. const openaiModels = [
  418. // As of July 2024, gpt-4o-mini should be used in place of gpt-3.5-turbo,
  419. // as it is cheaper, more capable, multimodal, and just as fast. gpt-3.5-turbo is still available for use in the API.
  420. "gpt-3.5-turbo",
  421. "gpt-3.5-turbo-1106",
  422. "gpt-3.5-turbo-0125",
  423. "gpt-4",
  424. "gpt-4-0613",
  425. "gpt-4-32k",
  426. "gpt-4-32k-0613",
  427. "gpt-4-turbo",
  428. "gpt-4-turbo-preview",
  429. "gpt-4.1",
  430. "gpt-4.1-2025-04-14",
  431. "gpt-4.1-mini",
  432. "gpt-4.1-mini-2025-04-14",
  433. "gpt-4.1-nano",
  434. "gpt-4.1-nano-2025-04-14",
  435. "gpt-4.5-preview",
  436. "gpt-4.5-preview-2025-02-27",
  437. "gpt-4o",
  438. "gpt-4o-2024-05-13",
  439. "gpt-4o-2024-08-06",
  440. "gpt-4o-2024-11-20",
  441. "chatgpt-4o-latest",
  442. "gpt-4o-mini",
  443. "gpt-4o-mini-2024-07-18",
  444. "gpt-4-vision-preview",
  445. "gpt-4-turbo-2024-04-09",
  446. "gpt-4-1106-preview",
  447. "dall-e-3",
  448. "o1-mini",
  449. "o1-preview",
  450. "o3-mini",
  451. "o3",
  452. "o4-mini",
  453. ];
  454. const googleModels = [
  455. "gemini-1.0-pro", // Deprecated on 2/15/2025
  456. "gemini-1.5-pro-latest",
  457. "gemini-1.5-pro",
  458. "gemini-1.5-pro-002",
  459. "gemini-1.5-pro-exp-0827",
  460. "gemini-1.5-flash-latest",
  461. "gemini-1.5-flash-8b-latest",
  462. "gemini-1.5-flash",
  463. "gemini-1.5-flash-8b",
  464. "gemini-1.5-flash-002",
  465. "gemini-1.5-flash-exp-0827",
  466. "learnlm-1.5-pro-experimental",
  467. "gemini-exp-1114",
  468. "gemini-exp-1121",
  469. "gemini-exp-1206",
  470. "gemini-2.0-flash",
  471. "gemini-2.0-flash-exp",
  472. "gemini-2.0-flash-lite-preview-02-05",
  473. "gemini-2.0-flash-thinking-exp",
  474. "gemini-2.0-flash-thinking-exp-1219",
  475. "gemini-2.0-flash-thinking-exp-01-21",
  476. "gemini-2.0-pro-exp",
  477. "gemini-2.0-pro-exp-02-05",
  478. ];
  479. const anthropicModels = [
  480. "claude-instant-1.2",
  481. "claude-2.0",
  482. "claude-2.1",
  483. "claude-3-sonnet-20240229",
  484. "claude-3-opus-20240229",
  485. "claude-3-opus-latest",
  486. "claude-3-haiku-20240307",
  487. "claude-3-5-haiku-20241022",
  488. "claude-3-5-haiku-latest",
  489. "claude-3-5-sonnet-20240620",
  490. "claude-3-5-sonnet-20241022",
  491. "claude-3-5-sonnet-latest",
  492. "claude-3-7-sonnet-20250219",
  493. "claude-3-7-sonnet-latest",
  494. ];
  495. const baiduModels = [
  496. "ernie-4.0-turbo-8k",
  497. "ernie-4.0-8k",
  498. "ernie-4.0-8k-preview",
  499. "ernie-4.0-8k-preview-0518",
  500. "ernie-4.0-8k-latest",
  501. "ernie-3.5-8k",
  502. "ernie-3.5-8k-0205",
  503. "ernie-speed-128k",
  504. "ernie-speed-8k",
  505. "ernie-lite-8k",
  506. "ernie-tiny-8k",
  507. ];
  508. const bytedanceModels = [
  509. "Doubao-lite-4k",
  510. "Doubao-lite-32k",
  511. "Doubao-lite-128k",
  512. "Doubao-pro-4k",
  513. "Doubao-pro-32k",
  514. "Doubao-pro-128k",
  515. ];
  516. const alibabaModes = [
  517. "qwen-turbo",
  518. "qwen-plus",
  519. "qwen-max",
  520. "qwen-max-0428",
  521. "qwen-max-0403",
  522. "qwen-max-0107",
  523. "qwen-max-longcontext",
  524. "qwen-omni-turbo",
  525. "qwen-vl-plus",
  526. "qwen-vl-max",
  527. ];
  528. const tencentModels = [
  529. "hunyuan-pro",
  530. "hunyuan-standard",
  531. "hunyuan-lite",
  532. "hunyuan-role",
  533. "hunyuan-functioncall",
  534. "hunyuan-code",
  535. "hunyuan-vision",
  536. ];
  537. const moonshotModes = ["moonshot-v1-8k", "moonshot-v1-32k", "moonshot-v1-128k"];
  538. const iflytekModels = [
  539. "general",
  540. "generalv3",
  541. "pro-128k",
  542. "generalv3.5",
  543. "4.0Ultra",
  544. ];
  545. const deepseekModels = ["deepseek-chat", "deepseek-coder", "deepseek-reasoner"];
  546. const xAIModes = [
  547. "grok-beta",
  548. "grok-2",
  549. "grok-2-1212",
  550. "grok-2-latest",
  551. "grok-vision-beta",
  552. "grok-2-vision-1212",
  553. "grok-2-vision",
  554. "grok-2-vision-latest",
  555. "grok-3-mini-fast-beta",
  556. "grok-3-mini-fast",
  557. "grok-3-mini-fast-latest",
  558. "grok-3-mini-beta",
  559. "grok-3-mini",
  560. "grok-3-mini-latest",
  561. "grok-3-fast-beta",
  562. "grok-3-fast",
  563. "grok-3-fast-latest",
  564. "grok-3-beta",
  565. "grok-3",
  566. "grok-3-latest",
  567. ];
  568. const chatglmModels = [
  569. "glm-4-plus",
  570. "glm-4-0520",
  571. "glm-4",
  572. "glm-4-air",
  573. "glm-4-airx",
  574. "glm-4-long",
  575. "glm-4-flashx",
  576. "glm-4-flash",
  577. "glm-4v-plus",
  578. "glm-4v",
  579. "glm-4v-flash", // free
  580. "cogview-3-plus",
  581. "cogview-3",
  582. "cogview-3-flash", // free
  583. // 目前无法适配轮询任务
  584. // "cogvideox",
  585. // "cogvideox-flash", // free
  586. ];
  587. const siliconflowModels = [
  588. "Qwen/Qwen2.5-7B-Instruct",
  589. "Qwen/Qwen2.5-72B-Instruct",
  590. "deepseek-ai/DeepSeek-R1",
  591. "deepseek-ai/DeepSeek-R1-Distill-Llama-70B",
  592. "deepseek-ai/DeepSeek-R1-Distill-Llama-8B",
  593. "deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B",
  594. "deepseek-ai/DeepSeek-R1-Distill-Qwen-14B",
  595. "deepseek-ai/DeepSeek-R1-Distill-Qwen-32B",
  596. "deepseek-ai/DeepSeek-R1-Distill-Qwen-7B",
  597. "deepseek-ai/DeepSeek-V3",
  598. "meta-llama/Llama-3.3-70B-Instruct",
  599. "THUDM/glm-4-9b-chat",
  600. "Pro/deepseek-ai/DeepSeek-R1",
  601. "Pro/deepseek-ai/DeepSeek-V3",
  602. ];
  603. let seq = 1000; // 内置的模型序号生成器从1000开始
  604. export const DEFAULT_MODELS = [
  605. ...openaiModels.map((name) => ({
  606. name,
  607. available: true,
  608. sorted: seq++, // Global sequence sort(index)
  609. provider: {
  610. id: "openai",
  611. providerName: "OpenAI",
  612. providerType: "openai",
  613. sorted: 1, // 这里是固定的,确保顺序与之前内置的版本一致
  614. },
  615. })),
  616. ...openaiModels.map((name) => ({
  617. name,
  618. available: true,
  619. sorted: seq++,
  620. provider: {
  621. id: "azure",
  622. providerName: "Azure",
  623. providerType: "azure",
  624. sorted: 2,
  625. },
  626. })),
  627. ...googleModels.map((name) => ({
  628. name,
  629. available: true,
  630. sorted: seq++,
  631. provider: {
  632. id: "google",
  633. providerName: "Google",
  634. providerType: "google",
  635. sorted: 3,
  636. },
  637. })),
  638. ...anthropicModels.map((name) => ({
  639. name,
  640. available: true,
  641. sorted: seq++,
  642. provider: {
  643. id: "anthropic",
  644. providerName: "Anthropic",
  645. providerType: "anthropic",
  646. sorted: 4,
  647. },
  648. })),
  649. ...baiduModels.map((name) => ({
  650. name,
  651. available: true,
  652. sorted: seq++,
  653. provider: {
  654. id: "baidu",
  655. providerName: "Baidu",
  656. providerType: "baidu",
  657. sorted: 5,
  658. },
  659. })),
  660. ...bytedanceModels.map((name) => ({
  661. name,
  662. available: true,
  663. sorted: seq++,
  664. provider: {
  665. id: "bytedance",
  666. providerName: "ByteDance",
  667. providerType: "bytedance",
  668. sorted: 6,
  669. },
  670. })),
  671. ...alibabaModes.map((name) => ({
  672. name,
  673. available: true,
  674. sorted: seq++,
  675. provider: {
  676. id: "alibaba",
  677. providerName: "Alibaba",
  678. providerType: "alibaba",
  679. sorted: 7,
  680. },
  681. })),
  682. ...tencentModels.map((name) => ({
  683. name,
  684. available: true,
  685. sorted: seq++,
  686. provider: {
  687. id: "tencent",
  688. providerName: "Tencent",
  689. providerType: "tencent",
  690. sorted: 8,
  691. },
  692. })),
  693. ...moonshotModes.map((name) => ({
  694. name,
  695. available: true,
  696. sorted: seq++,
  697. provider: {
  698. id: "moonshot",
  699. providerName: "Moonshot",
  700. providerType: "moonshot",
  701. sorted: 9,
  702. },
  703. })),
  704. ...iflytekModels.map((name) => ({
  705. name,
  706. available: true,
  707. sorted: seq++,
  708. provider: {
  709. id: "iflytek",
  710. providerName: "Iflytek",
  711. providerType: "iflytek",
  712. sorted: 10,
  713. },
  714. })),
  715. ...xAIModes.map((name) => ({
  716. name,
  717. available: true,
  718. sorted: seq++,
  719. provider: {
  720. id: "xai",
  721. providerName: "XAI",
  722. providerType: "xai",
  723. sorted: 11,
  724. },
  725. })),
  726. ...chatglmModels.map((name) => ({
  727. name,
  728. available: true,
  729. sorted: seq++,
  730. provider: {
  731. id: "chatglm",
  732. providerName: "ChatGLM",
  733. providerType: "chatglm",
  734. sorted: 12,
  735. },
  736. })),
  737. ...deepseekModels.map((name) => ({
  738. name,
  739. available: true,
  740. sorted: seq++,
  741. provider: {
  742. id: "deepseek",
  743. providerName: "DeepSeek",
  744. providerType: "deepseek",
  745. sorted: 13,
  746. },
  747. })),
  748. ...siliconflowModels.map((name) => ({
  749. name,
  750. available: true,
  751. sorted: seq++,
  752. provider: {
  753. id: "siliconflow",
  754. providerName: "SiliconFlow",
  755. providerType: "siliconflow",
  756. sorted: 14,
  757. },
  758. })),
  759. ] as const;
  760. export const CHAT_PAGE_SIZE = 15;
  761. export const MAX_RENDER_MSG_COUNT = 45;
  762. // some famous webdav endpoints
  763. export const internalAllowedWebDavEndpoints = [
  764. "https://dav.jianguoyun.com/dav/",
  765. "https://dav.dropdav.com/",
  766. "https://dav.box.com/dav",
  767. "https://nanao.teracloud.jp/dav/",
  768. "https://bora.teracloud.jp/dav/",
  769. "https://webdav.4shared.com/",
  770. "https://dav.idrivesync.com",
  771. "https://webdav.yandex.com",
  772. "https://app.koofr.net/dav/Koofr",
  773. ];
  774. export const DEFAULT_GA_ID = "G-89WN60ZK2E";
  775. export const SAAS_CHAT_URL = "https://nextchat.club";
  776. export const SAAS_CHAT_UTM_URL = "https://nextchat.club?utm=github";