constant.ts 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830
  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-4o": "2023-10",
  355. "gpt-4o-2024-05-13": "2023-10",
  356. "gpt-4o-2024-08-06": "2023-10",
  357. "gpt-4o-2024-11-20": "2023-10",
  358. "chatgpt-4o-latest": "2023-10",
  359. "gpt-4o-mini": "2023-10",
  360. "gpt-4o-mini-2024-07-18": "2023-10",
  361. "gpt-4-vision-preview": "2023-04",
  362. "o1-mini-2024-09-12": "2023-10",
  363. "o1-mini": "2023-10",
  364. "o1-preview-2024-09-12": "2023-10",
  365. "o1-preview": "2023-10",
  366. "o1-2024-12-17": "2023-10",
  367. o1: "2023-10",
  368. "o3-mini-2025-01-31": "2023-10",
  369. "o3-mini": "2023-10",
  370. // After improvements,
  371. // it's now easier to add "KnowledgeCutOffDate" instead of stupid hardcoding it, as was done previously.
  372. "gemini-pro": "2023-12",
  373. "gemini-pro-vision": "2023-12",
  374. "deepseek-chat": "2024-07",
  375. "deepseek-coder": "2024-07",
  376. };
  377. export const DEFAULT_TTS_ENGINE = "OpenAI-TTS";
  378. export const DEFAULT_TTS_ENGINES = ["OpenAI-TTS", "Edge-TTS"];
  379. export const DEFAULT_TTS_MODEL = "tts-1";
  380. export const DEFAULT_TTS_VOICE = "alloy";
  381. export const DEFAULT_TTS_MODELS = ["tts-1", "tts-1-hd"];
  382. export const DEFAULT_TTS_VOICES = [
  383. "alloy",
  384. "echo",
  385. "fable",
  386. "onyx",
  387. "nova",
  388. "shimmer",
  389. ];
  390. export const VISION_MODEL_REGEXES = [
  391. /vision/,
  392. /gpt-4o/,
  393. /claude-3/,
  394. /gemini-1\.5/,
  395. /gemini-exp/,
  396. /gemini-2\.0/,
  397. /learnlm/,
  398. /qwen-vl/,
  399. /qwen2-vl/,
  400. /gpt-4-turbo(?!.*preview)/, // Matches "gpt-4-turbo" but not "gpt-4-turbo-preview"
  401. /^dall-e-3$/, // Matches exactly "dall-e-3"
  402. /glm-4v/,
  403. /vl/i,
  404. ];
  405. export const EXCLUDE_VISION_MODEL_REGEXES = [/claude-3-5-haiku-20241022/];
  406. const openaiModels = [
  407. // As of July 2024, gpt-4o-mini should be used in place of gpt-3.5-turbo,
  408. // as it is cheaper, more capable, multimodal, and just as fast. gpt-3.5-turbo is still available for use in the API.
  409. "gpt-3.5-turbo",
  410. "gpt-3.5-turbo-1106",
  411. "gpt-3.5-turbo-0125",
  412. "gpt-4",
  413. "gpt-4-0613",
  414. "gpt-4-32k",
  415. "gpt-4-32k-0613",
  416. "gpt-4-turbo",
  417. "gpt-4-turbo-preview",
  418. "gpt-4o",
  419. "gpt-4o-2024-05-13",
  420. "gpt-4o-2024-08-06",
  421. "gpt-4o-2024-11-20",
  422. "chatgpt-4o-latest",
  423. "gpt-4o-mini",
  424. "gpt-4o-mini-2024-07-18",
  425. "gpt-4-vision-preview",
  426. "gpt-4-turbo-2024-04-09",
  427. "gpt-4-1106-preview",
  428. "dall-e-3",
  429. "o1-mini",
  430. "o1-preview",
  431. "o3-mini",
  432. ];
  433. const googleModels = [
  434. "gemini-1.0-pro", // Deprecated on 2/15/2025
  435. "gemini-1.5-pro-latest",
  436. "gemini-1.5-pro",
  437. "gemini-1.5-pro-002",
  438. "gemini-1.5-pro-exp-0827",
  439. "gemini-1.5-flash-latest",
  440. "gemini-1.5-flash-8b-latest",
  441. "gemini-1.5-flash",
  442. "gemini-1.5-flash-8b",
  443. "gemini-1.5-flash-002",
  444. "gemini-1.5-flash-exp-0827",
  445. "learnlm-1.5-pro-experimental",
  446. "gemini-exp-1114",
  447. "gemini-exp-1121",
  448. "gemini-exp-1206",
  449. "gemini-2.0-flash",
  450. "gemini-2.0-flash-exp",
  451. "gemini-2.0-flash-lite-preview-02-05",
  452. "gemini-2.0-flash-thinking-exp",
  453. "gemini-2.0-flash-thinking-exp-1219",
  454. "gemini-2.0-flash-thinking-exp-01-21",
  455. "gemini-2.0-pro-exp",
  456. "gemini-2.0-pro-exp-02-05",
  457. ];
  458. const anthropicModels = [
  459. "claude-instant-1.2",
  460. "claude-2.0",
  461. "claude-2.1",
  462. "claude-3-sonnet-20240229",
  463. "claude-3-opus-20240229",
  464. "claude-3-opus-latest",
  465. "claude-3-haiku-20240307",
  466. "claude-3-5-haiku-20241022",
  467. "claude-3-5-haiku-latest",
  468. "claude-3-5-sonnet-20240620",
  469. "claude-3-5-sonnet-20241022",
  470. "claude-3-5-sonnet-latest",
  471. "claude-3-7-sonnet-20250219",
  472. "claude-3-7-sonnet-latest",
  473. ];
  474. const baiduModels = [
  475. "ernie-4.0-turbo-8k",
  476. "ernie-4.0-8k",
  477. "ernie-4.0-8k-preview",
  478. "ernie-4.0-8k-preview-0518",
  479. "ernie-4.0-8k-latest",
  480. "ernie-3.5-8k",
  481. "ernie-3.5-8k-0205",
  482. "ernie-speed-128k",
  483. "ernie-speed-8k",
  484. "ernie-lite-8k",
  485. "ernie-tiny-8k",
  486. ];
  487. const bytedanceModels = [
  488. "Doubao-lite-4k",
  489. "Doubao-lite-32k",
  490. "Doubao-lite-128k",
  491. "Doubao-pro-4k",
  492. "Doubao-pro-32k",
  493. "Doubao-pro-128k",
  494. ];
  495. const alibabaModes = [
  496. "qwen-turbo",
  497. "qwen-plus",
  498. "qwen-max",
  499. "qwen-max-0428",
  500. "qwen-max-0403",
  501. "qwen-max-0107",
  502. "qwen-max-longcontext",
  503. "qwen-omni-turbo",
  504. "qwen-vl-plus",
  505. "qwen-vl-max",
  506. ];
  507. const tencentModels = [
  508. "hunyuan-pro",
  509. "hunyuan-standard",
  510. "hunyuan-lite",
  511. "hunyuan-role",
  512. "hunyuan-functioncall",
  513. "hunyuan-code",
  514. "hunyuan-vision",
  515. ];
  516. const moonshotModes = ["moonshot-v1-8k", "moonshot-v1-32k", "moonshot-v1-128k"];
  517. const iflytekModels = [
  518. "general",
  519. "generalv3",
  520. "pro-128k",
  521. "generalv3.5",
  522. "4.0Ultra",
  523. ];
  524. const deepseekModels = ["deepseek-chat", "deepseek-coder", "deepseek-reasoner"];
  525. const xAIModes = [
  526. "grok-beta",
  527. "grok-2",
  528. "grok-2-1212",
  529. "grok-2-latest",
  530. "grok-vision-beta",
  531. "grok-2-vision-1212",
  532. "grok-2-vision",
  533. "grok-2-vision-latest",
  534. ];
  535. const chatglmModels = [
  536. "glm-4-plus",
  537. "glm-4-0520",
  538. "glm-4",
  539. "glm-4-air",
  540. "glm-4-airx",
  541. "glm-4-long",
  542. "glm-4-flashx",
  543. "glm-4-flash",
  544. "glm-4v-plus",
  545. "glm-4v",
  546. "glm-4v-flash", // free
  547. "cogview-3-plus",
  548. "cogview-3",
  549. "cogview-3-flash", // free
  550. // 目前无法适配轮询任务
  551. // "cogvideox",
  552. // "cogvideox-flash", // free
  553. ];
  554. const siliconflowModels = [
  555. "Qwen/Qwen2.5-7B-Instruct",
  556. "Qwen/Qwen2.5-72B-Instruct",
  557. "deepseek-ai/DeepSeek-R1",
  558. "deepseek-ai/DeepSeek-R1-Distill-Llama-70B",
  559. "deepseek-ai/DeepSeek-R1-Distill-Llama-8B",
  560. "deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B",
  561. "deepseek-ai/DeepSeek-R1-Distill-Qwen-14B",
  562. "deepseek-ai/DeepSeek-R1-Distill-Qwen-32B",
  563. "deepseek-ai/DeepSeek-R1-Distill-Qwen-7B",
  564. "deepseek-ai/DeepSeek-V3",
  565. "meta-llama/Llama-3.3-70B-Instruct",
  566. "THUDM/glm-4-9b-chat",
  567. "Pro/deepseek-ai/DeepSeek-R1",
  568. "Pro/deepseek-ai/DeepSeek-V3",
  569. ];
  570. let seq = 1000; // 内置的模型序号生成器从1000开始
  571. export const DEFAULT_MODELS = [
  572. ...openaiModels.map((name) => ({
  573. name,
  574. available: true,
  575. sorted: seq++, // Global sequence sort(index)
  576. provider: {
  577. id: "openai",
  578. providerName: "OpenAI",
  579. providerType: "openai",
  580. sorted: 1, // 这里是固定的,确保顺序与之前内置的版本一致
  581. },
  582. })),
  583. ...openaiModels.map((name) => ({
  584. name,
  585. available: true,
  586. sorted: seq++,
  587. provider: {
  588. id: "azure",
  589. providerName: "Azure",
  590. providerType: "azure",
  591. sorted: 2,
  592. },
  593. })),
  594. ...googleModels.map((name) => ({
  595. name,
  596. available: true,
  597. sorted: seq++,
  598. provider: {
  599. id: "google",
  600. providerName: "Google",
  601. providerType: "google",
  602. sorted: 3,
  603. },
  604. })),
  605. ...anthropicModels.map((name) => ({
  606. name,
  607. available: true,
  608. sorted: seq++,
  609. provider: {
  610. id: "anthropic",
  611. providerName: "Anthropic",
  612. providerType: "anthropic",
  613. sorted: 4,
  614. },
  615. })),
  616. ...baiduModels.map((name) => ({
  617. name,
  618. available: true,
  619. sorted: seq++,
  620. provider: {
  621. id: "baidu",
  622. providerName: "Baidu",
  623. providerType: "baidu",
  624. sorted: 5,
  625. },
  626. })),
  627. ...bytedanceModels.map((name) => ({
  628. name,
  629. available: true,
  630. sorted: seq++,
  631. provider: {
  632. id: "bytedance",
  633. providerName: "ByteDance",
  634. providerType: "bytedance",
  635. sorted: 6,
  636. },
  637. })),
  638. ...alibabaModes.map((name) => ({
  639. name,
  640. available: true,
  641. sorted: seq++,
  642. provider: {
  643. id: "alibaba",
  644. providerName: "Alibaba",
  645. providerType: "alibaba",
  646. sorted: 7,
  647. },
  648. })),
  649. ...tencentModels.map((name) => ({
  650. name,
  651. available: true,
  652. sorted: seq++,
  653. provider: {
  654. id: "tencent",
  655. providerName: "Tencent",
  656. providerType: "tencent",
  657. sorted: 8,
  658. },
  659. })),
  660. ...moonshotModes.map((name) => ({
  661. name,
  662. available: true,
  663. sorted: seq++,
  664. provider: {
  665. id: "moonshot",
  666. providerName: "Moonshot",
  667. providerType: "moonshot",
  668. sorted: 9,
  669. },
  670. })),
  671. ...iflytekModels.map((name) => ({
  672. name,
  673. available: true,
  674. sorted: seq++,
  675. provider: {
  676. id: "iflytek",
  677. providerName: "Iflytek",
  678. providerType: "iflytek",
  679. sorted: 10,
  680. },
  681. })),
  682. ...xAIModes.map((name) => ({
  683. name,
  684. available: true,
  685. sorted: seq++,
  686. provider: {
  687. id: "xai",
  688. providerName: "XAI",
  689. providerType: "xai",
  690. sorted: 11,
  691. },
  692. })),
  693. ...chatglmModels.map((name) => ({
  694. name,
  695. available: true,
  696. sorted: seq++,
  697. provider: {
  698. id: "chatglm",
  699. providerName: "ChatGLM",
  700. providerType: "chatglm",
  701. sorted: 12,
  702. },
  703. })),
  704. ...deepseekModels.map((name) => ({
  705. name,
  706. available: true,
  707. sorted: seq++,
  708. provider: {
  709. id: "deepseek",
  710. providerName: "DeepSeek",
  711. providerType: "deepseek",
  712. sorted: 13,
  713. },
  714. })),
  715. ...siliconflowModels.map((name) => ({
  716. name,
  717. available: true,
  718. sorted: seq++,
  719. provider: {
  720. id: "siliconflow",
  721. providerName: "SiliconFlow",
  722. providerType: "siliconflow",
  723. sorted: 14,
  724. },
  725. })),
  726. ] as const;
  727. export const CHAT_PAGE_SIZE = 15;
  728. export const MAX_RENDER_MSG_COUNT = 45;
  729. // some famous webdav endpoints
  730. export const internalAllowedWebDavEndpoints = [
  731. "https://dav.jianguoyun.com/dav/",
  732. "https://dav.dropdav.com/",
  733. "https://dav.box.com/dav",
  734. "https://nanao.teracloud.jp/dav/",
  735. "https://bora.teracloud.jp/dav/",
  736. "https://webdav.4shared.com/",
  737. "https://dav.idrivesync.com",
  738. "https://webdav.yandex.com",
  739. "https://app.koofr.net/dav/Koofr",
  740. ];
  741. export const DEFAULT_GA_ID = "G-89WN60ZK2E";
  742. export const SAAS_CHAT_URL = "https://nextchat.club";
  743. export const SAAS_CHAT_UTM_URL = "https://nextchat.club?utm=github";