constant.ts 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822
  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: "v1/services/aigc/text-generation/generation",
  190. };
  191. export const Tencent = {
  192. ExampleEndpoint: TENCENT_BASE_URL,
  193. };
  194. export const Moonshot = {
  195. ExampleEndpoint: MOONSHOT_BASE_URL,
  196. ChatPath: "v1/chat/completions",
  197. };
  198. export const Iflytek = {
  199. ExampleEndpoint: IFLYTEK_BASE_URL,
  200. ChatPath: "v1/chat/completions",
  201. };
  202. export const DeepSeek = {
  203. ExampleEndpoint: DEEPSEEK_BASE_URL,
  204. ChatPath: "chat/completions",
  205. };
  206. export const XAI = {
  207. ExampleEndpoint: XAI_BASE_URL,
  208. ChatPath: "v1/chat/completions",
  209. };
  210. export const ChatGLM = {
  211. ExampleEndpoint: CHATGLM_BASE_URL,
  212. ChatPath: "api/paas/v4/chat/completions",
  213. ImagePath: "api/paas/v4/images/generations",
  214. VideoPath: "api/paas/v4/videos/generations",
  215. };
  216. export const SiliconFlow = {
  217. ExampleEndpoint: SILICONFLOW_BASE_URL,
  218. ChatPath: "v1/chat/completions",
  219. ListModelPath: "v1/models?&sub_type=chat",
  220. };
  221. export const DEFAULT_INPUT_TEMPLATE = `{{input}}`; // input / time / model / lang
  222. // export const DEFAULT_SYSTEM_TEMPLATE = `
  223. // You are ChatGPT, a large language model trained by {{ServiceProvider}}.
  224. // Knowledge cutoff: {{cutoff}}
  225. // Current model: {{model}}
  226. // Current time: {{time}}
  227. // Latex inline: $x^2$
  228. // Latex block: $$e=mc^2$$
  229. // `;
  230. export const DEFAULT_SYSTEM_TEMPLATE = `
  231. You are ChatGPT, a large language model trained by {{ServiceProvider}}.
  232. Knowledge cutoff: {{cutoff}}
  233. Current model: {{model}}
  234. Current time: {{time}}
  235. Latex inline: \\(x^2\\)
  236. Latex block: $$e=mc^2$$
  237. `;
  238. export const MCP_TOOLS_TEMPLATE = `
  239. [clientId]
  240. {{ clientId }}
  241. [tools]
  242. {{ tools }}
  243. `;
  244. export const MCP_SYSTEM_TEMPLATE = `
  245. 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.
  246. 1. AVAILABLE TOOLS:
  247. {{ MCP_TOOLS }}
  248. 2. WHEN TO USE TOOLS:
  249. - ALWAYS USE TOOLS when they can help answer user questions
  250. - DO NOT just describe what you could do - TAKE ACTION immediately
  251. - If you're not sure whether to use a tool, USE IT
  252. - Common triggers for tool use:
  253. * Questions about files or directories
  254. * Requests to check, list, or manipulate system resources
  255. * Any query that can be answered with available tools
  256. 3. HOW TO USE TOOLS:
  257. A. Tool Call Format:
  258. - Use markdown code blocks with format: \`\`\`json:mcp:{clientId}\`\`\`
  259. - Always include:
  260. * method: "tools/call"(Only this method is supported)
  261. * params:
  262. - name: must match an available primitive name
  263. - arguments: required parameters for the primitive
  264. B. Response Format:
  265. - Tool responses will come as user messages
  266. - Format: \`\`\`json:mcp-response:{clientId}\`\`\`
  267. - Wait for response before making another tool call
  268. C. Important Rules:
  269. - Only use tools/call method
  270. - Only ONE tool call per message
  271. - ALWAYS TAKE ACTION instead of just describing what you could do
  272. - Include the correct clientId in code block language tag
  273. - Verify arguments match the primitive's requirements
  274. 4. INTERACTION FLOW:
  275. A. When user makes a request:
  276. - IMMEDIATELY use appropriate tool if available
  277. - DO NOT ask if user wants you to use the tool
  278. - DO NOT just describe what you could do
  279. B. After receiving tool response:
  280. - Explain results clearly
  281. - Take next appropriate action if needed
  282. C. If tools fail:
  283. - Explain the error
  284. - Try alternative approach immediately
  285. 5. EXAMPLE INTERACTION:
  286. good example:
  287. \`\`\`json:mcp:filesystem
  288. {
  289. "method": "tools/call",
  290. "params": {
  291. "name": "list_allowed_directories",
  292. "arguments": {}
  293. }
  294. }
  295. \`\`\`"
  296. \`\`\`json:mcp-response:filesystem
  297. {
  298. "method": "tools/call",
  299. "params": {
  300. "name": "write_file",
  301. "arguments": {
  302. "path": "/Users/river/dev/nextchat/test/joke.txt",
  303. "content": "为什么数学书总是感到忧伤?因为它有太多的问题。"
  304. }
  305. }
  306. }
  307. \`\`\`
  308. follwing is the wrong! mcp json example:
  309. \`\`\`json:mcp:filesystem
  310. {
  311. "method": "write_file",
  312. "params": {
  313. "path": "NextChat_Information.txt",
  314. "content": "1"
  315. }
  316. }
  317. \`\`\`
  318. This is wrong because the method is not tools/call.
  319. \`\`\`{
  320. "method": "search_repositories",
  321. "params": {
  322. "query": "2oeee"
  323. }
  324. }
  325. \`\`\`
  326. This is wrong because the method is not tools/call.!!!!!!!!!!!
  327. the right format is:
  328. \`\`\`json:mcp:filesystem
  329. {
  330. "method": "tools/call",
  331. "params": {
  332. "name": "search_repositories",
  333. "arguments": {
  334. "query": "2oeee"
  335. }
  336. }
  337. }
  338. \`\`\`
  339. please follow the format strictly ONLY use tools/call method!!!!!!!!!!!
  340. `;
  341. export const SUMMARIZE_MODEL = "gpt-4o-mini";
  342. export const GEMINI_SUMMARIZE_MODEL = "gemini-pro";
  343. export const DEEPSEEK_SUMMARIZE_MODEL = "deepseek-chat";
  344. export const KnowledgeCutOffDate: Record<string, string> = {
  345. default: "2021-09",
  346. "gpt-4-turbo": "2023-12",
  347. "gpt-4-turbo-2024-04-09": "2023-12",
  348. "gpt-4-turbo-preview": "2023-12",
  349. "gpt-4o": "2023-10",
  350. "gpt-4o-2024-05-13": "2023-10",
  351. "gpt-4o-2024-08-06": "2023-10",
  352. "gpt-4o-2024-11-20": "2023-10",
  353. "chatgpt-4o-latest": "2023-10",
  354. "gpt-4o-mini": "2023-10",
  355. "gpt-4o-mini-2024-07-18": "2023-10",
  356. "gpt-4-vision-preview": "2023-04",
  357. "o1-mini-2024-09-12": "2023-10",
  358. "o1-mini": "2023-10",
  359. "o1-preview-2024-09-12": "2023-10",
  360. "o1-preview": "2023-10",
  361. "o1-2024-12-17": "2023-10",
  362. o1: "2023-10",
  363. "o3-mini-2025-01-31": "2023-10",
  364. "o3-mini": "2023-10",
  365. // After improvements,
  366. // it's now easier to add "KnowledgeCutOffDate" instead of stupid hardcoding it, as was done previously.
  367. "gemini-pro": "2023-12",
  368. "gemini-pro-vision": "2023-12",
  369. "deepseek-chat": "2024-07",
  370. "deepseek-coder": "2024-07",
  371. };
  372. export const DEFAULT_TTS_ENGINE = "OpenAI-TTS";
  373. export const DEFAULT_TTS_ENGINES = ["OpenAI-TTS", "Edge-TTS"];
  374. export const DEFAULT_TTS_MODEL = "tts-1";
  375. export const DEFAULT_TTS_VOICE = "alloy";
  376. export const DEFAULT_TTS_MODELS = ["tts-1", "tts-1-hd"];
  377. export const DEFAULT_TTS_VOICES = [
  378. "alloy",
  379. "echo",
  380. "fable",
  381. "onyx",
  382. "nova",
  383. "shimmer",
  384. ];
  385. export const VISION_MODEL_REGEXES = [
  386. /vision/,
  387. /gpt-4o/,
  388. /claude-3/,
  389. /gemini-1\.5/,
  390. /gemini-exp/,
  391. /gemini-2\.0/,
  392. /learnlm/,
  393. /qwen-vl/,
  394. /qwen2-vl/,
  395. /gpt-4-turbo(?!.*preview)/, // Matches "gpt-4-turbo" but not "gpt-4-turbo-preview"
  396. /^dall-e-3$/, // Matches exactly "dall-e-3"
  397. /glm-4v/,
  398. /vl/i,
  399. ];
  400. export const EXCLUDE_VISION_MODEL_REGEXES = [/claude-3-5-haiku-20241022/];
  401. const openaiModels = [
  402. // As of July 2024, gpt-4o-mini should be used in place of gpt-3.5-turbo,
  403. // as it is cheaper, more capable, multimodal, and just as fast. gpt-3.5-turbo is still available for use in the API.
  404. "gpt-3.5-turbo",
  405. "gpt-3.5-turbo-1106",
  406. "gpt-3.5-turbo-0125",
  407. "gpt-4",
  408. "gpt-4-0613",
  409. "gpt-4-32k",
  410. "gpt-4-32k-0613",
  411. "gpt-4-turbo",
  412. "gpt-4-turbo-preview",
  413. "gpt-4o",
  414. "gpt-4o-2024-05-13",
  415. "gpt-4o-2024-08-06",
  416. "gpt-4o-2024-11-20",
  417. "chatgpt-4o-latest",
  418. "gpt-4o-mini",
  419. "gpt-4o-mini-2024-07-18",
  420. "gpt-4-vision-preview",
  421. "gpt-4-turbo-2024-04-09",
  422. "gpt-4-1106-preview",
  423. "dall-e-3",
  424. "o1-mini",
  425. "o1-preview",
  426. "o3-mini",
  427. ];
  428. const googleModels = [
  429. "gemini-1.0-pro", // Deprecated on 2/15/2025
  430. "gemini-1.5-pro-latest",
  431. "gemini-1.5-pro",
  432. "gemini-1.5-pro-002",
  433. "gemini-1.5-pro-exp-0827",
  434. "gemini-1.5-flash-latest",
  435. "gemini-1.5-flash-8b-latest",
  436. "gemini-1.5-flash",
  437. "gemini-1.5-flash-8b",
  438. "gemini-1.5-flash-002",
  439. "gemini-1.5-flash-exp-0827",
  440. "learnlm-1.5-pro-experimental",
  441. "gemini-exp-1114",
  442. "gemini-exp-1121",
  443. "gemini-exp-1206",
  444. "gemini-2.0-flash",
  445. "gemini-2.0-flash-exp",
  446. "gemini-2.0-flash-lite-preview-02-05",
  447. "gemini-2.0-flash-thinking-exp",
  448. "gemini-2.0-flash-thinking-exp-1219",
  449. "gemini-2.0-flash-thinking-exp-01-21",
  450. "gemini-2.0-pro-exp",
  451. "gemini-2.0-pro-exp-02-05",
  452. ];
  453. const anthropicModels = [
  454. "claude-instant-1.2",
  455. "claude-2.0",
  456. "claude-2.1",
  457. "claude-3-sonnet-20240229",
  458. "claude-3-opus-20240229",
  459. "claude-3-opus-latest",
  460. "claude-3-haiku-20240307",
  461. "claude-3-5-haiku-20241022",
  462. "claude-3-5-haiku-latest",
  463. "claude-3-5-sonnet-20240620",
  464. "claude-3-5-sonnet-20241022",
  465. "claude-3-5-sonnet-latest",
  466. "claude-3-7-sonnet-20250219",
  467. "claude-3-7-sonnet-latest",
  468. ];
  469. const baiduModels = [
  470. "ernie-4.0-turbo-8k",
  471. "ernie-4.0-8k",
  472. "ernie-4.0-8k-preview",
  473. "ernie-4.0-8k-preview-0518",
  474. "ernie-4.0-8k-latest",
  475. "ernie-3.5-8k",
  476. "ernie-3.5-8k-0205",
  477. "ernie-speed-128k",
  478. "ernie-speed-8k",
  479. "ernie-lite-8k",
  480. "ernie-tiny-8k",
  481. ];
  482. const bytedanceModels = [
  483. "Doubao-lite-4k",
  484. "Doubao-lite-32k",
  485. "Doubao-lite-128k",
  486. "Doubao-pro-4k",
  487. "Doubao-pro-32k",
  488. "Doubao-pro-128k",
  489. ];
  490. const alibabaModes = [
  491. "qwen-turbo",
  492. "qwen-plus",
  493. "qwen-max",
  494. "qwen-max-0428",
  495. "qwen-max-0403",
  496. "qwen-max-0107",
  497. "qwen-max-longcontext",
  498. ];
  499. const tencentModels = [
  500. "hunyuan-pro",
  501. "hunyuan-standard",
  502. "hunyuan-lite",
  503. "hunyuan-role",
  504. "hunyuan-functioncall",
  505. "hunyuan-code",
  506. "hunyuan-vision",
  507. ];
  508. const moonshotModes = ["moonshot-v1-8k", "moonshot-v1-32k", "moonshot-v1-128k"];
  509. const iflytekModels = [
  510. "general",
  511. "generalv3",
  512. "pro-128k",
  513. "generalv3.5",
  514. "4.0Ultra",
  515. ];
  516. const deepseekModels = ["deepseek-chat", "deepseek-coder", "deepseek-reasoner"];
  517. const xAIModes = [
  518. "grok-beta",
  519. "grok-2",
  520. "grok-2-1212",
  521. "grok-2-latest",
  522. "grok-vision-beta",
  523. "grok-2-vision-1212",
  524. "grok-2-vision",
  525. "grok-2-vision-latest",
  526. ];
  527. const chatglmModels = [
  528. "glm-4-plus",
  529. "glm-4-0520",
  530. "glm-4",
  531. "glm-4-air",
  532. "glm-4-airx",
  533. "glm-4-long",
  534. "glm-4-flashx",
  535. "glm-4-flash",
  536. "glm-4v-plus",
  537. "glm-4v",
  538. "glm-4v-flash", // free
  539. "cogview-3-plus",
  540. "cogview-3",
  541. "cogview-3-flash", // free
  542. // 目前无法适配轮询任务
  543. // "cogvideox",
  544. // "cogvideox-flash", // free
  545. ];
  546. const siliconflowModels = [
  547. "Qwen/Qwen2.5-7B-Instruct",
  548. "Qwen/Qwen2.5-72B-Instruct",
  549. "deepseek-ai/DeepSeek-R1",
  550. "deepseek-ai/DeepSeek-R1-Distill-Llama-70B",
  551. "deepseek-ai/DeepSeek-R1-Distill-Llama-8B",
  552. "deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B",
  553. "deepseek-ai/DeepSeek-R1-Distill-Qwen-14B",
  554. "deepseek-ai/DeepSeek-R1-Distill-Qwen-32B",
  555. "deepseek-ai/DeepSeek-R1-Distill-Qwen-7B",
  556. "deepseek-ai/DeepSeek-V3",
  557. "meta-llama/Llama-3.3-70B-Instruct",
  558. "THUDM/glm-4-9b-chat",
  559. "Pro/deepseek-ai/DeepSeek-R1",
  560. "Pro/deepseek-ai/DeepSeek-V3",
  561. ];
  562. let seq = 1000; // 内置的模型序号生成器从1000开始
  563. export const DEFAULT_MODELS = [
  564. ...openaiModels.map((name) => ({
  565. name,
  566. available: true,
  567. sorted: seq++, // Global sequence sort(index)
  568. provider: {
  569. id: "openai",
  570. providerName: "OpenAI",
  571. providerType: "openai",
  572. sorted: 1, // 这里是固定的,确保顺序与之前内置的版本一致
  573. },
  574. })),
  575. ...openaiModels.map((name) => ({
  576. name,
  577. available: true,
  578. sorted: seq++,
  579. provider: {
  580. id: "azure",
  581. providerName: "Azure",
  582. providerType: "azure",
  583. sorted: 2,
  584. },
  585. })),
  586. ...googleModels.map((name) => ({
  587. name,
  588. available: true,
  589. sorted: seq++,
  590. provider: {
  591. id: "google",
  592. providerName: "Google",
  593. providerType: "google",
  594. sorted: 3,
  595. },
  596. })),
  597. ...anthropicModels.map((name) => ({
  598. name,
  599. available: true,
  600. sorted: seq++,
  601. provider: {
  602. id: "anthropic",
  603. providerName: "Anthropic",
  604. providerType: "anthropic",
  605. sorted: 4,
  606. },
  607. })),
  608. ...baiduModels.map((name) => ({
  609. name,
  610. available: true,
  611. sorted: seq++,
  612. provider: {
  613. id: "baidu",
  614. providerName: "Baidu",
  615. providerType: "baidu",
  616. sorted: 5,
  617. },
  618. })),
  619. ...bytedanceModels.map((name) => ({
  620. name,
  621. available: true,
  622. sorted: seq++,
  623. provider: {
  624. id: "bytedance",
  625. providerName: "ByteDance",
  626. providerType: "bytedance",
  627. sorted: 6,
  628. },
  629. })),
  630. ...alibabaModes.map((name) => ({
  631. name,
  632. available: true,
  633. sorted: seq++,
  634. provider: {
  635. id: "alibaba",
  636. providerName: "Alibaba",
  637. providerType: "alibaba",
  638. sorted: 7,
  639. },
  640. })),
  641. ...tencentModels.map((name) => ({
  642. name,
  643. available: true,
  644. sorted: seq++,
  645. provider: {
  646. id: "tencent",
  647. providerName: "Tencent",
  648. providerType: "tencent",
  649. sorted: 8,
  650. },
  651. })),
  652. ...moonshotModes.map((name) => ({
  653. name,
  654. available: true,
  655. sorted: seq++,
  656. provider: {
  657. id: "moonshot",
  658. providerName: "Moonshot",
  659. providerType: "moonshot",
  660. sorted: 9,
  661. },
  662. })),
  663. ...iflytekModels.map((name) => ({
  664. name,
  665. available: true,
  666. sorted: seq++,
  667. provider: {
  668. id: "iflytek",
  669. providerName: "Iflytek",
  670. providerType: "iflytek",
  671. sorted: 10,
  672. },
  673. })),
  674. ...xAIModes.map((name) => ({
  675. name,
  676. available: true,
  677. sorted: seq++,
  678. provider: {
  679. id: "xai",
  680. providerName: "XAI",
  681. providerType: "xai",
  682. sorted: 11,
  683. },
  684. })),
  685. ...chatglmModels.map((name) => ({
  686. name,
  687. available: true,
  688. sorted: seq++,
  689. provider: {
  690. id: "chatglm",
  691. providerName: "ChatGLM",
  692. providerType: "chatglm",
  693. sorted: 12,
  694. },
  695. })),
  696. ...deepseekModels.map((name) => ({
  697. name,
  698. available: true,
  699. sorted: seq++,
  700. provider: {
  701. id: "deepseek",
  702. providerName: "DeepSeek",
  703. providerType: "deepseek",
  704. sorted: 13,
  705. },
  706. })),
  707. ...siliconflowModels.map((name) => ({
  708. name,
  709. available: true,
  710. sorted: seq++,
  711. provider: {
  712. id: "siliconflow",
  713. providerName: "SiliconFlow",
  714. providerType: "siliconflow",
  715. sorted: 14,
  716. },
  717. })),
  718. ] as const;
  719. export const CHAT_PAGE_SIZE = 15;
  720. export const MAX_RENDER_MSG_COUNT = 45;
  721. // some famous webdav endpoints
  722. export const internalAllowedWebDavEndpoints = [
  723. "https://dav.jianguoyun.com/dav/",
  724. "https://dav.dropdav.com/",
  725. "https://dav.box.com/dav",
  726. "https://nanao.teracloud.jp/dav/",
  727. "https://bora.teracloud.jp/dav/",
  728. "https://webdav.4shared.com/",
  729. "https://dav.idrivesync.com",
  730. "https://webdav.yandex.com",
  731. "https://app.koofr.net/dav/Koofr",
  732. ];
  733. export const DEFAULT_GA_ID = "G-89WN60ZK2E";
  734. export const SAAS_CHAT_URL = "https://nextchat.club";
  735. export const SAAS_CHAT_UTM_URL = "https://nextchat.club?utm=github";