The latest ChatGPT program source code + AI system + detailed graphic tutorials/support GPT4/AI painting/H5 terminal/complete prompt knowledge base

1. AI system

How to build and deploy artificial intelligence source code, AI creation system, and ChatGPT system? Let me write a detailed graphic tutorial here! SparkAi uses Nestjs and Vue3 framework technology to continuously integrate AI capabilities into the AIGC system!

1.1 Core functions of the program

The program already supports ChatGPT3.5/GPT-4 questioning, AI painting, Midjourney painting (fully customizable parameters), Midjourney drawings from pictures, Dall-E2 painting, mind map generation, knowledge base (customizable training), AI painting square, invitation + agent distribution model, daily user check-in function, conversation record saving, WeChat official account + email + mobile phone number registration and login, and other free version feature updates in the future.

1.2 Latest version update log

Version [V2.6.0] update features:

  • Optimize the key pool quota exhaustion locking logic (updated on August 26)!
  • Optimize MJ painting links, optimize CSS, and modify some page styles (updated on August 26)!
  • Add the function of signing in on the mobile phone to receive free times, and optimize the logic of the total number of paintings in the background!
  • Added MJ official picture regeneration command function
  • Synchronize the official Vary command to enhance the contrast of a single image Vary(Strong) | Vary(Subtle)
  • Synchronize the official Zoom command to infinitely zoom a single picture Zoom out 2x | Zoom out 1.5x

2. System Demonstration

https://ai.idcyli.com

3. Function module

3.1 Questions about GPT model

GPT online questioning has been supported

3.2 Application workbench

3.2.1 prompt knowledge base

3.2.2 Support user-defined knowledge base

3.3 Midjourney Professional Painting

Vincent picture:

Draw pictures from pictures: 

3.4 Dall-E2 Painting

3.5 Mind map generation​

3.6 AI Painting Square

4. Source code system

4.1 Front-end demo site

4.2 SparkAi source code download

4.3 SparkAi system documentation

4.4 Detailed construction and deployment tutorial

5. Detailed construction tutorial

The following tutorial uses Linux Pagoda to build and deploy

5.1 Basic env environment configuration

In the code, we provide the basic environment variable file configuration file env.example. Before using it, remove the suffix and change it to the .env file. We only need to configure the following things in the env environment configuration file.

  • Authorization code, IP configuration

  • Mail service configuration

  • These three items of mysql database are basic configurations. Mysql and authorization are necessary. Only when mysql and authorization are configured can the project be started successfully. The mail service can be added later.

5.2 env.env file configuration

# 服务器ip (必填项)
SPARK_AI_HOST=
# 授权码 (授权码留空,可启动运行体验系统半小时)
SPARK_AI_KEY=

# mysql
DB_HOST=localhost
DB_PORT=3306
DB_USER=数据库用户名
DB_PASS=数据库密码·
DB_DATABASE=数据库名
DB_LOG=false
DB_SYNC=true

#  mailer 邮件服务
MAILER_HOST=smtp.163.com/smtp.qq.com (选择自己的发信服务器地址,网易邮箱或者qq邮箱)
MAILER_PORT=465
MAILER_USER=发信邮箱
MAILER_PASS=邮箱发信密钥
MAILER_FROM=发信邮箱

# Redis
REDIS_PORT=6379
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=

# mj并发数
CONCURRENCY=3

# jwt token
JWT_SECRET=chat-spark
# jwt token 过期时间
JWT_EXPIRESIN=7d
# 接口文档前缀
SWAGGERPREFIX=/docs
# 自定义端口
PORT=9520

6. Environment installation

  • Nginx >= 1.19.8

  • MySQL >= 5.7 or MySQL 8.0

  • PHP-7.4

  • PM2 Manager 5.5

  • Redis 7.0.11

  • Node version: >=16.19.1

Detailed tutorial:

6.1 Determine Node version

Use PM2 to switch Node versions ( required )

Switch Node version to: v16.19.1

​​​​​​

6.2 Install pnpm module

6.3 Install Redis

​​​​​​

7. Deploy and run

7.1 Create a new site

Pagoda - Website - Add site

7.2 Configure SSL

7.2.1 Use your own ssl certificate and install access using HTTPS

7.2.2 Let's Encrypt certificate application

If you don't have a certificate, you can use Pagoda's free certificate and apply for Let's Encrypt

​​​​​​

7.3 Upload system source code

7.3.1 Upload system source code

Delete original files

Upload and unzip the program to the root directory of the website

​​​​7.3.2 Configuration .env file

Double-click the .env.example  file directly in the Pagoda  to edit it, or edit it in the terminal vim

After the configuration is completed, delete the file suffix and the file name is  .env.

7.4 Start the project

7.4.1 Pagoda open port

Enter the security settings of the pagoda panel and open  port 9520  and port 3306

7.4.2 Install dependencies

Enter the ssh terminal in the website root directory
and use pnpm i to install dependencies.

7.4.3 Starting the project

Start the project using pnpm start

7.4.4 View startup log

Enter pm2 log to view the detailed log. If you see the picture below, it means success!

​​​​​​

7.4.5 Set up reverse proxy

Add  9520  port reverse proxy. Pagoda Security needs to open this port, otherwise it will not be accessible.

8. Test and use the system

Deployment completed! At this time, you can access the SparkAi system through the domain name!

8.1 Management background

The default front-end address is the domain name address and the default back-end address is: domain name address/sparkai/admin

The default super administrator account is super spark123

At this point our installation is complete!

8.2 Access to test system

Thanks for watching, tutorial complete!

Guess you like

Origin blog.csdn.net/weixin_43227851/article/details/132550715