constant.ts 20 KB

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