0x5E

0x5E

My place for thoughty-like thoughts.
twitter
github

Deploy Your Own ChatGPT

30 minutes to have your own ChatGPT accessible anytime, anywhere.

Extremely fast webpage loading speed, beautiful UI, built-in prompt templates, support for long conversations, support for importing and exporting chat history, rich settings options, support for custom model parameters, compressing historical chat messages (saving token consumption), preset prompts (setting model roles), setting access codes, custom domain names, no need to bypass restrictions to access...

Updated on: December 26, 2023, 15:50

WeChat Screenshot_20231226124215

WeChat Screenshot_20231226124124

Fork the project repository#

Log in to your GitHub account, open the 🔗ChatGPT-Next-Web project homepage, and fork the code repository to your account:

WeChat Screenshot_20231226123840

WeChat Screenshot_20231226123917

If it shows like this, it means the fork was successful ✔️:

WeChat Screenshot_20231226123949

Enable Action permissions#

Enabling this permission allows your forked repository to sync updates with the upstream repository, automatically syncing once a day, and will automatically deploy updates to the website, fully automated~

You can also change the 8th line of your forked repository's .github/workflows/sync.yml file to set your desired sync time; I set it to once an hour.
WeChat Screenshot_20231226125211

Open your forked repository, click Actions, and then click the I understand my workflows, go ahead and enable them button:

WeChat Screenshot_20231226125541

WeChat Screenshot_20231226125747

Click on the left Upstream Sync, and then click the Enable workflow button:

WeChat Screenshot_20231226125927

WeChat Screenshot_20231226125945

If it shows like this, it means Action permissions have been successfully enabled ✔️:

WeChat Screenshot_20231226130109

Deploy to Vercel#

If you don't have an account, go to 🔗register for Vercel, and authorize using GitHub:

WeChat Screenshot_20231226130351

WeChat Screenshot_20231226130406

Then click on the top left to go to your account homepage and create a new project:

WeChat Screenshot_20231226130657

WeChat Screenshot_20231226130736

Click Install:

WeChat Screenshot_20231226131037

WeChat Screenshot_20231226131056

At this point, it has recognized the code repository you just forked; click Import to import:

WeChat Screenshot_20231226131306

Add Environment Variables:

WeChat Screenshot_20231226131819

  • Parameter 1: Required, this is your OpenAI API Key. If you don't have one, go to 🔗create one, provided you have registered for a ChatGPT account and have the free 🔗trial credits in your account, usually $5. If you run out, just create a new account. Alternatively, you can bind a bank card (foreign currency single card) for pay-as-you-go, which will also be faster and more stable.
    Key: OPENAI_API_KEY
    Value: sk-ohtbdhgw……

  • Parameter 2: Recommended, user access code. Multiple access codes should be separated by commas , without spaces.
    Key: CODE
    Value: code1,code2,code3,code4 (just an example, change according to your needs)

For more deployment parameters, see 🔗here

Click Deploy to start the deployment:

WeChat Screenshot_20231226135738

Deploying... please wait 2-3 minutes:

WeChat Screenshot_20231226135955

Congratulations!
Hooray, deployment successful ✔️:

WeChat Screenshot_20231226140225

Click Continue to Dashboard:

WeChat Screenshot_20231226140335

Click Visit, and you can access it~ (since there is no custom domain yet, you still need to bypass restrictions to access it):

WeChat Screenshot_20231226140356

Webpage loaded successfully ✔️:

WeChat Screenshot_20231226140542

Configure Custom Domain Name#

Purchase a Domain Name#

You don't have to buy it on this platform; I chose here because the pure number .xyz domain names are quite cheap.

🔗Register at Name.com and log in. If the page is in English, you can change the language at the bottom of the page:

WeChat Screenshot_20231226141256

🔗Search for the domain name you want, preferably a pure number xyz suffix, which is relatively cheap, for example: 875479.xyz, usually around 7-8 yuan. If the search is too expensive, you can try other numbers. Also, pay attention to the renewal price; if it is similar to the initial purchase price, it is acceptable, and the renewal is not expensive:

WeChat Screenshot_20231226141526

Then click Add to Cart -> Proceed to Cart -> Continue to cart:

WeChat Screenshot_20231226141913

Remove any additional items, click Next: Payment (there may be a tax of 1-2 yuan, which is normal):

WeChat Screenshot_20231226142259

Choose Alipay, check the two agreements, and click Complete Order:

WeChat Screenshot_20231226142526

The first time you place an order, a bad or Error pop-up may appear. Don't panic~ Click the OK button, and you'll return to the payment page. Just do it again (don't forget to check that any additional items have been removed):

WeChat Screenshot_20231226142736

Doing it again will show a REDIRECTING TO ALIPAY pop-up. Click the OK button, and it will redirect to the payment page. Just scan the code to pay, and after payment is complete, wait for the page to redirect:

WeChat Screenshot_20231226143018

After successfully purchasing the domain name, click on the top right 🔗My Domains, and you will see the domain name you just purchased. You can uncheck the auto-renew option:

WeChat Screenshot_20231226143506

Configure Cloudflare#

First, go to 🔗register for Cloudflare, and you can select Simplified Chinese at the top:

WeChat Screenshot_20231226143646

After registering and logging in, click Add Site:

WeChat Screenshot_20231226143854

Enter the domain name you just bought, for example, 875479.xyz, and click the Continue button:

WeChat Screenshot_20231226144021

Scroll down to the bottom of the page, select the Free plan, and click Continue:

WeChat Screenshot_20231226144150

Add DNS records. Vercel officially provides dedicated IP and CNAME addresses for domestic users:

  • A type address: 76.223.126.88 or 76.76.21.98
  • CNAME type address: cname-china.vercel-dns.com

When adding, make sure to set the proxy status to Off, and do the same for CNAME type:
WeChat Screenshot_20231226145821

Click the Continue button:

WeChat Screenshot_20231226145620

Then scroll down the page and copy these two Name Server addresses (do not close this page yet):

WeChat Screenshot_20231226150200

Return to 🔗Name.com My Domains page, select the domain name you just bought, and click Manage Name Servers:

WeChat Screenshot_20231226150451

Delete the default 4 addresses and replace them with the two new Name Server addresses you copied from Cloudflare:

WeChat Screenshot_20231226150814

After replacing, go back to the Cloudflare page that you were instructed not to close, and click Done, Check Name Servers, and wait for the update (approximately 10-20 minutes):

WeChat Screenshot_20231226150959

This step is not necessary, you can skip it:

WeChat Screenshot_20231226151116

You can manually check the status after a while:

WeChat Screenshot_20231226151231

Return to the main page and wait patiently until the status here changes to ✔️ Valid:

WeChat Screenshot_20231226151406

Add the Domain Name to Vercel#

Return to the Vercel console, click on the project you just deployed, and click Domains:

WeChat Screenshot_20231226151555

WeChat Screenshot_20231226151623

First, click Edit, then click Remove to delete the default domain name:

WeChat Screenshot_20231226151811

WeChat Screenshot_20231226151823

In the text box, enter the domain name you just bought, and click Add:

WeChat Screenshot_20231226152057

Choose the default option, then click Add:

WeChat Screenshot_20231226152143

Wait for the automatic refresh for a while, and you will see that the domain has been successfully added:

WeChat Screenshot_20231226152508

At this point, you can access it using the new domain~

Website Settings#

Once the website is accessible, you can make some simple settings according to your personal preferences, for example:

WeChat Screenshot_20231226152842

WeChat Screenshot_20231226153128

Others#

Note: You need to redeploy after adding or deleting access codes or changing the API Key.

How to add or delete access codes?#

Enter the deployed project, click Settings, select Environment Variables, edit CODE, and then save:

image

How to change the API key?#

Same as above, edit the value of OPENAI_API_KEY, and save:

image

How to redeploy?#

Select Deployments, and redeploy the latest deployment record:

image

Check Use existing Build Cache, and click Redeploy:

image

Trigger Prompt Templates#

Type / in the text box to trigger the built-in prompt templates:

WeChat Screenshot_20240113144159

Manually sync the repository?#

Enter your forked repository, click Sync fork. If the Update branch button appears, you can update; if this button is not present, it means your repository is already in sync with the upstream repository and does not need to be updated manually:

WeChat Screenshot_20231226154033

Project Tracking#

You can continue to 🔗follow the project to stay updated on new feature applications.

Learn to write prompts for AI#

Recommended reading:

  1. Prompt Engineering Guide
  2. Learn Prompting
  3. Prompt Engineering

Prompt Engineering is a relatively new discipline that focuses on the development and optimization of prompts, helping users apply large language models (LLMs) in various scenarios and research fields. Mastering skills related to prompt engineering will help users better understand the capabilities and limitations of large language models.

Researchers can use prompt engineering to enhance the ability of large language models to handle complex task scenarios, such as question answering and arithmetic reasoning. Developers can design and develop powerful engineering techniques through prompt engineering to achieve efficient integration with large language models or other ecological tools.

Prompt engineering is not just about designing and developing prompts. It encompasses various skills and techniques for interacting with and developing large language models. Prompt engineering plays an important role in interacting with and integrating large language models, as well as understanding their capabilities. Users can improve the safety of large language models through prompt engineering and empower them, for example, by leveraging domain expertise and external tools to enhance the capabilities of large language models.

image

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.