Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
赵月辉
/
fastgpt-migrated
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Unverified
Commit
36dad6df
authored
Apr 14, 2023
by
archer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perf: docs
parent
6ff5db7b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
25 deletions
+44
-25
README.md
+38
-18
src/pages/api/openapi/chat/lafGpt.ts
+6
-6
src/service/redis.ts
+0
-1
No files found.
README.md
View file @
36dad6df
...
...
@@ -37,6 +37,7 @@ docker push imageName:tag
# 安装docker
curl
-sSL
https://get.daocloud.io/docker | sh
sudo
systemctl start docker
# 安装 docker-compose
```
#### 软件教程: clash 代理
...
...
@@ -136,33 +137,42 @@ appendfilename "appendonly.aof"
appendfsync everysec
```
**nginx.conf**
```
```
conf
user
nginx
;
worker_processes
auto
;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
worker_rlimit_nofile
51200
;
events
{
worker_connections
1024
;
}
http
{
include /etc/nginx/mime.types;
default_type application/octet-stream;
include /etc/nginx/conf.d/*.conf;
access_log
off
;
server_names_hash_bucket_size
512
;
client_header_buffer_size
32
k
;
large_client_header_buffers
4
32
k
;
client_max_body_size
50
M
;
gzip
on
;
gzip_min_length
1
k
;
gzip_buffers
4
8
k
;
gzip_http_version
1
.
1
;
gzip_comp_level
6
;
gzip_vary
on
;
gzip_types
text
/
plain
application
/
x
-
javascript
text
/
css
application
/
javascript
application
/
json
application
/
xml
;
gzip_disable
"MSIE [1-6]\."
;
open_file_cache
max
=
1000
inactive
=
1
d
;
open_file_cache_valid
30
s
;
open_file_cache_min_uses
8
;
open_file_cache_errors
off
;
server
{
listen 80;
server_name test.com;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 8k;
gzip_http_version 1.1;
gzip_comp_level 6;
gzip_vary on;
gzip_types text/plain application/x-javascript text/css application/javascript application/json application/xml;
gzip_disable "MSIE [1-6]\.";
listen
443
ssl
;
server_name
fastgpt
.
ahapocket
.
cn
;
ssl_certificate
/
ssl
/
fastgpt
.
pem
;
ssl_certificate_key
/
ssl
/
fastgpt
.
key
;
ssl_session_timeout
5
m
;
location
/ {
proxy_pass
http
://
localhost
:
3000
;
...
...
@@ -171,12 +181,22 @@ http {
proxy_set_header
X
-
Forwarded
-
For
$
proxy_add_x_forwarded_for
;
}
}
server
{
listen
80
;
server_name
fastgpt
.
ahapocket
.
cn
;
rewrite
^(.*)
https
://$
server_name
$
1
permanent
;
}
}
```
#### 运行脚本
**redis
创建索引
**
**redis
初始化
**
```
bash
# 进入容器
docker
exec
-it
容器ID bash
redis-cli
-p
6379
auth psw1234
# 添加索引
FT.CREATE idx:model:data:hash ON HASH PREFIX 1 model:data: SCHEMA modelId TAG userId TAG status TAG q TEXT text TEXT vector VECTOR FLAT 6 DIM 1536 DISTANCE_METRIC COSINE TYPE FLOAT32
```
**run.sh 运行文件**
...
...
src/pages/api/openapi/chat/lafGpt.ts
View file @
36dad6df
...
...
@@ -83,23 +83,23 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
下面是一些例子:
实现一个手机号发生注册验证码方法.
1. 从 query 中获取 phone.
2. 校验手机号格式是否正确,不正确则返回错误
码501,原因为
:手机号格式错误.
2. 校验手机号格式是否正确,不正确则返回错误
原因
:手机号格式错误.
3. 给 phone 发送一个短信验证码,验证码长度为6位字符串,内容为:你正在注册laf,验证码为:code.
4. 数据库添加数据,表为"codes",内容为 {phone, code}.
实现根据手机号注册账号,需要验证手机验证码.
1. 从 body 中获取 phone 和 code.
2. 校验手机号格式是否正确,不正确则返回错误
码501,原因为
:手机号格式错误.
2. 获取数据库数据,表为"codes",查找是否有符合 phone, code 等于body参数的记录,没有的话返回错误
码500,原因为
:验证码不正确.
2. 校验手机号格式是否正确,不正确则返回错误
原因
:手机号格式错误.
2. 获取数据库数据,表为"codes",查找是否有符合 phone, code 等于body参数的记录,没有的话返回错误
原因
:验证码不正确.
4. 添加数据库数据,表为"users" ,内容为{phone, code, createTime}.
5. 删除数据库数据,删除 code 记录.
6. 返回新建用户的Id: return {userId}
更新博客记录。传入blogId,blogText,tags,还需要记录更新的时间.
1. 从 body 中获取 blogId,blogText 和 tags.
2. 校验 blogId 是否为空,为空则返回错误
码500,原因为
:博客ID不能为空.
3. 校验 blogText 是否为空,为空则返回错误
码500,原因为
:博客内容不能为空.
4. 校验 tags 是否为数组,不是则返回错误
码500,原因为
:标签必须为数组.
2. 校验 blogId 是否为空,为空则返回错误
原因
:博客ID不能为空.
3. 校验 blogText 是否为空,为空则返回错误
原因
:博客内容不能为空.
4. 校验 tags 是否为数组,不是则返回错误
原因
:标签必须为数组.
5. 获取当前时间,记录为 updateTime.
6. 更新数据库数据,表为"blogs",更新符合 blogId 的记录的内容为{blogText, tags, updateTime}.
7. 返回结果 "更新博客记录成功"`
...
...
src/service/redis.ts
View file @
36dad6df
...
...
@@ -29,7 +29,6 @@ export const connectRedis = async () => {
await
global
.
redisClient
.
connect
();
// 1 - 测试库,0 - 正式
await
global
.
redisClient
.
SELECT
(
0
);
return
global
.
redisClient
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment