chatpire / chatgpt-web-share

ChatGPT Plus 共享方案。ChatGPT Plus / OpenAI API sharing solution.
https://cws-docs.pages.dev/zh/
GNU General Public License v3.0
4.29k stars 679 forks source link

获取回复失败 [1014] HTTP错误 #111

Closed coolsd closed 1 year ago

coolsd commented 1 year ago

获取回复失败 [1014] HTTP错误

后台日志

2023/04/17 17:50:32.638     INFO: [uvicorn.error]   Started server process [1]
2023/04/17 17:50:32.639     INFO: [uvicorn.error]   Waiting for application startup.
2023/04/17 17:50:32.647     INFO: [alembic.runtime.migration]   Context impl SQLiteImpl.
2023/04/17 17:50:32.648     INFO: [alembic.runtime.migration]   Will assume non-transactional DDL.
2023/04/17 17:50:32.654     INFO: [cws.main]    database initialized
2023/04/17 17:50:32.654    DEBUG: [cws.utils.store_statistics]  loading statistics from /data/statistics.json
2023/04/17 17:50:32.654     INFO: [cws.utils.store_statistics]  Requests statistics loaded.
2023/04/17 17:50:32.675     INFO: [cws.utils.create_user]   Create User admin Error: Username already exists
2023/04/17 17:50:32.681     INFO: [cws.main]    Using <default_bypass> as ChatGPT base url
2023/04/17 17:50:32.682     INFO: [cws.utils.sync_conversations]    Syncing conversations...
2023/04/17 17:50:32.691    ERROR: [cws.utils.sync_conversations]    Fetch conversation error (httpx.HTTPError): All connection attempts failed
2023/04/17 17:50:32.692  WARNING: [cws.utils.sync_conversations]    Sync conversations on startup failed!
2023/04/17 17:50:32.692     INFO: [cws.main]    Sync conversations regularly enabled, will sync conversations every 12 hours.
2023/04/17 17:50:32.694     INFO: [uvicorn.error]   Application startup complete.
2023/04/17 17:50:32.694     INFO: [uvicorn.error]   Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
2023/04/17 17:50:34.274     INFO: [cws.access]  125.114.3.78:0 | GET /user/me HTTP/1.1 | 200 OK | 8 ms
2023/04/17 17:50:34.529     INFO: [cws.access]  125.114.3.78:0 | GET /conv?fetch_all=false HTTP/1.1 | 200 OK | 29 ms
2023/04/17 17:50:38.383     INFO: [uvicorn.error]   ('125.114.3.78', 0) - "WebSocket /conv" [accepted]
2023/04/17 17:50:38.385     INFO: [uvicorn.error]   connection open
2023/04/17 17:50:38.389    DEBUG: [cws.api.routers.chat]    adminconnected to websocket
2023/04/17 17:50:38.584    ERROR: [cws.api.routers.chat]    All connection attempts failed
2023/04/17 17:50:38.585    DEBUG: [cws.api.routers.chat]    terminated ask None (ChatModels.default) because of error
2023/04/17 17:50:38.745     INFO: [uvicorn.error]   connection closed
2023/04/17 17:50:38.902     INFO: [cws.access]  125.114.3.78:0 | GET /user/me HTTP/1.1 | 200 OK | 6 ms
2023/04/17 17:50:46.053     INFO: [cws.access]  125.114.3.78:0 | GET /system/info HTTP/1.1 | 200 OK | 41 ms
2023/04/17 17:50:46.162     INFO: [cws.access]  125.114.3.78:0 | GET /system/request_statistics HTTP/1.1 | 200 OK | 16 ms
2023/04/17 17:50:46.198     INFO: [cws.access]  125.114.3.78:0 | GET /user HTTP/1.1 | 200 OK | 17 ms

config 文件

print_sql: false
host: "127.0.0.1"
port: 8000
data_dir: /data # <------ v0.3.0 以上新增
database_url: "sqlite+aiosqlite:////data/database.db" # 特别注意:这里有四个斜杠,代表着文件位于 /data 目录,使用的是绝对路径
run_migration: false # 是否在启动时运行数据库迁移,目前没有必要启用

jwt_secret: "adadadasfgghjhgj" # 用于生成 jwt token,自行填写随机字符串
jwt_lifetime_seconds: 86400 # jwt token 过期时间
cookie_max_age: 86400 # cookie 过期时间
user_secret: "adadadasfgghjhgj" # 用于生成用户密码,自行填写随机字符串

sync_conversations_on_startup: true # 是否在启动时同步同步 ChatGPT 对话,建议启用。启用后,将会自动将 ChatGPT 中新增的对话同步到数据库中,并把已经不在 ChatGPT 中的对话标记为无效
create_initial_admin_user: true # 是否创建初始管理员用户
initial_admin_username: admin# 初始管理员用户名
initial_admin_password: admin# 初始管理员密码
ask_timeout: 600    # 用于限制对话的最长时间

chatgpt_access_token: "重新登录更新了最新的" # 需要从 ChatGPT 获取,见后文
chatgpt_paid: true # 是否为 ChatGPT Plus 用户

# 注意:如果你希望使用公共代理,或使用整合的 go-proxy-api,请保持注释;如果需要自定义,注意最后一定要有一个斜杠
# 在实际请求时,chatgpt_base_url 优先级为:config 内定义 > 环境变量 > revChatGPT 内置的公共代理
# chatgpt_base_url: http://127.0.0.1:6060/

log_dir: /app/logs # 日志存储位置,不要随意修改
console_log_level: INFO # 日志等级,设置为 DEBUG 能够获得更多信息

# 以下用于统计,如不清楚可保持默认
request_log_counter_time_window: 2592000 # 请求日志时间范围,默认为最近 30 天
request_log_counter_interval: 1800 # 请求日志统计粒度,默认为 30 分钟
ask_log_time_window: 2592000 # 对话日志时间范围,默认为最近 7 天
sync_conversations_regularly: yes # 是否定期(每隔12小时)从账号中同步一次对话

docker

version: "3"

services:
  chatgpt-share:
    image: ghcr.io/moeakwak/chatgpt-web-share:latest
    restart: always
    ports:
      - 8066:80 # web 端口号
    volumes:
      - ./data:/data # 存放数据库文件以及统计数据
      - ./config.yaml:/app/backend/api/config/config.yaml # 后端配置文件
      - ./logs:/app/logs # 存放日志文件
    environment:
      - TZ=Asia/Shanghai
      - CHATGPT_BASE_URL=http://go-chatgpt-api:8066/
    depends_on:
      - go-chatgpt-api

  go-chatgpt-api:
    image: linweiyuan/go-chatgpt-api
    ports:
      - 6060:8080 # 如果你需要暴露端口如一带多,可以取消注释
    environment:
      - GIN_MODE=release
      - CHATGPT_PROXY_SERVER=http://chatgpt-proxy-server:9515
      # - NETWORK_PROXY_SERVER=http://host:port
    depends_on:
      - chatgpt-proxy-server
    restart: unless-stopped

  chatgpt-proxy-server:
    image: linweiyuan/chatgpt-proxy-server
    restart: unless-stopped

8066端口已经开放

moeakwak commented 1 year ago

尝试更改 config:设置 chatgpt_base_url 为 http://<你的公网ip>:6060/

coolsd commented 1 year ago

修改以后,一直在思考 重新创建会话 提示 获取回复失败 [1008] 当前用户已有对话等待回复,不能再次请求

moeakwak commented 1 year ago

提供:go-chatgpt-api容器日志,以及cws日志

coolsd commented 1 year ago

go-chatgpt-api

2023/04/17 11:04:33 [Recovery] 2023/04/17 - 11:04:33 panic recovered:
runtime error: invalid memory address or nil pointer dereference
/usr/local/go/src/runtime/panic.go:260 (0x44ad1c)
/usr/local/go/src/runtime/signal_unix.go:837 (0x44acec)
/app/webdriver/refresh.go:26 (0x7afa18)
/app/main.go:21 (0x7b4795)
/usr/local/go/src/runtime/panic.go:884 (0x434772)
/usr/local/go/src/runtime/panic.go:260 (0x44ad1c)
/usr/local/go/src/runtime/signal_unix.go:837 (0x44acec)
/app/api/chatgpt/chatgpt.go:165 (0x7b0e1d)
/app/api/chatgpt/chatgpt.go:145 (0x7b080b)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/context.go:174 (0x7b4237)
/app/middleware/headercheck.go:20 (0x7b413f)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/context.go:174 (0x7b4813)
/app/main.go:24 (0x7b47ff)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/context.go:174 (0x79b621)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/recovery.go:102 (0x79b60c)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/context.go:174 (0x79a746)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/logger.go:240 (0x79a729)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/context.go:174 (0x7997ca)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/gin.go:620 (0x799451)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/gin.go:576 (0x7990fc)
/usr/local/go/src/net/http/server.go:2936 (0x6549f5)
/usr/local/go/src/net/http/server.go:1995 (0x651311)
/usr/local/go/src/runtime/asm_amd64.s:1598 (0x466960)

ERRO[0000] Please make sure chatgpt proxy service is running 
ERRO[0002] selenium error: panic, need to create a new session and refresh 

2023/04/17 11:05:27 [Recovery] 2023/04/17 - 11:05:27 panic recovered:
runtime error: invalid memory address or nil pointer dereference
/usr/local/go/src/runtime/panic.go:260 (0x44ad1c)
/usr/local/go/src/runtime/signal_unix.go:837 (0x44acec)
/app/webdriver/refresh.go:26 (0x7afa18)
/app/main.go:21 (0x7b4795)
/usr/local/go/src/runtime/panic.go:884 (0x434772)
/usr/local/go/src/runtime/panic.go:260 (0x44ad1c)
/usr/local/go/src/runtime/signal_unix.go:837 (0x44acec)
/app/api/chatgpt/chatgpt.go:74 (0x7b042f)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/context.go:174 (0x7b4237)
/app/middleware/headercheck.go:20 (0x7b413f)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/context.go:174 (0x7b4813)
/app/main.go:24 (0x7b47ff)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/context.go:174 (0x79b621)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/recovery.go:102 (0x79b60c)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/context.go:174 (0x79a746)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/logger.go:240 (0x79a729)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/context.go:174 (0x7997ca)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/gin.go:620 (0x799451)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/gin.go:576 (0x7990fc)
/usr/local/go/src/net/http/server.go:2936 (0x6549f5)
/usr/local/go/src/net/http/server.go:1995 (0x651311)
/usr/local/go/src/runtime/asm_amd64.s:1598 (0x466960)

[GIN] 2023/04/17 - 11:05:27 | 500 |    1.322548ms |      172.17.0.1 | GET      "/conversations?offset=0&limit=80"
ERRO[0010] selenium error: panic, need to create a new session and refresh 

2023/04/17 11:05:35 [Recovery] 2023/04/17 - 11:05:35 panic recovered:
runtime error: invalid memory address or nil pointer dereference
/usr/local/go/src/runtime/panic.go:260 (0x44ad1c)
/usr/local/go/src/runtime/signal_unix.go:837 (0x44acec)
/app/webdriver/refresh.go:26 (0x7afa18)
/app/main.go:21 (0x7b4795)
/usr/local/go/src/runtime/panic.go:884 (0x434772)
/usr/local/go/src/runtime/panic.go:260 (0x44ad1c)
/usr/local/go/src/runtime/signal_unix.go:837 (0x44acec)
/app/api/chatgpt/chatgpt.go:165 (0x7b0e1d)
/app/api/chatgpt/chatgpt.go:145 (0x7b080b)
[GIN] 2023/04/17 - 11:05:35 | 500 |     799.286µs |      172.17.0.1 | POST     "/conversation"
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/context.go:174 (0x7b4237)
/app/middleware/headercheck.go:20 (0x7b413f)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/context.go:174 (0x7b4813)
/app/main.go:24 (0x7b47ff)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/context.go:174 (0x79b621)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/recovery.go:102 (0x79b60c)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/context.go:174 (0x79a746)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/logger.go:240 (0x79a729)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/context.go:174 (0x7997ca)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/gin.go:620 (0x799451)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/gin.go:576 (0x7990fc)
/usr/local/go/src/net/http/server.go:2936 (0x6549f5)
/usr/local/go/src/net/http/server.go:1995 (0x651311)
/usr/local/go/src/runtime/asm_amd64.s:1598 (0x466960)

ERRO[0020] selenium error: panic, need to create a new session and refresh 
[GIN] 2023/04/17 - 11:05:46 | 500 |     587.495µs |      172.17.0.1 | POST     "/conversation"

2023/04/17 11:05:46 [Recovery] 2023/04/17 - 11:05:46 panic recovered:
runtime error: invalid memory address or nil pointer dereference
/usr/local/go/src/runtime/panic.go:260 (0x44ad1c)
/usr/local/go/src/runtime/signal_unix.go:837 (0x44acec)
/app/webdriver/refresh.go:26 (0x7afa18)
/app/main.go:21 (0x7b4795)
/usr/local/go/src/runtime/panic.go:884 (0x434772)
/usr/local/go/src/runtime/panic.go:260 (0x44ad1c)
/usr/local/go/src/runtime/signal_unix.go:837 (0x44acec)
/app/api/chatgpt/chatgpt.go:165 (0x7b0e1d)
/app/api/chatgpt/chatgpt.go:145 (0x7b080b)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/context.go:174 (0x7b4237)
/app/middleware/headercheck.go:20 (0x7b413f)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/context.go:174 (0x7b4813)
/app/main.go:24 (0x7b47ff)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/context.go:174 (0x79b621)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/recovery.go:102 (0x79b60c)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/context.go:174 (0x79a746)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/logger.go:240 (0x79a729)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/context.go:174 (0x7997ca)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/gin.go:620 (0x799451)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/gin.go:576 (0x7990fc)
/usr/local/go/src/net/http/server.go:2936 (0x6549f5)
/usr/local/go/src/net/http/server.go:1995 (0x651311)
/usr/local/go/src/runtime/asm_amd64.s:1598 (0x466960)


CWS

2023/04/17 19:05:27.488     INFO: [uvicorn.error]   Started server process [1]
2023/04/17 19:05:27.488     INFO: [uvicorn.error]   Waiting for application startup.
2023/04/17 19:05:27.499     INFO: [alembic.runtime.migration]   Context impl SQLiteImpl.
2023/04/17 19:05:27.500     INFO: [alembic.runtime.migration]   Will assume non-transactional DDL.
2023/04/17 19:05:27.506     INFO: [cws.main]    database initialized
2023/04/17 19:05:27.507    DEBUG: [cws.utils.store_statistics]  loading statistics from /data/statistics.json
2023/04/17 19:05:27.507     INFO: [cws.utils.store_statistics]  Requests statistics loaded.
2023/04/17 19:05:27.528     INFO: [cws.utils.create_user]   Create User coolsd Error: Username already exists
2023/04/17 19:05:27.534     INFO: [cws.main]    Using http://23.224.4.82:6060/ as ChatGPT base url
2023/04/17 19:05:27.535     INFO: [cws.utils.sync_conversations]    Syncing conversations...
2023/04/17 19:05:27.547    ERROR: [cws.utils.sync_conversations]    Fetch conversation error (ChatGPTError): OpenAI 500: 
2023/04/17 19:05:27.548  WARNING: [cws.utils.sync_conversations]    Sync conversations on startup failed!
2023/04/17 19:05:27.548     INFO: [cws.main]    Sync conversations regularly enabled, will sync conversations every 12 hours.
2023/04/17 19:05:27.550     INFO: [uvicorn.error]   Application startup complete.
2023/04/17 19:05:27.551     INFO: [uvicorn.error]   Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
2023/04/17 19:05:29.472     INFO: [cws.access]  125.114.7.87:0 | POST /system/server_logs HTTP/1.1 | 200 OK | 23 ms
2023/04/17 19:05:30.506     INFO: [cws.access]  125.114.7.87:0 | GET /user/me HTTP/1.1 | 200 OK | 7 ms
2023/04/17 19:05:30.886     INFO: [cws.access]  125.114.7.87:0 | GET /conv?fetch_all=false HTTP/1.1 | 200 OK | 22 ms
2023/04/17 19:05:35.624     INFO: [uvicorn.error]   ('125.114.2.29', 0) - "WebSocket /conv" [accepted]
2023/04/17 19:05:35.627     INFO: [uvicorn.error]   connection open
2023/04/17 19:05:35.630    DEBUG: [cws.api.routers.chat]    coolsd connected to websocket
2023/04/17 19:05:35.817    ERROR: [cws.api.routers.chat]    OpenAI:  (code: 500)
2023/04/17 19:05:35.818    DEBUG: [cws.api.routers.chat]    terminated ask None (ChatModels.default) because of error
2023/04/17 19:05:35.974     INFO: [uvicorn.error]   connection closed
2023/04/17 19:05:36.129     INFO: [cws.access]  125.114.7.87:0 | GET /user/me HTTP/1.1 | 200 OK | 6 ms
2023/04/17 19:05:40.278     INFO: [cws.access]  125.114.7.87:0 | GET /user/me HTTP/1.1 | 200 OK | 8 ms
2023/04/17 19:05:40.532     INFO: [cws.access]  125.114.7.87:0 | GET /conv?fetch_all=false HTTP/1.1 | 200 OK | 23 ms
2023/04/17 19:05:46.090     INFO: [uvicorn.error]   ('125.114.2.29', 0) - "WebSocket /conv" [accepted]
2023/04/17 19:05:46.092     INFO: [uvicorn.error]   connection open
2023/04/17 19:05:46.096    DEBUG: [cws.api.routers.chat]    coolsd connected to websocket
2023/04/17 19:05:46.281    ERROR: [cws.api.routers.chat]    OpenAI:  (code: 500)
2023/04/17 19:05:46.282    DEBUG: [cws.api.routers.chat]    terminated ask None (ChatModels.default) because of error
2023/04/17 19:05:46.444     INFO: [uvicorn.error]   connection closed
2023/04/17 19:05:46.600     INFO: [cws.access]  125.114.7.87:0 | GET /user/me HTTP/1.1 | 200 OK | 8 ms
moeakwak commented 1 year ago

尝试把 config 中的 chatgpt_base_url 设置成 http://你的公网ip:6060/

coolsd commented 1 year ago

获取回复失败 [1001] ChatGPT返回错误

mengcatcat199 commented 1 year ago

设置的公网也这样1014

mengcatcat199 commented 1 year ago

尝试把config中的chatgpt_base_url设置成http://你的公网ip:6060/

CF_CLEARANCE and USER_AGENT environment variables are required

coolsd commented 1 year ago

我用一台新的机器重新部署 提示 ERROR: for chatgpt-share Error: image moeakwak/chatgpt-web-share:latest not found ERROR: Error: image moeakwak/chatgpt-web-share:latest not found 大佬是在更新中吗

moeakwak commented 1 year ago

wiki更新了一些FAQ以及排查指南。只能说这个部署细节比较多,需要仔细一点。目前仍然可用。

JFHAO commented 1 year ago

1014这个问题解决了吗

moeakwak commented 1 year ago

1014之类的问题不是项目本身的问题,一部分是配置不对,一部分是网络、账号和token问题