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.26k stars 679 forks source link

页面提示"Request Error" (AxiosError 500 for /status/common) #335

Closed youran closed 9 months ago

youran commented 9 months ago

Version v0.4.5

What's your deploying environment?

Describe the problem 登录并打开 http://my-server-ip:5000/admin/system 后,提示Request Error错误。 没有连上我的chatgpt plus账号,没有数据传过来。

Your config.yaml or other configurations

openai_web:
  enabled: true
  is_plus_account: true
  chatgpt_base_url: http://ninja:7999/backend-api/docker
  proxy:
  common_timeout: 20
  ask_timeout: 600
  sync_conversations_on_startup: false
  sync_conversations_schedule: false
  sync_conversations_schedule_interval_hours: 12
  enabled_models:
  - gpt_3_5
  - gpt_4
  - gpt_4_plugins
  model_code_mapping:
    gpt_3_5: text-davinci-002-render-sha
    gpt_3_5_mobile: text-davinci-002-render-sha-mobile
    gpt_4: gpt-4
    gpt_4_mobile: gpt-4-mobile
    gpt_4_browsing: gpt-4-browsing
    gpt_4_plugins: gpt-4-plugins
    gpt_4_code_interpreter: gpt-4-code-interpreter
    gpt_4_dalle: gpt-4-dalle
  file_upload_strategy: browser_upload_only
  disable_uploading: false
openai_api:
  enabled: true
  openai_base_url: https://api.openai.com/v1/
  proxy:
  connect_timeout: 10
  read_timeout: 20
  enabled_models:
  - gpt_3_5
  - gpt_4
  model_code_mapping:
    gpt_3_5: gpt-3.5-turbo
    gpt_4: gpt-4
common:
  print_sql: false
  create_initial_admin_user: true
  initial_admin_user_username: admin
  initial_admin_user_password: password
http:
  host: 127.0.0.1
  port: 8000
  cors_allow_origins:
  - http://localhost:8000
  - http://localhost:5173
  - http://127.0.0.1:8000
  - http://127.0.0.1:5173
data:
  data_dir: ./data
  database_url: sqlite+aiosqlite:///data/database.db
  mongodb_url: mongodb://cws:password@mongo:27017
  mongodb_db_name: cws
  run_migration: false
  max_file_upload_size: 104857600
auth:
  jwt_secret: k3QTvJpsA9WGYJ8z
  jwt_lifetime_seconds: 259200
  cookie_max_age: 259200
  user_secret: h58YLOOxnzkjXwEe
stats:
  ask_stats_ttl: 7776000
  request_stats_ttl: 2592000
  request_stats_filter_keywords:
  - /status
log:
  console_log_level: INFO

Screenshots or running logs

Untitled

docker logs cws -f日志:

2024/01/03 15:52:53.246     INFO: [uvicorn.error] Started server process [1]
2024/01/03 15:52:53.247     INFO: [uvicorn.error] Waiting for application startup.
2024/01/03 15:52:53.254     INFO: [cws.api.database.sqlalchemy] Database initialized.
2024/01/03 15:52:53.332     INFO: [cws.api.database.mongodb] MongoDB initialized. dataSize: 0.01 MB, objects: 20
2024/01/03 15:52:53.392     INFO: [cws.main] Using http://ninja:7999/backend-api/docker/ as ChatGPT base url
2024/01/03 15:52:53.393     INFO: [cws.main] Sync conversations on startup disabled.
2024/01/03 15:52:53.393     INFO: [uvicorn.error] Application startup complete.
2024/01/03 15:52:53.394     INFO: [uvicorn.error] Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
2024/01/03 15:53:38.178     INFO: [cws.access] 181.192.49.33:0 | GET /user/me HTTP/1.1 | 200 OK | 104 ms
2024/01/03 15:53:38.738     INFO: [cws.access] 181.192.49.33:0 | GET /status/common HTTP/1.1 | None - | 58 ms
2024/01/03 15:53:38.738    ERROR: [uvicorn.error] ASGI callable returned without starting response.
2024/01/03 15:53:38.755     INFO: [cws.access] 181.192.49.33:0 | GET /system/stats/request?granularity=1800 HTTP/1.1 | 200 OK | 66 ms
2024/01/03 15:53:38.771     INFO: [cws.access] 181.192.49.33:0 | GET /system/info HTTP/1.1 | 200 OK | 70 ms
2024/01/03 15:53:38.782     INFO: [cws.access] 181.192.49.33:0 | GET /system/stats/ask?granularity=1800 HTTP/1.1 | 200 OK | 67 ms
2024/01/03 15:53:38.939     INFO: [cws.access] 181.192.49.33:0 | GET /user HTTP/1.1 | 200 OK | 21 ms

浏览器console里有AxiosError: Request failed with status code 500错误:

{
    "message": "Request failed with status code 500",
    "name": "AxiosError",
    "stack": "AxiosError: Request failed with status code 500\n    at il (http://xxx.xxx.xxx.xxx:5000/assets/index-ZQmRe8Gt.js:3:1042)\n    at XMLHttpRequest.A (http://xxx.xxx.xxx.xxx:5000/assets/index-ZQmRe8Gt.js:3:4231)",
    "config": {
        "transitional": {
            "silentJSONParsing": true,
            "forcedJSONParsing": true,
            "clarifyTimeoutError": false
        },
        "adapter": [
            "xhr",
            "http"
        ],
        "transformRequest": [
            null
        ],
        "transformResponse": [
            null
        ],
        "timeout": 0,
        "xsrfCookieName": "XSRF-TOKEN",
        "xsrfHeaderName": "X-XSRF-TOKEN",
        "maxContentLength": -1,
        "maxBodyLength": -1,
        "env": {},
        "headers": {
            "Accept": "application/json, text/plain, */*"
        },
        "baseURL": "/api/",
        "method": "get",
        "url": "/status/common"
    },
    "code": "ERR_BAD_RESPONSE",
    "status": 500
}

Additional context har文件已通过/har/upload页面上传,并且已经在CWS 的后台设置中的 credentials 中填入了GPT-4 accessToken的内容。 docker-compose.yml直接复制自https://cws-docs.pages.dev/zh/guide/quick-start.html的示例。

youran commented 9 months ago

chatgpt_base_url值设为http://ninja:7999/backend-api/ (去掉docker)后问题解决