constant.ts 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  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-4-vision-preview": "2023-04",
  109. // After improvements,
  110. // it's now easier to add "KnowledgeCutOffDate" instead of stupid hardcoding it, as was done previously.
  111. "gemini-pro": "2023-12",
  112. "gemini-pro-vision": "2023-12",
  113. };
  114. const openaiModels = [
  115. "gpt-3.5-turbo",
  116. "gpt-3.5-turbo-1106",
  117. "gpt-3.5-turbo-0125",
  118. "gpt-4",
  119. "gpt-4-0613",
  120. "gpt-4-32k",
  121. "gpt-4-32k-0613",
  122. "gpt-4-turbo",
  123. "gpt-4-turbo-preview",
  124. "gpt-4-vision-preview",
  125. "gpt-4-turbo-2024-04-09",
  126. ];
  127. const googleModels = [
  128. "gemini-1.0-pro",
  129. "gemini-1.5-pro-latest",
  130. "gemini-1.5-flash-latest",
  131. "gemini-pro-vision",
  132. ];
  133. const anthropicModels = [
  134. "claude-instant-1.2",
  135. "claude-2.0",
  136. "claude-2.1",
  137. "claude-3-sonnet-20240229",
  138. "claude-3-opus-20240229",
  139. "claude-3-haiku-20240307",
  140. ];
  141. export const DEFAULT_MODELS = [
  142. ...openaiModels.map((name) => ({
  143. name,
  144. available: true,
  145. provider: {
  146. id: "openai",
  147. providerName: "OpenAI",
  148. providerType: "openai",
  149. },
  150. })),
  151. ...googleModels.map((name) => ({
  152. name,
  153. available: true,
  154. provider: {
  155. id: "google",
  156. providerName: "Google",
  157. providerType: "google",
  158. },
  159. })),
  160. ...anthropicModels.map((name) => ({
  161. name,
  162. available: true,
  163. provider: {
  164. id: "anthropic",
  165. providerName: "Anthropic",
  166. providerType: "anthropic",
  167. },
  168. })),
  169. ] as const;
  170. export const CHAT_PAGE_SIZE = 15;
  171. export const MAX_RENDER_MSG_COUNT = 45;
  172. // some famous webdav endpoints
  173. export const internalAllowedWebDavEndpoints = [
  174. "https://dav.jianguoyun.com/dav/",
  175. "https://dav.dropdav.com/",
  176. "https://dav.box.com/dav",
  177. "https://nanao.teracloud.jp/dav/",
  178. "https://webdav.4shared.com/",
  179. "https://dav.idrivesync.com",
  180. "https://webdav.yandex.com",
  181. "https://app.koofr.net/dav/Koofr",
  182. ];