gpt_academic icon indicating copy to clipboard operation
gpt_academic copied to clipboard

[Bug]: Connection errored out

Open Mao-Hao opened this issue 1 year ago • 7 comments

Installation Method | 安装方法与平台

Pip Install (I used latest requirements.txt)

Version | 版本

Latest | 最新版

OS | 操作系统

Linux

Describe the bug | 简述

你好, 版本3.54 部署在vps上, os是ubuntu 20.04 挂在了公网, 此前均可正常使用 但是突然出现了这样的问题, 如下图

请问这是什么原因呢? 是该vps的ip不行, 被openai ban了么? 还是什么别的原因, 谢谢

Screen Shot | 有帮助的截图

Snipaste_2023-09-30_15-01-00

Terminal Traceback & Material to Help Reproduce Bugs | 终端traceback(如有) + 帮助我们复现的测试材料样本(如有)

No response

Mao-Hao avatar Sep 30 '23 07:09 Mao-Hao

我也有类似的问题

laozhong5541 avatar Sep 30 '23 10:09 laozhong5541

和openai没关系,一般是和vps的链接出了问题,如websocket

binary-husky avatar Oct 01 '23 11:10 binary-husky

我也是这个问题,怎么解决呀?

Monkeylwq avatar Oct 10 '23 13:10 Monkeylwq

启用浏览器隐私模式、关闭浏览器翻译插件等,可能会有用

binary-husky avatar Oct 18 '23 15:10 binary-husky

我是本地部署的,关闭卡巴斯基就解决这个问题了。

slashyue avatar Oct 19 '23 02:10 slashyue

解决 Snipaste_2023-11-26_12-24-29

一些心得。

版本:最新

系统:centos

服务器:美国

能够开启SSL并成功访问及提交功能

  1. 升级:Gradio

  2. 在nginx目录下新建conf.d文件夹并其下配置新的nginx文件

    server {
        listen 80;
        server_name a.com;#你的域名(a.com)
    
        return 301 https://$host$request_uri;
    }
    
    server {
        listen 443 ssl http2;
        server_name a.com;#你的域名(a.com)
    
      # XXXX为证书文件路径
        ssl_certificate XXXX;
        ssl_certificate_key XXXX;
        ssl_protocols TLSv1.2 TLSv1.3;
        ssl_prefer_server_ciphers on;
        ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
        ssl_session_tickets off;
        ssl_session_timeout 1d;
        ssl_session_cache shared:SSL:10m;
    
        add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
    
        location / {
            proxy_pass http://127.0.0.1:yyy;#yyy为python程序运行的端口号
            proxy_http_version 1.1;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto https;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection $connection_upgrade;
            proxy_max_temp_file_size 0;
            client_max_body_size 10m;
            client_body_buffer_size 128k;
            proxy_connect_timeout 90;
            proxy_send_timeout 90;
            proxy_read_timeout 90;
            proxy_buffer_size 4k;
            proxy_buffers 4 32k;
            proxy_busy_buffers_size 64k;
            proxy_temp_file_write_size 64k;
        }
    }
    
    

    3.修改nginx.conf文件

    # For more information on configuration, see:
    #   * Official English Documentation: http://nginx.org/en/docs/
    #   * Official Russian Documentation: http://nginx.org/ru/docs/
    
    user nginx;
    worker_processes auto;
    error_log /var/log/nginx/error.log;
    pid /run/nginx.pid;
    
    # Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
    include /usr/share/nginx/modules/*.conf;
    
    events {
        worker_connections 1024;
    }
    
    http {
        log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                          '$status $body_bytes_sent "$http_referer" '
                          '"$http_user_agent" "$http_x_forwarded_for"';
    
        access_log  /var/log/nginx/access.log  main;
    
        sendfile            on;
        tcp_nopush          on;
        tcp_nodelay         on;
        keepalive_timeout   65;
        types_hash_max_size 4096;
    
        include             /etc/nginx/mime.types;
        default_type        application/octet-stream;
        map $http_upgrade $connection_upgrade {
        default upgrade;
        ''      close;
        }
    upstream my_chataca {
    	# 这里配置负载均衡策略
        ip_hash; # 如果使用负载均衡,建议使用ip_hash
        # 假设本项目运行的端口为8080
    	server 127.0.0.1:yyy max_fails=3 fail_timeout=10;  #yyy为python程序运行的端口号
    }
    
        # Load modular configuration files from the /etc/nginx/conf.d directory.
        # See http://nginx.org/en/docs/ngx_core_module.html#include
        # for more information.
        include /etc/nginx/conf.d/*.conf; #引入你的新建的配置文件
    
        server {
            listen       80;
            listen       [::]:80;
            server_name  _;
            root         /usr/share/nginx/html;
    
            # Load configuration files for the default server block.
            include /etc/nginx/default.d/*.conf;
    
            error_page 404 /404.html;
            location = /404.html {
            }
    
            error_page 500 502 503 504 /50x.html;
            location = /50x.html {
            }
        }
    
    

    4.对于gpt_academic项目的main.py文件配置(最后部分)【注意:我的不是二级运行目录】

        run_delayed_tasks()
        demo.queue(concurrency_count=CONCURRENT_COUNT).launch(
            quiet=True,
            server_name="0.0.0.0",
            server_port=PORT,
            share=False,
            favicon_path=os.path.join(os.path.dirname(__file__), "docs/logo.png"),
            auth=AUTHENTICATION if len(AUTHENTICATION) != 0 else None,
            blocked_paths=["config.py","config_private.py","docker-compose.yml","Dockerfile",f"{PATH_LOGGING}/admin"])
    

    5.以上办法同时解决掉了websocket问题,也就是控制台报js代码不能响应的问题。

    6.以上方法对设置密码生效,利用域名就能访问,不用添加端口号,当然你得服务器上的配置都要对的。

dongla-danzeng avatar Nov 26 '23 04:11 dongla-danzeng