Giter VIP home page Giter VIP logo

chatgpt-web-dev / chatgpt-web Goto Github PK

View Code? Open in Web Editor NEW
1.4K 14.0 413.0 8.88 MB

A third-party ChatGPT Web UI page built with Express and Vue3, through the official OpenAI completion API. / 用 Express 和 Vue3 搭建的第三方 ChatGPT 前端页面, 基于 OpenAI 官方 completion API.

Home Page: https://chatgpt-web.dev

License: MIT License

Shell 0.10% JavaScript 0.22% TypeScript 42.73% CSS 0.01% HTML 2.81% Vue 47.52% Dockerfile 0.21% Less 6.34% Batchfile 0.04%
ai chatgpt chatgpt-web cloud-sync expressjs naive-ui openai vue openai-api openai-chatgpt

chatgpt-web's Introduction

ChatGPT Web

中文 | English

说明

Important

此项目 Fork 自 Chanzhaoyu/chatgpt-web

由于原项目作者不愿意引入对数据库的依赖 故制作该永久分叉独立开发 详见讨论

再次感谢 Chanzhaoyu 大佬对开源的贡献 🙏

新增了部分特色功能:

[✓] 注册 & 登录 & 重置密码 & 2FA

[✓] 同步历史会话

[✓] 前端页面设置apikey

[✓] 自定义敏感词

[✓] 每个会话设置独有 Prompt

[✓] 用户管理

[✓] 多 Key 随机

[✓] 对话数量限制 & 设置不同用户对话数量 & 兑换数量

[✓] 通过 auth proxy 功能实现sso登录 (配合第三方身份验证反向代理 可实现支持 LDAP/OIDC/SAML 等协议登录)

Caution

声明:此项目只发布于 Github,基于 MIT 协议,免费且作为开源学习使用。并且不会有任何形式的卖号、付费服务、讨论群、讨论组等行为。谨防受骗。

截图

cover3 cover cover2 cover3 cover3 cover3 cover3 userlimit setmanuallimit giftcarddb

介绍

支持双模型,提供了两种非官方 ChatGPT API 方法

方式 免费? 可靠性 质量
ChatGPTAPI(gpt-3.5-turbo-0301) 可靠 相对较笨
ChatGPTUnofficialProxyAPI(网页 accessToken) 相对不可靠 聪明

对比:

  1. ChatGPTAPI 使用 gpt-3.5-turbo 通过 OpenAI 官方 API 调用 ChatGPT
  2. ChatGPTUnofficialProxyAPI 使用非官方代理服务器访问 ChatGPT 的后端API,绕过Cloudflare(依赖于第三方服务器,并且有速率限制)

警告:

  1. 你应该首先使用 API 方式
  2. 使用 API 时,如果网络不通,那是国内被墙了,你需要自建代理,绝对不要使用别人的公开代理,那是危险的。
  3. 使用 accessToken 方式时反向代理将向第三方暴露您的访问令牌,这样做应该不会产生任何不良影响,但在使用这种方法之前请考虑风险。
  4. 使用 accessToken 时,不管你是国内还是国外的机器,都会使用代理。默认代理为 pengzhile 大佬的 https://ai.fakeopen.com/api/conversation,这不是后门也不是监听,除非你有能力自己翻过 CF 验证,用前请知悉。社区代理(注意:只有这两个是推荐,其他第三方来源,请自行甄别)
  5. 把项目发布到公共网络时,你应该设置 AUTH_SECRET_KEY 变量添加你的密码访问权限,你也应该修改 index.html 中的 title,防止被关键词搜索到。

切换方式:

  1. 进入 service/.env.example 文件,复制内容到 service/.env 文件
  2. 使用 OpenAI API Key 请填写 OPENAI_API_KEY 字段 (获取 apiKey)
  3. 使用 Web API 请填写 OPENAI_ACCESS_TOKEN 字段 (获取 accessToken)
  4. 同时存在时以 OpenAI API Key 优先

环境变量:

全部参数变量请查看或这里

/service/.env.example

待实现路线

[✓] 双模型

[✓] 多会话储存和上下文逻辑

[✓] 对代码等消息类型的格式化美化处理

[✓] 支持用户登录注册

[✓] 前端页面设置 apikey 等信息

[✓] 数据导入、导出

[✓] 保存消息到本地图片

[✓] 界面多语言

[✓] 界面主题

[✗] More...

前置要求

Node

node 需要 ^16 || ^18 || ^19 版本(node >= 14 需要安装 fetch polyfill),使用 nvm 可管理本地多个 node 版本

node -v

PNPM

如果你没有安装过 pnpm

npm install pnpm -g

填写密钥

获取 Openai Api KeyaccessToken 并填写本地环境变量 跳转

# service/.env 文件

# OpenAI API Key - https://platform.openai.com/overview
OPENAI_API_KEY=

# change this to an `accessToken` extracted from the ChatGPT site's `https://chat.openai.com/api/auth/session` response
OPENAI_ACCESS_TOKEN=

安装依赖

为了简便 后端开发人员 的了解负担,所以并没有采用前端 workspace 模式,而是分文件夹存放。如果只需要前端页面做二次开发,删除 service 文件夹即可。

后端

进入文件夹 /service 运行以下命令

pnpm install

前端

根目录下运行以下命令

pnpm bootstrap

测试环境运行

后端服务

进入文件夹 /service 运行以下命令

pnpm start

前端网页

根目录下运行以下命令

pnpm dev

环境变量

API 可用:

  • OPENAI_API_KEYOPENAI_ACCESS_TOKEN 二选一
  • OPENAI_API_BASE_URL 设置接口地址,可选,默认:https://api.openai.com
  • OPENAI_API_DISABLE_DEBUG 设置接口关闭 debug 日志,可选,默认:empty 不关闭

ACCESS_TOKEN 可用:

  • OPENAI_ACCESS_TOKENOPENAI_API_KEY 二选一,同时存在时,OPENAI_API_KEY 优先
  • API_REVERSE_PROXY 设置反向代理,可选,默认:https://ai.fakeopen.com/api/conversation社区(注意:只有这两个是推荐,其他第三方来源,请自行甄别)

通用:

  • AUTH_SECRET_KEY 访问权限密钥,可选
  • MAX_REQUEST_PER_HOUR 每小时最大请求次数,可选,默认无限
  • TIMEOUT_MS 超时,单位毫秒,可选
  • SOCKS_PROXY_HOSTSOCKS_PROXY_PORT 一起时生效,可选
  • SOCKS_PROXY_PORTSOCKS_PROXY_HOST 一起时生效,可选
  • HTTPS_PROXY 支持 httphttps, socks5,可选

打包

使用 Docker

Docker 参数示例

docker

Docker build & Run

GIT_COMMIT_HASH=`git rev-parse HEAD`
RELEASE_VERSION=`git branch --show-current`
docker build --build-arg GIT_COMMIT_HASH=${GIT_COMMIT_HASH} --build-arg RELEASE_VERSION=${RELEASE_VERSION} -t chatgpt-web .

# 前台运行
# 如果在宿主机运行 mongodb 则使用 MONGODB_URL=mongodb://host.docker.internal:27017/chatgpt
docker run --name chatgpt-web --rm -it -p 3002:3002 --env OPENAI_API_KEY=your_api_key --env MONGODB_URL=your_mongodb_url chatgpt-web

# 后台运行
docker run --name chatgpt-web -d -p 127.0.0.1:3002:3002 --env OPENAI_API_KEY=your_api_key --env MONGODB_URL=your_mongodb_url chatgpt-web

# 运行地址
http://localhost:3002/

Docker compose

Hub 地址

version: '3'

services:
  app:
    image: chatgptweb/chatgpt-web # 总是使用latest,更新时重新pull该tag镜像即可
    container_name: chatgptweb
    restart: unless-stopped
    ports:
      - 3002:3002
    depends_on:
      - database
    environment:
      TZ: Asia/Shanghai
      # 每小时最大请求次数,可选,默认无限
      MAX_REQUEST_PER_HOUR: 0
      # 访问jwt加密参数,可选 不为空则允许登录 同时需要设置 MONGODB_URL
      AUTH_SECRET_KEY: xxx
      # 网站名称
      SITE_TITLE: ChatGpt Web
      # mongodb 的连接字符串
      MONGODB_URL: 'mongodb://chatgpt:xxxx@database:27017'
      # 开启注册之后 密码加密的盐
      PASSWORD_MD5_SALT: xxx
      # 开启注册之后 超级管理邮箱
      ROOT_USER: [email protected]
      # 网站是否开启注册 必须开启, 否则管理员都没法注册, 可后续关闭
      REGISTER_ENABLED: true
      # 更多配置, 在运行后, 注册管理员, 在管理员页面中设置
    links:
      - database

  database:
    image: mongo
    container_name: chatgptweb-database
    restart: unless-stopped
    ports:
      - '27017:27017'
    expose:
      - '27017'
    volumes:
      - mongodb:/data/db
    environment:
      MONGO_INITDB_ROOT_USERNAME: chatgpt
      MONGO_INITDB_ROOT_PASSWORD: xxxx
      MONGO_INITDB_DATABASE: chatgpt

volumes:
  mongodb: {}
  • OPENAI_API_BASE_URL 可选,设置 OPENAI_API_KEY 时可用

防止爬虫抓取

nginx

将下面配置填入nginx配置文件中,可以参考 docker-compose/nginx/nginx.conf 文件中添加反爬虫的方法

    # 防止爬虫抓取
    if ($http_user_agent ~* "360Spider|JikeSpider|Spider|spider|bot|Bot|2345Explorer|curl|wget|webZIP|qihoobot|Baiduspider|Googlebot|Googlebot-Mobile|Googlebot-Image|Mediapartners-Google|Adsbot-Google|Feedfetcher-Google|Yahoo! Slurp|Yahoo! Slurp China|YoudaoBot|Sosospider|Sogou spider|Sogou web spider|MSNBot|ia_archiver|Tomato Bot|NSPlayer|bingbot"){
      return 403;
    }

使用 Railway 部署

Deploy on Railway

参考这个 issue 详细教程 https://github.com/Kerwin1202/chatgpt-web/issues/266

注意: Railway 修改环境变量会重新 Deploy

手动打包

后端服务

如果你不需要本项目的 node 接口,可以省略如下操作

复制 service 文件夹到你有 node 服务环境的服务器上。

# 安装
pnpm install

# 打包
pnpm build

# 运行
pnpm prod

PS: 不进行打包,直接在服务器上运行 pnpm start 也可

前端网页

1、修改根目录下 .env 文件中的 VITE_GLOB_API_URL 为你的实际后端接口地址

2、根目录下运行以下命令,然后将 dist 文件夹内的文件复制到你网站服务的根目录下

参考信息

pnpm build

Auth Proxy Mode

Warning

该功能仅适用于有相关经验的运维人员在集成企业内部账号管理系统时部署 配置不当可能会导致安全风险

设置环境变量 AUTH_PROXY_ENABLED=true 即可开启 auth proxy 模式

在开启该功能后 需确保 chatgpt-web 只能通过反向代理访问

由反向代理进行进行身份验证 并再转发请求时携带请求头标识用户身份 默认请求头为 X-Email 并可以通过设置环境变量 AUTH_PROXY_HEADER_NAME 自定义配置

推荐当前 Idp 使用 LDAP 协议的 可以选择使用 authelia

当前 Idp 使用 OIDC 协议的 可以选择使用 oauth2-proxy

常见问题

Q: 为什么 Git 提交总是报错?

A: 因为有提交信息验证,请遵循 Commit 指南

Q: 如果只使用前端页面,在哪里改请求接口?

A: 根目录下 .env 文件中的 VITE_GLOB_API_URL 字段。

Q: 文件保存时全部爆红?

A: vscode 请安装项目推荐插件,或手动安装 Eslint 插件。

Q: 前端没有打字机效果?

A: 一种可能原因是经过 Nginx 反向代理,开启了 buffer,则 Nginx 会尝试从后端缓冲一定大小的数据再发送给浏览器。请尝试在反代参数后添加 proxy_buffering off;,然后重载 Nginx。其他 web server 配置同理。

参与贡献

贡献之前请先阅读 贡献指南

感谢所有做过贡献的人!

Contributors Image

Star 历史

Star History Chart

赞助

如果你觉得这个项目对你有帮助,请给我点个Star。并且情况允许的话,可以给我一点点支持,总之非常感谢支持~

微信

WeChat Pay

支付宝

Alipay


感谢 DigitalOcean 赞助提供开源积分用于运行基础设施服务器

digitalocean

License

MIT © github.com/chatgpt-web-dev Contributors

chatgpt-web's People

Contributors

assassinliujie avatar bobdu avatar ccjaread avatar chanzhaoyu avatar cornerskyless avatar dependabot[bot] avatar dwsy avatar erimus-koo avatar fanlu91 avatar kerwin1202 avatar lsvih avatar luckywang6 avatar marlkiller avatar nothing1024 avatar ottocsb avatar peterdavehello avatar popcell avatar puppywang avatar quzard avatar ryanxinone avatar shenkeeeew avatar shunyue1320 avatar simonwu53 avatar simulacraliasing avatar turbobit avatar vchenpeng avatar whatwewant avatar yi-ge avatar yilozt avatar zhujunsan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

chatgpt-web's Issues

谢谢大大开了issue

非常感谢,终于有一个可以交流的平台了 (ฅ´ω`ฅ)

刚刚收到了v2.12.0的更新通知。

期待docker image的更新!

加油 ⭐

登陆注册按钮在移动端隐藏太深

1、登陆注册按钮在移动端隐藏太深,需要自己展开左侧折叠栏才看到,会导致不熟悉的用户找不到登陆和注册按钮。
2、另外,重置密码的邮件链接点进去后是否能考虑直接打开输入框让用户输入新密码。

首次访问比较慢

首次访问比较慢,是 因为highlight.js和naive-ui库比较大的原因嘛? 有没有解决的方法

很喜欢该项目,有几点想法。

1.有没有开发用户管理功能,对用户进行一些限制,别人禁止使用,限制使用等
2.对聊天记录云储存在数据库上
3.增加一个公告弹窗(方便介绍和对用户通知等)
4.登陆优化(现在可以通过删除页面标签绕过,希望可以优化一下,只有登陆后才可以请求对话)

通过Access Token反向代理,回答字数过多会报错,无法显示完全

SyntaxError: Unexpected number in JSON at position 4
kerwin_chatgpt-app-1 | at JSON.parse ()
kerwin_chatgpt-app-1 | at onMessage (/app/node_modules/.pnpm/[email protected]/node_modules/chatgpt/build/index.js:622:47)
kerwin_chatgpt-app-1 | at (/app/node_modules/.pnpm/[email protected]/node_modules/chatgpt/build/index.js:62:7)
kerwin_chatgpt-app-1 | at parseEventStreamLine (/app/node_modules/.pnpm/[email protected]/node_modules/eventsource-parser/src/parse.ts:125:17)

docker-compose部署问题求助

用docker-compose部署,容器能够正常运行,注册用户也能够正常使用(包括超级管理员和普通用户都可以注册完成)
但是当登录时缺返回了:Cannot read properties of undefined (reading 'trim')
无法正常登录,求大神帮忙看看是哪里出问题了。
使用access token自建,搭配自建代理服务器
下面是我的配置文件(密码类已删除)

version: '3'

services:
    app:
        # 在https://hub.docker.com/r/kerwin1202/chatgpt-web/tags 里获得tag。或者写latest
        image: kerwin1202/chatgpt-web:latest
        restart: unless-stopped
        ports:
            - 10.0.0.2:3010:3002
    depends_on:
        - database
    environment:
        TZ: Asia/Shanghai
        # 从OpenAI后台里获得
        #OPENAI_API_KEY: sk-XXX # 按需修改
        # 访问jwt加密参数,可选 不为空则允许登录 同时需要设置 MONGODB_URL
        #AUTH_SECRET_KEY: 12345678abcdefg # 按需修改
        # 你的openai access token
        OPENAI_ACCESS_TOKEN: xxxxxxxxxxxxxxxxxxx
        # OpenAI绕过Cloudflare验证的反向代理
        # API_REVERSE_PROXY: https://bypass.churchless.tech/api/conversation
        API_REVERSE_PROXY: http://10.0.0.7:8880/conversation
        # 超时,单位毫秒,可选
        TIMEOUT_MS: 60000
        # 网站名
        SITE_TITLE: 'Chat Bot' # 按需修改。写个自己喜欢的名字就行
        # mongodb 的连接字符串
        MONGODB_URL: 'mongodb://u1:pwd1@database:27017' # 按需修改
        # 网站是否开启注册
        REGISTER_ENABLED: true # 完成注册后,这一项要改为false
        # 开启注册之后 网站注册允许的邮箱后缀 如果空 则允许任意后缀
        REGISTER_MAILS: '@qq.com,@gmail.com,@163.com' # 按需修改
        # 加密盐。算法: echo -n 'passwordsalt' | md5sum | cut -c 1-32
        PASSWORD_MD5_SALT: Sd2k4o # 按需修改
        # 开启注册之后 超级管理员的邮箱
        ROOT_USER: [[email protected]](mailto:[email protected]) # 按需修改
        # 开启注册之后网站域名 不含 / 。注册的时候发送验证邮箱使用
        SITE_DOMAIN: https://xxx.oooo.cf/ # 按需修改
        # 开启注册之后 发送验证邮箱配置
        SMTP_HOST: smtp.163.com
        SMTP_PORT: 465 # 也可以尝试587 或者 465
        SMTP_TSL: true
        SMTP_USERNAME: [[email protected]](mailto:[email protected]) # 按需修改
        SMTP_PASSWORD: xxxxxxxxxxxxx# 按需修改
    links:
        - database

    database:
        image: mongo:3.6
        restart: unless-stopped
        expose:
            - '27017'
        volumes:
            - ./mongodb:/data/db
        environment:
            MONGO_INITDB_ROOT_USERNAME: u1# 按需修改
            MONGO_INITDB_ROOT_PASSWORD: pwd1# 按需修改
            MONGO_INITDB_DATABASE: chatgpt

    gui:
        image: mongo-express:1.0.0-alpha
        restart: unless-stopped
        ports:
            - 10.0.0.2:3011:8081
        environment:
            # 选择主题。详见: http://codemirror.net/demo/theme.html
            ME_CONFIG_OPTIONS_EDITORTHEME: ambiance
            # 数据库信息
            ME_CONFIG_BASICAUTH_USERNAME: u2
            ME_CONFIG_BASICAUTH_PASSWORD: pwd2
            ME_CONFIG_MONGODB_URL: 'mongodb://u1:pwd1@database:27017'
            ME_CONFIG_MONGODB_ENABLE_ADMIN: u2# 可能不是必要的
            ME_CONFIG_MONGODB_ADMINUSERNAME: chatgpt # 可能不是必要的
            ME_CONFIG_MONGODB_ADMINPASSWORD: pwd2# 可能不是必要的
    volumes:
        mongodb: {}

大佬数据库怎么配置啊一直报错

大佬数据库怎么配置啊一直报错

[email protected] start /root/chatgpt-web/service
esno ./src/index.ts

Server is running on port 3002
/root/chatgpt-web/service/node_modules/.pnpm/[email protected]/node_modules/mongodb/lib/cmap/connection.js:201
callback(new error_1.MongoServerError(document));
^

MongoServerError: Authentication failed.
at Connection.onMessage (/root/chatgpt-web/service/node_modules/.pnpm/[email protected]/node_modules/mongodb/lib/cmap/connection.js:201:30)
at MessageStream. (/root/chatgpt-web/service/node_modules/.pnpm/[email protected]/node_modules/mongodb/lib/cmap/connection.js:59:60)
at MessageStream.emit (node:events:513:28)
at MessageStream.emit (node:domain:489:12)
at processIncomingData (/root/chatgpt-web/service/node_modules/.pnpm/[email protected]/node_modules/mongodb/lib/cmap/message_stream.js:124:16)
at MessageStream._write (/root/chatgpt-web/service/node_modules/.pnpm/[email protected]/node_modules/mongodb/lib/cmap/message_stream.js:33:9)
at writeOrBuffer (node:internal/streams/writable:392:12)
at _write (node:internal/streams/writable:333:10)
at Writable.write (node:internal/streams/writable:337:10)
at Socket.ondata (node:internal/streams/readable:766:22) {
ok: 0,
code: 18,
codeName: 'AuthenticationFailed',
connectionGeneration: 0,
[Symbol(errorLabels)]: Set(2) { 'HandshakeError', 'ResetPool' }
}

Node.js v18.12.0
 ELIFECYCLE  Command failed with exit code 1.

数据库写死最高版本,以致硬件要求过高 无法使用

大佬 有一些疑问,这个项目是不是写死 mongo5了?
这个项目没有内置数据库,所以要分别进行部署吧,这样的话 是不是没必要版本限制这么严格?

我目前使用的群晖的920+,docker安装mongo 数据库,有以下报错:
WARNING: MongoDB 5.0+ requires a CPU with AVX support, and your current system does not appear to have that!
作为普通的个人用户,是不是对硬件要求过高了。

更换mongo4 数据库后,虽然数据库能正常运行,但是这个项目又有报错
/app/node_modules/.pnpm/[email protected]/node_modules/mongodb/lib/sdam/topology.js:277
const timeoutError = new error_1.MongoServerSelectionError(Server selection timed out after ${serverSelectionTimeoutMS} ms, this.description);
MongoServerSelectionError: getaddrinfo ENOTFOUND database
at Timeout._onTimeout (/app/node_modules/.pnpm/[email protected]/node_modules/mongodb/lib/sdam/topology.js:277:38)
at listOnTimeout (node:internal/timers:569:17)
at process.processTimers (node:internal/timers:512:7) {
reason: TopologyDescription {

看报错信息好像是要mongo5 数据库。

关于数据库这个问题 能否做些兼容处理。我觉得我这个配置还是比较大众的。

[New features] 关于tokens计数的进一步运用

您好!

我注意到,在v2.12.1后, 本项目支持了token计数,比如:

{
    _id: ObjectId('643b2e871452231dxxxxxx'),
    userId: '6434ea07160xxx',
    roomId: 1681211599xxx,
    chatId: ObjectId('643b2e771452231dda89dxxx'),
    messageId: 'chatcmpl-75jIVgi6IR7LuX7dQHE1xxxx',
    promptTokens: 45,
    completionTokens: 522,
    totalTokens: 567,
    estimated: true,
    dateTime: 168160xxx
}

基于此,似乎可以提供关于某userId在某时间段内的token消耗,还可以限制token消耗上限。 不知未来是否有相应的开发计划呢?

建议会话列表增加关键字搜索功能

建议会话列表增加关键字搜索功能,增加接口数据库搜索,模糊搜索标题和聊天记录,如果速度慢的,可以考虑先实现标题搜索或者前端缓存的对象变量过滤。

建议增加自动生成标题选项

建议增加自动生成标题选项,将该选项保存在个人配置中,通过第一次的问和答发给接口生成标题,提问可以参考这个项目:https://github.com/ztjhz/BetterChatGPT
F12看它post的内容即可,此功能消耗token,但能使会话列表更顺眼。兄弟好有效率,我继续提需求,哈哈。

Bug: 使用access token时存在 Cannot read properties of undefined (reading 'choices') 报错

发送消息时,前端界面出现如下报错:

Cannot read properties of undefined (reading 'choices')

日志如下:

token_chatgpt-app-1       | TypeError: Cannot read properties of undefined (reading 'choices')
token_chatgpt-app-1       |     at process (/app/build/index.js:10469:44)
token_chatgpt-app-1       |     at onProgress (/app/build/index.js:9961:9)
token_chatgpt-app-1       |     at onMessage (/app/node_modules/.pnpm/[email protected]/node_modules/chatgpt/build/index.js:635:21)
token_chatgpt-app-1       |     at <anonymous> (/app/node_modules/.pnpm/[email protected]/node_modules/chatgpt/build/index.js:62:7)
token_chatgpt-app-1       |     at parseEventStreamLine (/app/node_modules/.pnpm/[email protected]/node_modules/eventsource-parser/src/parse.ts:125:17)
token_chatgpt-app-1       |     at Object.feed (/app/node_modules/.pnpm/[email protected]/node_modules/eventsource-parser/src/parse.ts:101:28)
token_chatgpt-app-1       |     at feed (/app/node_modules/.pnpm/[email protected]/node_modules/chatgpt/build/index.js:84:12)
token_chatgpt-app-1       |     at fetchSSE (/app/node_modules/.pnpm/[email protected]/node_modules/chatgpt/build/index.js:100:7)
token_chatgpt-app-1       |     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
token_chatgpt-app-1       | TypeError: Cannot read properties of undefined (reading 'usage')
token_chatgpt-app-1       |     at <anonymous> (/app/build/index.js:10508:30)
token_chatgpt-app-1       |     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
token_chatgpt-database-1  | 2023-04-16T10:07:32.856+0000 I STORAGE  [conn3] createCollection: chatgpt.chat with generated UUID: 807d04cb-8448-400f-92df-5497f8f8732d

docker-compose.yml内容类似:

version: '3'

services:
  app:
    image: kerwin1202/chatgpt-web:v2.12.1 # 总是使用latest,更新时重新pull该tag镜像即可
    restart: unless-stopped
    ports:
      - 3002:3002
    depends_on:
      - database
    environment:
      TZ: Asia/Shanghai
      OPENAI_ACCESS_TOKEN: eyJh-xxx-cg
      API_REVERSE_PROXY: http://xxx:8080/conversation # 自建并经过他人验证的反代
      AUTH_SECRET_KEY: 8jxxx
      TIMEOUT_MS: 60000
      SITE_TITLE: TokenChat
      MONGODB_URL: 'mongodb://chatgpt:password01@database:27017'
      REGISTER_ENABLED: true
      REGISTER_MAILS: '@qq.com,@gmail.com,@163.com'
      PASSWORD_MD5_SALT: tNxxx
      ROOT_USER: [email protected]
      SITE_DOMAIN: https://xxx.com
      SMTP_HOST: smtp.qq.com
      SMTP_PORT: 465
      SMTP_TSL: true
      SMTP_USERNAME: [email protected]
      SMTP_PASSWORD: xxx
    links:
      - database

  database:
    image: mongo:3.6
    restart: unless-stopped
    # ports:
    #  - '27017:27017'
    expose:
      - '27017'
    volumes:
      - ./mongodb:/data/db
    environment:
      MONGO_INITDB_ROOT_USERNAME: chatgpt
      MONGO_INITDB_ROOT_PASSWORD: password01
      MONGO_INITDB_DATABASE: chatgpt

  gui:
    image: mongo-express:1.0.0-alpha
    restart: unless-stopped
    ports:
      - "8081:8081"
    environment:
      ME_CONFIG_OPTIONS_EDITORTHEME: ambiance
      ME_CONFIG_BASICAUTH_USERNAME: a4xxx
      ME_CONFIG_BASICAUTH_PASSWORD: zzxxx
      ME_CONFIG_MONGODB_ENABLE_ADMIN: true
      ME_CONFIG_MONGODB_ADMINUSERNAME: chatgpt
      ME_CONFIG_MONGODB_ADMINPASSWORD: password01
      ME_CONFIG_MONGODB_URL: 'mongodb://chatgpt:password01@database:27017'

日志的提示似乎是指token模式下没有找到usage这一collection (它只对API模式生效)。 是否是bug?

suggestion: Build-in prompts

is it possible to add build-in prompts?

For example:

Ready to use prompts after deploying. Like some essential prompts: paraphrasing, dictionary etc.. users don't have to import those prompts. these prompts is globally enabled for all users. I think this will make the project more attractive.

聊天记录加载异常

频率:几乎每次必现
平台:手机以及chrome都会出现

error(F12控制台信息)


index-6af8a255.js:319
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'uuid') at Ye (index-6af8a255.js:319:2487) at n (index-d7a924be.js:3105:21180)
  Ye @ index-6af8a255.js:319
  n @ index-d7a924be.js:3105
  setTimeout(异步)    
  (匿名) @ index-d7a924be.js:3105
  ge @ index-6af8a255.js:319
  on @ index-d7a924be.js:1
  Bo @ index-d7a924be.js:1
  o @ index-d7a924be.js:1

image

用户不存在的,登录判断有bug

应改成:
if (user == null || user.password !== md5(password))
throw new Error('用户不存在或密码错误 | User does not exist or incorrect password.')

用mongoDB跑不起来

一开始显示mongoDB显示不支持AVX指令集 (WARNING: MongoDB 5.0+ requires a CPU with AVX support, and your current system does not appear to have that!),
后面降级到mongoDB4.4后可以运行了但是还是连不上数据库
image
image
感觉数据库直接用sqlite就行了,并不需要多高的性能

关于 accessToken 的一些问题

Screenshot_2023-04-24-23-11-14-51_32cba261fc08a501ce70de75bdbe2575
出现如图所示的问题是不是因为我使用了 accessToken,本人和用户同时使用,请求太快。如果我使用 key 并且添加 HTTP 代理就不会出现这个问题,
另外,回答不完整应该怎么解决
Screenshot_2023-04-24-23-13-01-00_df198e732186825c8df26e3c5a10d7cd

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.