constant.ts 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. export const OWNER = "Yidadaa";
  2. export const REPO = "ChatGPT-Next-Web";
  3. export const REPO_URL = `https://github.com/${OWNER}/${REPO}`;
  4. export const ISSUE_URL = `https://github.com/${OWNER}/${REPO}/issues`;
  5. export const UPDATE_URL = `${REPO_URL}#keep-updated`;
  6. export const RELEASE_URL = `${REPO_URL}/releases`;
  7. export const FETCH_COMMIT_URL = `https://api.github.com/repos/${OWNER}/${REPO}/commits?per_page=1`;
  8. export const FETCH_TAG_URL = `https://api.github.com/repos/${OWNER}/${REPO}/tags?per_page=1`;
  9. export const RUNTIME_CONFIG_DOM = "danger-runtime-config";
  10. export const DEFAULT_API_HOST = "https://api.nextchat.dev";
  11. export const OPENAI_BASE_URL = "https://api.openai.com";
  12. export const ANTHROPIC_BASE_URL = "https://api.anthropic.com";
  13. export const GEMINI_BASE_URL = "https://generativelanguage.googleapis.com/";
  14. export enum Path {
  15. Home = "/",
  16. Chat = "/chat",
  17. Settings = "/settings",
  18. NewChat = "/new-chat",
  19. Masks = "/masks",
  20. Auth = "/auth",
  21. }
  22. export enum ApiPath {
  23. Cors = "",
  24. OpenAI = "/api/openai",
  25. Anthropic = "/api/anthropic",
  26. }
  27. export enum SlotID {
  28. AppBody = "app-body",
  29. CustomModel = "custom-model",
  30. }
  31. export enum FileName {
  32. Masks = "masks.json",
  33. Prompts = "prompts.json",
  34. }
  35. export enum StoreKey {
  36. Chat = "chat-next-web-store",
  37. Access = "access-control",
  38. Config = "app-config",
  39. Mask = "mask-store",
  40. Prompt = "prompt-store",
  41. Update = "chat-update",
  42. Sync = "sync",
  43. }
  44. export const DEFAULT_SIDEBAR_WIDTH = 300;
  45. export const MAX_SIDEBAR_WIDTH = 500;
  46. export const MIN_SIDEBAR_WIDTH = 230;
  47. export const NARROW_SIDEBAR_WIDTH = 100;
  48. export const ACCESS_CODE_PREFIX = "nk-";
  49. export const LAST_INPUT_KEY = "last-input";
  50. export const UNFINISHED_INPUT = (id: string) => "unfinished-input-" + id;
  51. export const STORAGE_KEY = "chatgpt-next-web";
  52. export const REQUEST_TIMEOUT_MS = 60000;
  53. export const EXPORT_MESSAGE_CLASS_NAME = "export-markdown";
  54. export enum ServiceProvider {
  55. OpenAI = "OpenAI",
  56. Azure = "Azure",
  57. Google = "Google",
  58. Anthropic = "Anthropic",
  59. }
  60. export enum ModelProvider {
  61. GPT = "GPT",
  62. GeminiPro = "GeminiPro",
  63. Claude = "Claude",
  64. }
  65. export const Anthropic = {
  66. ChatPath: "v1/messages",
  67. ChatPath1: "v1/complete",
  68. ExampleEndpoint: "https://api.anthropic.com",
  69. Vision: "2023-06-01",
  70. };
  71. export const OpenaiPath = {
  72. ChatPath: "v1/chat/completions",
  73. UsagePath: "dashboard/billing/usage",
  74. SubsPath: "dashboard/billing/subscription",
  75. ListModelPath: "v1/models",
  76. };
  77. export const Azure = {
  78. ExampleEndpoint: "https://{resource-url}/openai/deployments/{deploy-id}",
  79. };
  80. export const Google = {
  81. ExampleEndpoint: "https://generativelanguage.googleapis.com/",
  82. ChatPath: (modelName: string) => `v1beta/models/${modelName}:generateContent`,
  83. };
  84. export const DEFAULT_INPUT_TEMPLATE = `{{input}}`; // input / time / model / lang
  85. // export const DEFAULT_SYSTEM_TEMPLATE = `
  86. // You are ChatGPT, a large language model trained by {{ServiceProvider}}.
  87. // Knowledge cutoff: {{cutoff}}
  88. // Current model: {{model}}
  89. // Current time: {{time}}
  90. // Latex inline: $x^2$
  91. // Latex block: $$e=mc^2$$
  92. // `;
  93. export const DEFAULT_SYSTEM_TEMPLATE = `
  94. You are ChatGPT, a large language model trained by {{ServiceProvider}}.
  95. Knowledge cutoff: {{cutoff}}
  96. Current model: {{model}}
  97. Current time: {{time}}
  98. Latex inline: \\(x^2\\)
  99. Latex block: $$e=mc^2$$
  100. `;
  101. export const SUMMARIZE_MODEL = "gpt-3.5-turbo";
  102. export const GEMINI_SUMMARIZE_MODEL = "gemini-pro";
  103. export const KnowledgeCutOffDate: Record<string, string> = {
  104. default: "2021-09",
  105. "gpt-4-turbo": "2023-12",
  106. "gpt-4-turbo-2024-04-09": "2023-12",
  107. "gpt-4-turbo-preview": "2023-12",
  108. "gpt-4o": "2023-10",
  109. "gpt-4o-2024-05-13": "2023-10",
  110. "gpt-4-vision-preview": "2023-04",
  111. // After improvements,
  112. // it's now easier to add "KnowledgeCutOffDate" instead of stupid hardcoding it, as was done previously.
  113. "gemini-pro": "2023-12",
  114. "gemini-pro-vision": "2023-12",
  115. };
  116. const openaiModels = [
  117. "gpt-3.5-turbo",
  118. "gpt-3.5-turbo-1106",
  119. "gpt-3.5-turbo-0125",
  120. "gpt-4",
  121. "gpt-4-0613",
  122. "gpt-4-32k",
  123. "gpt-4-32k-0613",
  124. "gpt-4-turbo",
  125. "gpt-4-turbo-preview",
  126. "gpt-4o",
  127. "gpt-4o-2024-05-13",
  128. "gpt-4-vision-preview",
  129. "gpt-4-turbo-2024-04-09",
  130. ];
  131. const googleModels = [
  132. "gemini-1.0-pro",
  133. "gemini-1.5-pro-latest",
  134. "gemini-1.5-flash-latest",
  135. "gemini-pro-vision",
  136. ];
  137. const anthropicModels = [
  138. "claude-instant-1.2",
  139. "claude-2.0",
  140. "claude-2.1",
  141. "claude-3-sonnet-20240229",
  142. "claude-3-opus-20240229",
  143. "claude-3-haiku-20240307",
  144. ];
  145. export const DEFAULT_MODELS = [
  146. ...openaiModels.map((name) => ({
  147. name,
  148. available: true,
  149. provider: {
  150. id: "openai",
  151. providerName: "OpenAI",
  152. providerType: "openai",
  153. },
  154. })),
  155. ...googleModels.map((name) => ({
  156. name,
  157. available: true,
  158. provider: {
  159. id: "google",
  160. providerName: "Google",
  161. providerType: "google",
  162. },
  163. })),
  164. ...anthropicModels.map((name) => ({
  165. name,
  166. available: true,
  167. provider: {
  168. id: "anthropic",
  169. providerName: "Anthropic",
  170. providerType: "anthropic",
  171. },
  172. })),
  173. ] as const;
  174. export const CHAT_PAGE_SIZE = 15;
  175. export const MAX_RENDER_MSG_COUNT = 45;
  176. // some famous webdav endpoints
  177. export const internalAllowedWebDavEndpoints = [
  178. "https://dav.jianguoyun.com/dav/",
  179. "https://dav.dropdav.com/",
  180. "https://dav.box.com/dav",
  181. "https://nanao.teracloud.jp/dav/",
  182. "https://webdav.4shared.com/",
  183. "https://dav.idrivesync.com",
  184. "https://webdav.yandex.com",
  185. "https://app.koofr.net/dav/Koofr",
  186. ];