binary-husky / gpt_academic

为GPT/GLM等LLM大语言模型提供实用化交互接口,特别优化论文阅读/润色/写作体验,模块化设计,支持自定义快捷按钮&函数插件,支持Python和C++等项目剖析&自译解功能,PDF/LaTex论文翻译&总结功能,支持并行问询多种LLM模型,支持chatglm3等本地模型。接入通义千问, deepseekcoder, 讯飞星火, 文心一言, llama2, rwkv, claude2, moss等。
https://github.com/binary-husky/gpt_academic/wiki/online
GNU General Public License v3.0
65.94k stars 8.09k forks source link

[Bug]: Connection errored out #1137

Open Mao-Hao opened 1 year ago

Mao-Hao commented 1 year ago

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

laozhong5541 commented 1 year ago

我也有类似的问题

binary-husky commented 1 year ago

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

Monkeylwq commented 1 year ago

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

binary-husky commented 1 year ago

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

slashyue commented 1 year ago

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

dongla-danzeng commented 1 year ago

解决 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.以上方法对设置密码生效,利用域名就能访问,不用添加端口号,当然你得服务器上的配置都要对的。

HowcanoeWang commented 3 months ago

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

            run_delayed_tasks()
            demo.queue(concurrency_count=CONCURRENT_COUNT).launch(
                quiet=True,
                server_name="0.0.0.0",

最新的版本里面好像这段代码demo.queue()被移除了,如何提供share=True的变量来解决访问的问题?