constant.ts 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922
  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.ai";
  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.*[34]/,
  413. /gemini-1\.5/,
  414. /gemini-exp/,
  415. /gemini-2\.[05]/,
  416. /learnlm/,
  417. /qwen-vl/,
  418. /qwen2-vl/,
  419. /gpt-4-turbo(?!.*preview)/,
  420. /^dall-e-3$/,
  421. /glm-4v/,
  422. /vl/i,
  423. /o3/,
  424. /o4-mini/,
  425. /grok-4/i,
  426. ];
  427. export const EXCLUDE_VISION_MODEL_REGEXES = [/claude-3-5-haiku-20241022/];
  428. const openaiModels = [
  429. // As of July 2024, gpt-4o-mini should be used in place of gpt-3.5-turbo,
  430. // as it is cheaper, more capable, multimodal, and just as fast. gpt-3.5-turbo is still available for use in the API.
  431. "gpt-3.5-turbo",
  432. "gpt-3.5-turbo-1106",
  433. "gpt-3.5-turbo-0125",
  434. "gpt-4",
  435. "gpt-4-0613",
  436. "gpt-4-32k",
  437. "gpt-4-32k-0613",
  438. "gpt-4-turbo",
  439. "gpt-4-turbo-preview",
  440. "gpt-4.1",
  441. "gpt-4.1-2025-04-14",
  442. "gpt-4.1-mini",
  443. "gpt-4.1-mini-2025-04-14",
  444. "gpt-4.1-nano",
  445. "gpt-4.1-nano-2025-04-14",
  446. "gpt-4.5-preview",
  447. "gpt-4.5-preview-2025-02-27",
  448. "gpt-4o",
  449. "gpt-4o-2024-05-13",
  450. "gpt-4o-2024-08-06",
  451. "gpt-4o-2024-11-20",
  452. "chatgpt-4o-latest",
  453. "gpt-4o-mini",
  454. "gpt-4o-mini-2024-07-18",
  455. "gpt-4-vision-preview",
  456. "gpt-4-turbo-2024-04-09",
  457. "gpt-4-1106-preview",
  458. "dall-e-3",
  459. "o1-mini",
  460. "o1-preview",
  461. "o3-mini",
  462. "o3",
  463. "o4-mini",
  464. ];
  465. const googleModels = [
  466. "gemini-1.5-pro-latest",
  467. "gemini-1.5-pro",
  468. "gemini-1.5-pro-002",
  469. "gemini-1.5-flash-latest",
  470. "gemini-1.5-flash-8b-latest",
  471. "gemini-1.5-flash",
  472. "gemini-1.5-flash-8b",
  473. "gemini-1.5-flash-002",
  474. "learnlm-1.5-pro-experimental",
  475. "gemini-exp-1206",
  476. "gemini-2.0-flash",
  477. "gemini-2.0-flash-exp",
  478. "gemini-2.0-flash-lite-preview-02-05",
  479. "gemini-2.0-flash-thinking-exp",
  480. "gemini-2.0-flash-thinking-exp-1219",
  481. "gemini-2.0-flash-thinking-exp-01-21",
  482. "gemini-2.0-pro-exp",
  483. "gemini-2.0-pro-exp-02-05",
  484. "gemini-2.5-pro-preview-06-05",
  485. "gemini-2.5-pro"
  486. ];
  487. const anthropicModels = [
  488. "claude-instant-1.2",
  489. "claude-2.0",
  490. "claude-2.1",
  491. "claude-3-sonnet-20240229",
  492. "claude-3-opus-20240229",
  493. "claude-3-opus-latest",
  494. "claude-3-haiku-20240307",
  495. "claude-3-5-haiku-20241022",
  496. "claude-3-5-haiku-latest",
  497. "claude-3-5-sonnet-20240620",
  498. "claude-3-5-sonnet-20241022",
  499. "claude-3-5-sonnet-latest",
  500. "claude-3-7-sonnet-20250219",
  501. "claude-3-7-sonnet-latest",
  502. "claude-sonnet-4-20250514",
  503. "claude-opus-4-20250514",
  504. ];
  505. const baiduModels = [
  506. "ernie-4.0-turbo-8k",
  507. "ernie-4.0-8k",
  508. "ernie-4.0-8k-preview",
  509. "ernie-4.0-8k-preview-0518",
  510. "ernie-4.0-8k-latest",
  511. "ernie-3.5-8k",
  512. "ernie-3.5-8k-0205",
  513. "ernie-speed-128k",
  514. "ernie-speed-8k",
  515. "ernie-lite-8k",
  516. "ernie-tiny-8k",
  517. ];
  518. const bytedanceModels = [
  519. "Doubao-lite-4k",
  520. "Doubao-lite-32k",
  521. "Doubao-lite-128k",
  522. "Doubao-pro-4k",
  523. "Doubao-pro-32k",
  524. "Doubao-pro-128k",
  525. ];
  526. const alibabaModes = [
  527. "qwen-turbo",
  528. "qwen-plus",
  529. "qwen-max",
  530. "qwen-max-0428",
  531. "qwen-max-0403",
  532. "qwen-max-0107",
  533. "qwen-max-longcontext",
  534. "qwen-omni-turbo",
  535. "qwen-vl-plus",
  536. "qwen-vl-max",
  537. ];
  538. const tencentModels = [
  539. "hunyuan-pro",
  540. "hunyuan-standard",
  541. "hunyuan-lite",
  542. "hunyuan-role",
  543. "hunyuan-functioncall",
  544. "hunyuan-code",
  545. "hunyuan-vision",
  546. ];
  547. const moonshotModes = [
  548. "moonshot-v1-auto",
  549. "moonshot-v1-8k",
  550. "moonshot-v1-32k",
  551. "moonshot-v1-128k",
  552. "moonshot-v1-8k-vision-preview",
  553. "moonshot-v1-32k-vision-preview",
  554. "moonshot-v1-128k-vision-preview",
  555. "kimi-thinking-preview",
  556. "kimi-k2-0711-preview",
  557. "kimi-latest",
  558. ];
  559. const iflytekModels = [
  560. "general",
  561. "generalv3",
  562. "pro-128k",
  563. "generalv3.5",
  564. "4.0Ultra",
  565. ];
  566. const deepseekModels = ["deepseek-chat", "deepseek-coder", "deepseek-reasoner"];
  567. const xAIModes = [
  568. "grok-beta",
  569. "grok-2",
  570. "grok-2-1212",
  571. "grok-2-latest",
  572. "grok-vision-beta",
  573. "grok-2-vision-1212",
  574. "grok-2-vision",
  575. "grok-2-vision-latest",
  576. "grok-3-mini-fast-beta",
  577. "grok-3-mini-fast",
  578. "grok-3-mini-fast-latest",
  579. "grok-3-mini-beta",
  580. "grok-3-mini",
  581. "grok-3-mini-latest",
  582. "grok-3-fast-beta",
  583. "grok-3-fast",
  584. "grok-3-fast-latest",
  585. "grok-3-beta",
  586. "grok-3",
  587. "grok-3-latest",
  588. ];
  589. const chatglmModels = [
  590. "glm-4-plus",
  591. "glm-4-0520",
  592. "glm-4",
  593. "glm-4-air",
  594. "glm-4-airx",
  595. "glm-4-long",
  596. "glm-4-flashx",
  597. "glm-4-flash",
  598. "glm-4v-plus",
  599. "glm-4v",
  600. "glm-4v-flash", // free
  601. "cogview-3-plus",
  602. "cogview-3",
  603. "cogview-3-flash", // free
  604. // 目前无法适配轮询任务
  605. // "cogvideox",
  606. // "cogvideox-flash", // free
  607. ];
  608. const siliconflowModels = [
  609. "Qwen/Qwen2.5-7B-Instruct",
  610. "Qwen/Qwen2.5-72B-Instruct",
  611. "deepseek-ai/DeepSeek-R1",
  612. "deepseek-ai/DeepSeek-R1-Distill-Llama-70B",
  613. "deepseek-ai/DeepSeek-R1-Distill-Llama-8B",
  614. "deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B",
  615. "deepseek-ai/DeepSeek-R1-Distill-Qwen-14B",
  616. "deepseek-ai/DeepSeek-R1-Distill-Qwen-32B",
  617. "deepseek-ai/DeepSeek-R1-Distill-Qwen-7B",
  618. "deepseek-ai/DeepSeek-V3",
  619. "meta-llama/Llama-3.3-70B-Instruct",
  620. "THUDM/glm-4-9b-chat",
  621. "Pro/deepseek-ai/DeepSeek-R1",
  622. "Pro/deepseek-ai/DeepSeek-V3",
  623. ];
  624. const ai302Models = [
  625. "deepseek-chat",
  626. "gpt-4o",
  627. "chatgpt-4o-latest",
  628. "llama3.3-70b",
  629. "deepseek-reasoner",
  630. "gemini-2.0-flash",
  631. "claude-3-7-sonnet-20250219",
  632. "claude-3-7-sonnet-latest",
  633. "grok-3-beta",
  634. "grok-3-mini-beta",
  635. "gpt-4.1",
  636. "gpt-4.1-mini",
  637. "o3",
  638. "o4-mini",
  639. "qwen3-235b-a22b",
  640. "qwen3-32b",
  641. "gemini-2.5-pro-preview-05-06",
  642. "llama-4-maverick",
  643. "gemini-2.5-flash",
  644. "claude-sonnet-4-20250514",
  645. "claude-opus-4-20250514",
  646. "gemini-2.5-pro",
  647. ];
  648. let seq = 1000; // 内置的模型序号生成器从1000开始
  649. export const DEFAULT_MODELS = [
  650. ...openaiModels.map((name) => ({
  651. name,
  652. available: true,
  653. sorted: seq++, // Global sequence sort(index)
  654. provider: {
  655. id: "openai",
  656. providerName: "OpenAI",
  657. providerType: "openai",
  658. sorted: 1, // 这里是固定的,确保顺序与之前内置的版本一致
  659. },
  660. })),
  661. ...openaiModels.map((name) => ({
  662. name,
  663. available: true,
  664. sorted: seq++,
  665. provider: {
  666. id: "azure",
  667. providerName: "Azure",
  668. providerType: "azure",
  669. sorted: 2,
  670. },
  671. })),
  672. ...googleModels.map((name) => ({
  673. name,
  674. available: true,
  675. sorted: seq++,
  676. provider: {
  677. id: "google",
  678. providerName: "Google",
  679. providerType: "google",
  680. sorted: 3,
  681. },
  682. })),
  683. ...anthropicModels.map((name) => ({
  684. name,
  685. available: true,
  686. sorted: seq++,
  687. provider: {
  688. id: "anthropic",
  689. providerName: "Anthropic",
  690. providerType: "anthropic",
  691. sorted: 4,
  692. },
  693. })),
  694. ...baiduModels.map((name) => ({
  695. name,
  696. available: true,
  697. sorted: seq++,
  698. provider: {
  699. id: "baidu",
  700. providerName: "Baidu",
  701. providerType: "baidu",
  702. sorted: 5,
  703. },
  704. })),
  705. ...bytedanceModels.map((name) => ({
  706. name,
  707. available: true,
  708. sorted: seq++,
  709. provider: {
  710. id: "bytedance",
  711. providerName: "ByteDance",
  712. providerType: "bytedance",
  713. sorted: 6,
  714. },
  715. })),
  716. ...alibabaModes.map((name) => ({
  717. name,
  718. available: true,
  719. sorted: seq++,
  720. provider: {
  721. id: "alibaba",
  722. providerName: "Alibaba",
  723. providerType: "alibaba",
  724. sorted: 7,
  725. },
  726. })),
  727. ...tencentModels.map((name) => ({
  728. name,
  729. available: true,
  730. sorted: seq++,
  731. provider: {
  732. id: "tencent",
  733. providerName: "Tencent",
  734. providerType: "tencent",
  735. sorted: 8,
  736. },
  737. })),
  738. ...moonshotModes.map((name) => ({
  739. name,
  740. available: true,
  741. sorted: seq++,
  742. provider: {
  743. id: "moonshot",
  744. providerName: "Moonshot",
  745. providerType: "moonshot",
  746. sorted: 9,
  747. },
  748. })),
  749. ...iflytekModels.map((name) => ({
  750. name,
  751. available: true,
  752. sorted: seq++,
  753. provider: {
  754. id: "iflytek",
  755. providerName: "Iflytek",
  756. providerType: "iflytek",
  757. sorted: 10,
  758. },
  759. })),
  760. ...xAIModes.map((name) => ({
  761. name,
  762. available: true,
  763. sorted: seq++,
  764. provider: {
  765. id: "xai",
  766. providerName: "XAI",
  767. providerType: "xai",
  768. sorted: 11,
  769. },
  770. })),
  771. ...chatglmModels.map((name) => ({
  772. name,
  773. available: true,
  774. sorted: seq++,
  775. provider: {
  776. id: "chatglm",
  777. providerName: "ChatGLM",
  778. providerType: "chatglm",
  779. sorted: 12,
  780. },
  781. })),
  782. ...deepseekModels.map((name) => ({
  783. name,
  784. available: true,
  785. sorted: seq++,
  786. provider: {
  787. id: "deepseek",
  788. providerName: "DeepSeek",
  789. providerType: "deepseek",
  790. sorted: 13,
  791. },
  792. })),
  793. ...siliconflowModels.map((name) => ({
  794. name,
  795. available: true,
  796. sorted: seq++,
  797. provider: {
  798. id: "siliconflow",
  799. providerName: "SiliconFlow",
  800. providerType: "siliconflow",
  801. sorted: 14,
  802. },
  803. })),
  804. ...ai302Models.map((name) => ({
  805. name,
  806. available: true,
  807. sorted: seq++,
  808. provider: {
  809. id: "ai302",
  810. providerName: "302.AI",
  811. providerType: "ai302",
  812. sorted: 15,
  813. },
  814. })),
  815. ] as const;
  816. export const CHAT_PAGE_SIZE = 15;
  817. export const MAX_RENDER_MSG_COUNT = 45;
  818. // some famous webdav endpoints
  819. export const internalAllowedWebDavEndpoints = [
  820. "https://dav.jianguoyun.com/dav/",
  821. "https://dav.dropdav.com/",
  822. "https://dav.box.com/dav",
  823. "https://nanao.teracloud.jp/dav/",
  824. "https://bora.teracloud.jp/dav/",
  825. "https://webdav.4shared.com/",
  826. "https://dav.idrivesync.com",
  827. "https://webdav.yandex.com",
  828. "https://app.koofr.net/dav/Koofr",
  829. ];
  830. export const DEFAULT_GA_ID = "G-89WN60ZK2E";
  831. export const SAAS_CHAT_URL = "https://nextchat.club";
  832. export const SAAS_CHAT_UTM_URL = "https://nextchat.club?utm=github";