Browse Source

基本搞定有的问题

tuonian 1 year ago
parent
commit
f34f767881
7 changed files with 59 additions and 5 deletions
  1. 5 3
      .env.development
  2. 48 0
      .env.production
  3. 1 1
      .env.template
  4. 1 0
      app/api/config/route.ts
  5. 2 0
      app/config/server.ts
  6. 1 0
      next.config.mjs
  7. 1 1
      package.json

+ 5 - 3
.env.development

@@ -1,9 +1,11 @@
 
+BASE_PATH=/chat
+
 # Your openai api key. (required)
 OPENAI_API_KEY=sk-xxxx
 
 # Access passsword, separated by comma. (optional)
-CODE=qwer@1234
+CODE=
 
 # You can start service behind a proxy
 PROXY_URL=http://10.10.0.6:13123
@@ -11,8 +13,8 @@ PROXY_URL=http://10.10.0.6:13123
 # Override openai api request base url. (optional)
 # Default: https://api.openai.com
 # Examples: http://your-openai-proxy.com
-#BASE_URL=http://10.10.0.1:20003/
-BASE_URL=http://10.10.0.2:20003/
+BASE_URL=http://10.10.0.1:20003/
+#BASE_URL=http://10.10.0.2:20003/
 
 # Specify OpenAI organization ID.(optional)
 # Default: Empty

+ 48 - 0
.env.production

@@ -0,0 +1,48 @@
+# ContextPath
+
+BASE_PATH=/chat
+
+# Your openai api key. (required)
+OPENAI_API_KEY=sk-xxxx
+
+# Access passsword, separated by comma. (optional)
+CODE=
+
+# You can start service behind a proxy
+PROXY_URL=http://10.10.0.6:13123
+
+# Override openai api request base url. (optional)
+# Default: https://api.openai.com
+# Examples: http://your-openai-proxy.com
+BASE_URL=http://10.10.0.1:20003/
+#BASE_URL=http://10.10.0.2:20003/
+
+# Specify OpenAI organization ID.(optional)
+# Default: Empty
+OPENAI_ORG_ID=
+
+# (optional)
+# Default: Empty
+# If you do not want users to use GPT-4, set this value to 1.
+DISABLE_GPT4=
+
+# (optional)
+# Default: Empty
+# If you do not want users to input their own API key, set this value to 1.
+HIDE_USER_API_KEY=1
+
+# (optional)
+# Default: Empty
+# If you do want users to query balance, set this value to 1.
+ENABLE_BALANCE_QUERY=
+
+# (optional)
+# Default: Empty
+# If you want to disable parse settings from url, set this value to 1.
+DISABLE_FAST_LINK=
+
+OAUTH_CLIENT_ID=496e8739b88e42b2a0d485b0087b5d49
+OAUTH_CLIENT_SECRET=73f5c7cc7cd84b1c84542870b473464a
+OAUTH_REDIRECT_URI=https://www.tonyandmoney.cn/chat/
+OAUTH_AUTHORIZE_ENDPOINT=https://www.tonyandmoney.cn/oauth/authorize
+OAUTH_USERINFO=https://api.tonyandmoney.cn/oauth/user

+ 1 - 1
.env.template

@@ -1,4 +1,4 @@
-
+BASE_PATH=
 # Your openai api key. (required)
 OPENAI_API_KEY=sk-xxxx
 

+ 1 - 0
app/api/config/route.ts

@@ -13,6 +13,7 @@ const DANGER_CONFIG = {
   hideBalanceQuery: serverConfig.hideBalanceQuery,
   disableFastLink: serverConfig.disableFastLink,
   customModels: serverConfig.customModels,
+  baseApi: serverConfig.baseApi,
 };
 
 declare global {

+ 2 - 0
app/config/server.ts

@@ -4,6 +4,7 @@ import { DEFAULT_MODELS } from "../constant";
 declare global {
   namespace NodeJS {
     interface ProcessEnv {
+      BASE_PATH?: string;
       PROXY_URL?: string; // docker only
 
       OPENAI_API_KEY?: string;
@@ -77,6 +78,7 @@ export const getServerSideConfig = () => {
   );
 
   return {
+    baseApi: process.env.BASE_PATH,
     baseUrl: process.env.BASE_URL,
     apiKey,
     openaiOrgId: process.env.OPENAI_ORG_ID,

+ 1 - 0
next.config.mjs

@@ -8,6 +8,7 @@ console.log("[Next] build with chunk: ", !disableChunk);
 
 /** @type {import('next').NextConfig} */
 const nextConfig = {
+  basePath: process.env.BASE_PATH ?? '/',
   webpack(config) {
     config.module.rules.push({
       test: /\.svg$/,

+ 1 - 1
package.json

@@ -1,5 +1,5 @@
 {
-  "name": "chatgpt-next-web",
+  "name": "chat-ai",
   "private": false,
   "license": "mit",
   "scripts": {