|
发表于 2023-3-24 17:30:54
|
显示全部楼层
#开启openai接口的gzip压缩,大量重复文本的压缩率高,节省服务端流量
gzip on;
gzip_min_length 1k;
gzip_types text/event-stream;
#如需部署在网站子路径,如/chatgpt,配置如下
#location ^~ /chatgpt/v1 {
location ^~ /www/wwwroot/{
proxy_pass https://api.openai.com/v1;
proxy_set_header Host api.openai.com;
#如需用户自定义API key,可注释掉下一行配置
proxy_set_header Authorization "";
proxy_pass_header Authorization;
#流式传输,不关闭buffering缓存会卡顿卡死,必须配置!!!
proxy_buffering off;
}
#与上面反代接口的路径保持一致
#location /chatgpt {
location / {
alias /www/wwwroot/;
index index.html;
}
这个这样填写是否正确呢? |
|