constant.ts 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802
  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-exp",
  442. "gemini-2.0-flash-thinking-exp",
  443. "gemini-2.0-flash-thinking-exp-1219",
  444. "gemini-2.0-flash-thinking-exp-01-21",
  445. ];
  446. const anthropicModels = [
  447. "claude-instant-1.2",
  448. "claude-2.0",
  449. "claude-2.1",
  450. "claude-3-sonnet-20240229",
  451. "claude-3-opus-20240229",
  452. "claude-3-opus-latest",
  453. "claude-3-haiku-20240307",
  454. "claude-3-5-haiku-20241022",
  455. "claude-3-5-haiku-latest",
  456. "claude-3-5-sonnet-20240620",
  457. "claude-3-5-sonnet-20241022",
  458. "claude-3-5-sonnet-latest",
  459. ];
  460. const baiduModels = [
  461. "ernie-4.0-turbo-8k",
  462. "ernie-4.0-8k",
  463. "ernie-4.0-8k-preview",
  464. "ernie-4.0-8k-preview-0518",
  465. "ernie-4.0-8k-latest",
  466. "ernie-3.5-8k",
  467. "ernie-3.5-8k-0205",
  468. "ernie-speed-128k",
  469. "ernie-speed-8k",
  470. "ernie-lite-8k",
  471. "ernie-tiny-8k",
  472. ];
  473. const bytedanceModels = [
  474. "Doubao-lite-4k",
  475. "Doubao-lite-32k",
  476. "Doubao-lite-128k",
  477. "Doubao-pro-4k",
  478. "Doubao-pro-32k",
  479. "Doubao-pro-128k",
  480. ];
  481. const alibabaModes = [
  482. "qwen-turbo",
  483. "qwen-plus",
  484. "qwen-max",
  485. "qwen-max-0428",
  486. "qwen-max-0403",
  487. "qwen-max-0107",
  488. "qwen-max-longcontext",
  489. ];
  490. const tencentModels = [
  491. "hunyuan-pro",
  492. "hunyuan-standard",
  493. "hunyuan-lite",
  494. "hunyuan-role",
  495. "hunyuan-functioncall",
  496. "hunyuan-code",
  497. "hunyuan-vision",
  498. ];
  499. const moonshotModes = ["moonshot-v1-8k", "moonshot-v1-32k", "moonshot-v1-128k"];
  500. const iflytekModels = [
  501. "general",
  502. "generalv3",
  503. "pro-128k",
  504. "generalv3.5",
  505. "4.0Ultra",
  506. ];
  507. const deepseekModels = ["deepseek-chat", "deepseek-coder", "deepseek-reasoner"];
  508. const xAIModes = ["grok-beta"];
  509. const chatglmModels = [
  510. "glm-4-plus",
  511. "glm-4-0520",
  512. "glm-4",
  513. "glm-4-air",
  514. "glm-4-airx",
  515. "glm-4-long",
  516. "glm-4-flashx",
  517. "glm-4-flash",
  518. "glm-4v-plus",
  519. "glm-4v",
  520. "glm-4v-flash", // free
  521. "cogview-3-plus",
  522. "cogview-3",
  523. "cogview-3-flash", // free
  524. // 目前无法适配轮询任务
  525. // "cogvideox",
  526. // "cogvideox-flash", // free
  527. ];
  528. const siliconflowModels = [
  529. "Qwen/Qwen2.5-7B-Instruct",
  530. "Qwen/Qwen2.5-72B-Instruct",
  531. "deepseek-ai/DeepSeek-R1",
  532. "deepseek-ai/DeepSeek-R1-Distill-Llama-70B",
  533. "deepseek-ai/DeepSeek-R1-Distill-Llama-8B",
  534. "deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B",
  535. "deepseek-ai/DeepSeek-R1-Distill-Qwen-14B",
  536. "deepseek-ai/DeepSeek-R1-Distill-Qwen-32B",
  537. "deepseek-ai/DeepSeek-R1-Distill-Qwen-7B",
  538. "deepseek-ai/DeepSeek-V3",
  539. "meta-llama/Llama-3.3-70B-Instruct",
  540. "THUDM/glm-4-9b-chat",
  541. ];
  542. let seq = 1000; // 内置的模型序号生成器从1000开始
  543. export const DEFAULT_MODELS = [
  544. ...openaiModels.map((name) => ({
  545. name,
  546. available: true,
  547. sorted: seq++, // Global sequence sort(index)
  548. provider: {
  549. id: "openai",
  550. providerName: "OpenAI",
  551. providerType: "openai",
  552. sorted: 1, // 这里是固定的,确保顺序与之前内置的版本一致
  553. },
  554. })),
  555. ...openaiModels.map((name) => ({
  556. name,
  557. available: true,
  558. sorted: seq++,
  559. provider: {
  560. id: "azure",
  561. providerName: "Azure",
  562. providerType: "azure",
  563. sorted: 2,
  564. },
  565. })),
  566. ...googleModels.map((name) => ({
  567. name,
  568. available: true,
  569. sorted: seq++,
  570. provider: {
  571. id: "google",
  572. providerName: "Google",
  573. providerType: "google",
  574. sorted: 3,
  575. },
  576. })),
  577. ...anthropicModels.map((name) => ({
  578. name,
  579. available: true,
  580. sorted: seq++,
  581. provider: {
  582. id: "anthropic",
  583. providerName: "Anthropic",
  584. providerType: "anthropic",
  585. sorted: 4,
  586. },
  587. })),
  588. ...baiduModels.map((name) => ({
  589. name,
  590. available: true,
  591. sorted: seq++,
  592. provider: {
  593. id: "baidu",
  594. providerName: "Baidu",
  595. providerType: "baidu",
  596. sorted: 5,
  597. },
  598. })),
  599. ...bytedanceModels.map((name) => ({
  600. name,
  601. available: true,
  602. sorted: seq++,
  603. provider: {
  604. id: "bytedance",
  605. providerName: "ByteDance",
  606. providerType: "bytedance",
  607. sorted: 6,
  608. },
  609. })),
  610. ...alibabaModes.map((name) => ({
  611. name,
  612. available: true,
  613. sorted: seq++,
  614. provider: {
  615. id: "alibaba",
  616. providerName: "Alibaba",
  617. providerType: "alibaba",
  618. sorted: 7,
  619. },
  620. })),
  621. ...tencentModels.map((name) => ({
  622. name,
  623. available: true,
  624. sorted: seq++,
  625. provider: {
  626. id: "tencent",
  627. providerName: "Tencent",
  628. providerType: "tencent",
  629. sorted: 8,
  630. },
  631. })),
  632. ...moonshotModes.map((name) => ({
  633. name,
  634. available: true,
  635. sorted: seq++,
  636. provider: {
  637. id: "moonshot",
  638. providerName: "Moonshot",
  639. providerType: "moonshot",
  640. sorted: 9,
  641. },
  642. })),
  643. ...iflytekModels.map((name) => ({
  644. name,
  645. available: true,
  646. sorted: seq++,
  647. provider: {
  648. id: "iflytek",
  649. providerName: "Iflytek",
  650. providerType: "iflytek",
  651. sorted: 10,
  652. },
  653. })),
  654. ...xAIModes.map((name) => ({
  655. name,
  656. available: true,
  657. sorted: seq++,
  658. provider: {
  659. id: "xai",
  660. providerName: "XAI",
  661. providerType: "xai",
  662. sorted: 11,
  663. },
  664. })),
  665. ...chatglmModels.map((name) => ({
  666. name,
  667. available: true,
  668. sorted: seq++,
  669. provider: {
  670. id: "chatglm",
  671. providerName: "ChatGLM",
  672. providerType: "chatglm",
  673. sorted: 12,
  674. },
  675. })),
  676. ...deepseekModels.map((name) => ({
  677. name,
  678. available: true,
  679. sorted: seq++,
  680. provider: {
  681. id: "deepseek",
  682. providerName: "DeepSeek",
  683. providerType: "deepseek",
  684. sorted: 13,
  685. },
  686. })),
  687. ...siliconflowModels.map((name) => ({
  688. name,
  689. available: true,
  690. sorted: seq++,
  691. provider: {
  692. id: "siliconflow",
  693. providerName: "SiliconFlow",
  694. providerType: "siliconflow",
  695. sorted: 14,
  696. },
  697. })),
  698. ] as const;
  699. export const CHAT_PAGE_SIZE = 15;
  700. export const MAX_RENDER_MSG_COUNT = 45;
  701. // some famous webdav endpoints
  702. export const internalAllowedWebDavEndpoints = [
  703. "https://dav.jianguoyun.com/dav/",
  704. "https://dav.dropdav.com/",
  705. "https://dav.box.com/dav",
  706. "https://nanao.teracloud.jp/dav/",
  707. "https://bora.teracloud.jp/dav/",
  708. "https://webdav.4shared.com/",
  709. "https://dav.idrivesync.com",
  710. "https://webdav.yandex.com",
  711. "https://app.koofr.net/dav/Koofr",
  712. ];
  713. export const DEFAULT_GA_ID = "G-89WN60ZK2E";
  714. export const SAAS_CHAT_URL = "https://nextchat.dev/chat";
  715. export const SAAS_CHAT_UTM_URL = "https://nextchat.dev/chat?utm=github";