Code Monkey home page Code Monkey logo

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

View Code? Open in Web Editor NEW
1.4K 14.0 417.0 8.99 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 Issues

首次访问比较慢

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

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

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

[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.

谢谢大大开了issue

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

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

期待docker image的更新!

加油 ⭐

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: {}

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

建议增加自动生成标题选项,将该选项保存在个人配置中,通过第一次的问和答发给接口生成标题,提问可以参考这个项目: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?

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

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

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

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

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.

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

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

用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就行了,并不需要多高的性能

通过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)

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

大佬 有一些疑问,这个项目是不是写死 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消耗上限。 不知未来是否有相应的开发计划呢?

聊天记录加载异常

频率:几乎每次必现
平台:手机以及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

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

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

关于 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.