constant.ts 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  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-pro-vision",
  135. ];
  136. const anthropicModels = [
  137. "claude-instant-1.2",
  138. "claude-2.0",
  139. "claude-2.1",
  140. "claude-3-sonnet-20240229",
  141. "claude-3-opus-20240229",
  142. "claude-3-haiku-20240307",
  143. ];
  144. export const DEFAULT_MODELS = [
  145. ...openaiModels.map((name) => ({
  146. name,
  147. available: true,
  148. provider: {
  149. id: "openai",
  150. providerName: "OpenAI",
  151. providerType: "openai",
  152. },
  153. })),
  154. ...googleModels.map((name) => ({
  155. name,
  156. available: true,
  157. provider: {
  158. id: "google",
  159. providerName: "Google",
  160. providerType: "google",
  161. },
  162. })),
  163. ...anthropicModels.map((name) => ({
  164. name,
  165. available: true,
  166. provider: {
  167. id: "anthropic",
  168. providerName: "Anthropic",
  169. providerType: "anthropic",
  170. },
  171. })),
  172. ] as const;
  173. export const CHAT_PAGE_SIZE = 15;
  174. export const MAX_RENDER_MSG_COUNT = 45;
  175. // some famous webdav endpoints
  176. export const internalAllowedWebDavEndpoints = [
  177. "https://dav.jianguoyun.com/dav/",
  178. "https://dav.dropdav.com/",
  179. "https://dav.box.com/dav",
  180. "https://nanao.teracloud.jp/dav/",
  181. "https://webdav.4shared.com/",
  182. "https://dav.idrivesync.com",
  183. "https://webdav.yandex.com",
  184. "https://app.koofr.net/dav/Koofr",
  185. ];