constant.ts 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. export const OWNER = "tuonq";
  2. export const REPO = "ChatAI";
  3. export const REPO_URL = `https://git.tonyandmoney.cn/${OWNER}/${REPO}`;
  4. export const ISSUE_URL = `https://git.tonyandmoney.cn/${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://git.tonyandmoney.cn/repos/${OWNER}/${REPO}/commits?per_page=1`;
  8. export const FETCH_TAG_URL = `https://git.tonyandmoney.cn/repos/${OWNER}/${REPO}/tags?per_page=1`;
  9. export const RUNTIME_CONFIG_DOM = "danger-runtime-config";
  10. export const DEFAULT_CORS_HOST = "https://www.tonyandmoney.cn";
  11. export const DEFAULT_API_HOST = `${DEFAULT_CORS_HOST}/api/proxy`;
  12. export const OPENAI_BASE_URL = "https://api.openai.com";
  13. export enum Path {
  14. Home = "/",
  15. Chat = "/chat",
  16. Settings = "/settings",
  17. NewChat = "/new-chat",
  18. Masks = "/masks",
  19. Auth = "/auth",
  20. }
  21. export enum ApiPath {
  22. Cors = "/api/cors",
  23. OpenAI = "/api/openai",
  24. }
  25. export enum SlotID {
  26. AppBody = "app-body",
  27. CustomModel = "custom-model",
  28. }
  29. export enum FileName {
  30. Masks = "masks.json",
  31. Prompts = "prompts.json",
  32. }
  33. export enum StoreKey {
  34. Chat = "chat-next-web-store",
  35. Access = "access-control",
  36. Config = "app-config",
  37. Mask = "mask-store",
  38. Prompt = "prompt-store",
  39. Update = "chat-update",
  40. Sync = "sync",
  41. }
  42. export const DEFAULT_SIDEBAR_WIDTH = 300;
  43. export const MAX_SIDEBAR_WIDTH = 500;
  44. export const MIN_SIDEBAR_WIDTH = 230;
  45. export const NARROW_SIDEBAR_WIDTH = 100;
  46. export const ACCESS_CODE_PREFIX = "nk-";
  47. export const LAST_INPUT_KEY = "last-input";
  48. export const UNFINISHED_INPUT = (id: string) => "unfinished-input-" + id;
  49. export const STORAGE_KEY = "chatgpt-next-web";
  50. export const REQUEST_TIMEOUT_MS = 60000;
  51. export const EXPORT_MESSAGE_CLASS_NAME = "export-markdown";
  52. export enum ServiceProvider {
  53. OpenAI = "OpenAI",
  54. Azure = "Azure",
  55. Oauth = "Oauth",
  56. }
  57. export const OpenaiPath = {
  58. ChatPath: "v1/chat/completions",
  59. UsagePath: "dashboard/billing/usage",
  60. SubsPath: "dashboard/billing/subscription",
  61. ListModelPath: "v1/models",
  62. };
  63. export const Azure = {
  64. ExampleEndpoint: "https://{resource-url}/openai/deployments/{deploy-id}",
  65. };
  66. export const DEFAULT_INPUT_TEMPLATE = `{{input}}`; // input / time / model / lang
  67. export const DEFAULT_SYSTEM_TEMPLATE = `
  68. You are ChatGPT, a large language model trained by OpenAI.
  69. Knowledge cutoff: {{cutoff}}
  70. Current model: {{model}}
  71. Current time: {{time}}
  72. Latex inline: $x^2$
  73. Latex block: $$e=mc^2$$
  74. `;
  75. export const SUMMARIZE_MODEL = "gpt-3.5-turbo";
  76. export const KnowledgeCutOffDate: Record<string, string> = {
  77. default: "2021-09",
  78. "gpt-4-1106-preview": "2023-04",
  79. "gpt-4-vision-preview": "2023-04",
  80. };
  81. export const DEFAULT_MODELS = [
  82. {
  83. name: "gpt-4",
  84. available: true,
  85. },
  86. {
  87. name: "gpt-4-0314",
  88. available: true,
  89. },
  90. {
  91. name: "gpt-4-0613",
  92. available: true,
  93. },
  94. {
  95. name: "gpt-4-32k",
  96. available: true,
  97. },
  98. {
  99. name: "gpt-4-32k-0314",
  100. available: true,
  101. },
  102. {
  103. name: "gpt-4-32k-0613",
  104. available: true,
  105. },
  106. {
  107. name: "gpt-4-1106-preview",
  108. available: true,
  109. },
  110. {
  111. name: "gpt-4-vision-preview",
  112. available: true,
  113. },
  114. {
  115. name: "gpt-3.5-turbo",
  116. available: true,
  117. },
  118. {
  119. name: "gpt-3.5-turbo-0301",
  120. available: true,
  121. },
  122. {
  123. name: "gpt-3.5-turbo-0613",
  124. available: true,
  125. },
  126. {
  127. name: "gpt-3.5-turbo-1106",
  128. available: true,
  129. },
  130. {
  131. name: "gpt-3.5-turbo-16k",
  132. available: true,
  133. },
  134. {
  135. name: "gpt-3.5-turbo-16k-0613",
  136. available: true,
  137. },
  138. ] as const;
  139. export const CHAT_PAGE_SIZE = 15;
  140. export const MAX_RENDER_MSG_COUNT = 45;