constant.ts 22 KB

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