Spaces:
Running
Running
binary-husky
commited on
Commit
·
badf409
1
Parent(s):
9564a5e
Update README.md
Browse files
README.md
CHANGED
|
@@ -166,80 +166,12 @@ input区域 输入 ./crazy_functions/test_project/python/dqn , 然后点击 "[
|
|
| 166 |
|
| 167 |
```
|
| 168 |
|
| 169 |
-
##
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
WSL2可以配置使用Windows侧的代理上网,前置步骤可以参考[这里](https://www.cnblogs.com/tuilk/p/16287472.html)
|
| 173 |
-
由于Windows相对WSL2的IP会发生变化,我们需要每次启动前先获取这个IP来保证顺利访问,将config.py中设置proxies的部分更改为如下代码:
|
| 174 |
-
```python
|
| 175 |
-
import subprocess
|
| 176 |
-
cmd_get_ip = 'grep -oP "(\d+\.)+(\d+)" /etc/resolv.conf'
|
| 177 |
-
ip_proxy = subprocess.run(
|
| 178 |
-
cmd_get_ip, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, shell=True
|
| 179 |
-
).stdout.strip() # 获取windows的IP
|
| 180 |
-
proxies = { "http": ip_proxy + ":51837", "https": ip_proxy + ":51837", } # 请自行修改
|
| 181 |
-
```
|
| 182 |
-
在启动main.py后,可以在windows浏览器中访问服务。至此测试、使用与上面其他方法无异。
|
| 183 |
-
|
| 184 |
-
## 远程部署
|
| 185 |
-
如果您需要将本项目部署到公网服务器,请设置好`PORT`(固定端口)和`AUTHENTICATION`(避免您的`APIKEY`被滥用),并将`main.py`的最后一句话修改为:
|
| 186 |
-
```python
|
| 187 |
-
demo.queue(concurrency_count=CONCURRENT_COUNT).launch(server_name="0.0.0.0", share=False, server_port=PORT, auth=AUTHENTICATION) # 取消share
|
| 188 |
-
```
|
| 189 |
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
http {
|
| 193 |
-
# 其他配置
|
| 194 |
-
#......
|
| 195 |
-
# 配置websocket
|
| 196 |
-
map $http_upgrade $connection_upgrade {
|
| 197 |
-
default upgrade;
|
| 198 |
-
'' close;
|
| 199 |
-
}
|
| 200 |
-
upstream my_chataca {
|
| 201 |
-
# 这里配置负载均衡策略
|
| 202 |
-
ip_hash; # 如果使用负载均衡,建议使用ip_hash
|
| 203 |
-
# 假设本项目运行的端口为8080
|
| 204 |
-
server 127.0.0.1:8080 max_fails=3 fail_timeout=10;
|
| 205 |
-
}
|
| 206 |
-
|
| 207 |
-
server {
|
| 208 |
-
listen 80;
|
| 209 |
-
listen [::]:80;
|
| 210 |
-
server_name yourdomain.com;
|
| 211 |
-
return 301 https://yourdomain.com$request_uri;# 强制使用https
|
| 212 |
-
}
|
| 213 |
-
|
| 214 |
-
server {
|
| 215 |
-
listen 443 ssl http2;
|
| 216 |
-
listen [::]:443 ssl http2;
|
| 217 |
-
server_name yourdomain.com;
|
| 218 |
-
ssl_protocols TLSv1.2 TLSv1.3;
|
| 219 |
-
ssl_prefer_server_ciphers on;
|
| 220 |
-
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
|
| 221 |
-
ssl_session_tickets off;
|
| 222 |
-
ssl_session_timeout 1d;
|
| 223 |
-
ssl_session_cache shared:SSL:10m;
|
| 224 |
-
add_header Strict-Transport-Security
|
| 225 |
-
"max-age=31536000; includeSubDomains"
|
| 226 |
-
always;
|
| 227 |
-
ssl_certificate xxxxxx.pem; # 证书文件
|
| 228 |
-
ssl_certificate_key xxxxxx.key; # 证书文件
|
| 229 |
-
|
| 230 |
-
location / {
|
| 231 |
-
proxy_pass http://my_chataca;
|
| 232 |
-
proxy_set_header Host $host;
|
| 233 |
-
proxy_set_header X-Real-IP $remote_addr;
|
| 234 |
-
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
| 235 |
-
proxy_set_header X-Forwarded-Proto https;
|
| 236 |
-
proxy_set_header Upgrade $http_upgrade;
|
| 237 |
-
proxy_set_header Connection $connection_upgrade;
|
| 238 |
-
}
|
| 239 |
-
}
|
| 240 |
-
|
| 241 |
-
}
|
| 242 |
-
```
|
| 243 |
|
| 244 |
|
| 245 |
## 自定义新的便捷按钮(学术快捷键自定义)
|
|
|
|
| 166 |
|
| 167 |
```
|
| 168 |
|
| 169 |
+
## 其他部署方式
|
| 170 |
+
- 使用WSL2(Windows Subsystem for Linux 子系统)
|
| 171 |
+
请访问[部署wiki-1](https://github.com/binary-husky/chatgpt_academic/wiki/%E4%BD%BF%E7%94%A8WSL2%EF%BC%88Windows-Subsystem-for-Linux-%E5%AD%90%E7%B3%BB%E7%BB%9F%EF%BC%89%E9%83%A8%E7%BD%B2)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 172 |
|
| 173 |
+
- nginx远程部署
|
| 174 |
+
请访问[部署wiki-2](https://github.com/binary-husky/chatgpt_academic/wiki/%E8%BF%9C%E7%A8%8B%E9%83%A8%E7%BD%B2%E7%9A%84%E6%8C%87%E5%AF%BC)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 175 |
|
| 176 |
|
| 177 |
## 自定义新的便捷按钮(学术快捷键自定义)
|