constant.ts 22 KB

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