Fork this project on GitHub, then log in to dash.cloudflare.com and go to Pages.
Do not use the default "Build command" due to a node:buffer bug. Instead, use the following command:
npx @cloudflare/next-on-pages --experimental-minify
For "Build output directory", use the default value and do not modify it.
Do not modify "Root Directory".
For "Environment variables", click ">" and then "Add variable". Fill in the following information:
NODE_VERSION=20.1NEXT_TELEMETRY_DISABLE=1OPENAI_API_KEY=your_own_API_keyYARN_VERSION=1.22.19PHP_VERSION=7.4Optionally fill in the following based on your needs:
CODE= Optional, access passwords, multiple passwords can be separated by commasOPENAI_ORG_ID= Optional, specify the organization ID in OpenAIHIDE_USER_API_KEY=1 Optional, do not allow users to enter their own API keyDISABLE_GPT4=1 Optional, do not allow users to use GPT-4ENABLE_BALANCE_QUERY=1 Optional, allow users to query balanceDISABLE_FAST_LINK=1 Optional, disable parse settings from urlOPENAI_SB=1 Optional,use the third-party OpenAI-SB APIClick "Save and Deploy".
Click "Cancel deployment" because you need to fill in Compatibility flags.
Go to "Build settings", "Functions", and find "Compatibility flags".
Fill in "nodejs_compat" for both "Configure Production compatibility flag" and "Configure Preview compatibility flag".
Go to "Deployments" and click "Retry deployment".
Enjoy.