Closed dfggggx198601 closed 1 year ago
received non-nil error from function "chatplus/store".NewRedisClient
/go/chatgpt-plus/api/store/redis.go:9:
dial tcp 127.0.0.1:6379: connect: connection refused
报错很明显,是 Redis 连接不上。
我建了一个redis的容器,现在又有不同的报错,请看一下 2023/09/07 23:32:59 could not build arguments for function "main".main.func7 (/go/chatgpt-plus/api/main.go:144): failed to build handler.UserHandler: could not build arguments for function "chatplus/handler".NewUserHandler (/go/chatgpt-plus/api/handler/user_handler.go:32): failed to build oss.UploaderManager: received non-nil error from function "chatplus/service/oss".NewUploaderManager (/go/chatgpt-plus/api/service/oss/uploader_manager.go:16): parse "http://IP:端口": invalid port ":端口" after host 2023-09-07T23:33:03.464+0800 INFO api/main.go:62 Loading config file: config.toml [Fx] PROVIDE types.AppConfig <= main.main.func2() [Fx] PROVIDE core.AppServer <= chatplus/core.NewServer() [Fx] PROVIDE gorm.Config <= chatplus/store.NewGormConfig() [Fx] PROVIDE gorm.DB <= chatplus/store.NewMysql() [Fx] PROVIDE store.LevelDB <= chatplus/store.NewLevelDB() [Fx] PROVIDE redis.Client <= chatplus/store.NewRedisClient() [Fx] PROVIDE xdb.Searcher <= main.main.func4() [Fx] PROVIDE map[string]function.Function <= chatplus/service/function.NewFunctions() [Fx] PROVIDE handler.ChatRoleHandler <= chatplus/handler.NewChatRoleHandler() [Fx] PROVIDE handler.UserHandler <= chatplus/handler.NewUserHandler() [Fx] PROVIDE handler.ChatHandler <= chatplus/handler.NewChatHandler() [Fx] PROVIDE handler.UploadHandler <= chatplus/handler.NewUploadHandler() [Fx] PROVIDE handler.SmsHandler <= chatplus/handler.NewSmsHandler() [Fx] PROVIDE handler.RewardHandler <= chatplus/handler.NewRewardHandler() [Fx] PROVIDE handler.CaptchaHandler <= chatplus/handler.NewCaptchaHandler() [Fx] PROVIDE handler.MidJourneyHandler <= chatplus/handler.NewMidJourneyHandler() [Fx] PROVIDE handler.ChatModelHandler <= chatplus/handler.NewChatModelHandler() [Fx] PROVIDE admin.ConfigHandler <= chatplus/handler/admin.NewConfigHandler() [Fx] PROVIDE admin.ManagerHandler <= chatplus/handler/admin.NewAdminHandler() [Fx] PROVIDE admin.ApiKeyHandler <= chatplus/handler/admin.NewApiKeyHandler() [Fx] PROVIDE admin.UserHandler <= chatplus/handler/admin.NewUserHandler() [Fx] PROVIDE admin.ChatRoleHandler <= chatplus/handler/admin.NewChatRoleHandler() [Fx] PROVIDE admin.RewardHandler <= chatplus/handler/admin.NewRewardHandler() [Fx] PROVIDE admin.DashboardHandler <= chatplus/handler/admin.NewDashboardHandler() [Fx] PROVIDE admin.ChatModelHandler <= chatplus/handler/admin.NewChatModelHandler() [Fx] PROVIDE service.AliYunSmsService <= chatplus/service.NewAliYunSmsService() [Fx] PROVIDE service.CaptchaService <= main.main.func5() [Fx] PROVIDE oss.UploaderManager <= chatplus/service/oss.NewUploaderManager() [Fx] PROVIDE fx.Lifecycle <= go.uber.org/fx.New.func1() [Fx] PROVIDE fx.Shutdowner <= go.uber.org/fx.(App).shutdowner-fm() [Fx] PROVIDE fx.DotGraph <= go.uber.org/fx.(App).dotGraph-fm() [Fx] INVOKE main.main.func3() [Fx] INVOKE main.main.func6() [Fx] INVOKE main.main.func7() [Fx] ERROR fx.Invoke(main.main.func7()) called from: main.main /go/chatgpt-plus/api/main.go:144 runtime.main /usr/local/go/src/runtime/proc.go:250 Failed: could not build arguments for function "main".main.func7 /go/chatgpt-plus/api/main.go:144: failed to build handler.UserHandler: could not build arguments for function "chatplus/handler".NewUserHandler /go/chatgpt-plus/api/handler/user_handler.go:32: failed to build oss.UploaderManager: received non-nil error from function "chatplus/service/oss".NewUploaderManager /go/chatgpt-plus/api/service/oss/uploader_manager.go:16: parse "http://IP:端口": invalid port ":端口" after host [Fx] ERROR Failed to start: could not build arguments for function "main".main.func7 /go/chatgpt-plus/api/main.go:144: failed to build handler.UserHandler: could not build arguments for function "chatplus/handler".NewUserHandler /go/chatgpt-plus/api/handler/user_handler.go:32: failed to build oss.UploaderManager: received non-nil error from function "chatplus/service/oss".NewUploaderManager /go/chatgpt-plus/api/service/oss/uploader_manager.go:16: parse "http://IP:端口": invalid port ":端口" after host 2023/09/07 23:33:03 could not build arguments for function "main".main.func7 (/go/chatgpt-plus/api/main.go:144): failed to build handler.UserHandler: could not build arguments for function "chatplus/handler".NewUserHandler (/go/chatgpt-plus/api/handler/user_handler.go:32): failed to build *oss.UploaderManager: received non-nil error from function "chatplus/service/oss".NewUploaderManager (/go/chatgpt-plus/api/service/oss/uploader_manager.go:16): parse "http://IP:端口": invalid port ":端口" after host
原来,使用docker部署的话,config.toml文件中,要使用项目首页的配置文件信息并将其他不用的参数使用#来注释掉,不然就会报错,这还是因为我基本功不行,另外,跑起来以后,页面打开较慢,一直在转圈
文件上传默认是使用本地上传服务的,如果你没有启用 Minio 和七牛云的 OSS 的话,把配置删了或者留空,系统就不会创建相应的上传服务对象。不过我刚刚已经提交了一个紧急修复了,你更新到 main 分支最新代码即可。
页面打开转圈圈可能是浏览器控制台有报错,你要提供截图。
控制台倒一开始没有报错,请看截图,,不仅转圈,还有其他的报错,突然跳转到登录界面 过了一会,就有如下的报错了
加载用户列表失败,应该是后台出错了。具体要看 API 返回什么报错信息。
以下是报错信息
2023/09/11 21:01:58 /go/chatgpt-plus/api/handler/admin/dashboard_handler.go:51 sql: Scan error on column index 0, name "total": converting NULL to int64 is unsupported
[0.662ms] [rows:1] SELECT sum(tokens) as total FROM chatgpt_chat_history
WHERE created_at > '2023-09-11 00:00:00' AND chatgpt_chat_history
.deleted_at
IS NULL
2023/09/11 21:01:58 /go/chatgpt-plus/api/handler/admin/dashboard_handler.go:58 sql: Scan error on column index 0, name "total": converting NULL to float64 is unsupported
[0.682ms] [rows:1] SELECT sum(amount) as total FROM chatgpt_rewards
WHERE created_at > '2023-09-11 00:00:00'
2023/09/11 21:02:46 /go/chatgpt-plus/api/handler/admin/dashboard_handler.go:51 sql: Scan error on column index 0, name "total": converting NULL to int64 is unsupported
[0.558ms] [rows:1] SELECT sum(tokens) as total FROM chatgpt_chat_history
WHERE created_at > '2023-09-11 00:00:00' AND chatgpt_chat_history
.deleted_at
IS NULL
2023/09/11 21:02:46 /go/chatgpt-plus/api/handler/admin/dashboard_handler.go:58 sql: Scan error on column index 0, name "total": converting NULL to float64 is unsupported
[1.076ms] [rows:1] SELECT sum(amount) as total FROM chatgpt_rewards
WHERE created_at > '2023-09-11 00:00:00'
2023/09/11 21:03:38 /go/chatgpt-plus/api/handler/chat_handler.go:85 record not found
[0.447ms] [rows:0] SELECT * FROM chatgpt_chat_items
WHERE chat_id='ab406436-bdcf-4904-bcca-18342fe3ed1b' AND chatgpt_chat_items
.deleted_at
IS NULL ORDER BY chatgpt_chat_items
.id
LIMIT 1
2023-09-11T21:03:38.915+0800 INFO handler/chat_handler.go:96 New websocket connected, IP: 20.14.92.85:56938, Username: 123456
2023-09-11T21:03:40.956+0800 ERROR handler/chat_handler.go:121 websocket: close 1005 (no status)
2023-09-11T21:03:41.470+0800 INFO handler/chat_handler.go:96 New websocket connected, IP: 20.14.92.85:56954, Username: 123456
2023/09/11 21:03:46 /go/chatgpt-plus/api/handler/chat_handler.go:85 record not found
[0.493ms] [rows:0] SELECT * FROM chatgpt_chat_items
WHERE chat_id='ab406436-bdcf-4904-bcca-18342fe3ed1b' AND chatgpt_chat_items
.deleted_at
IS NULL ORDER BY chatgpt_chat_items
.id
LIMIT 1
2023-09-11T21:03:46.354+0800 INFO handler/chat_handler.go:96 New websocket connected, IP: 20.14.92.85:38982, Username: 123456
2023-09-11T21:03:52.676+0800 ERROR handler/chat_handler.go:121 websocket: close 1005 (no status)
2023/09/11 21:03:54 /go/chatgpt-plus/api/handler/chat_handler.go:85 record not found
[0.473ms] [rows:0] SELECT * FROM chatgpt_chat_items
WHERE chat_id='ccb36ec9-9e8d-44f7-9eda-0329c5dc4edd' AND chatgpt_chat_items
.deleted_at
IS NULL ORDER BY chatgpt_chat_items
.id
LIMIT 1
2023-09-11T21:03:54.179+0800 INFO handler/chat_handler.go:96 New websocket connected, IP: 20.14.92.85:59934, Username: 123456
2023/09/11 21:03:56 /go/chatgpt-plus/api/handler/chat_handler.go:85 record not found
[0.475ms] [rows:0] SELECT * FROM chatgpt_chat_items
WHERE chat_id='ab406436-bdcf-4904-bcca-18342fe3ed1b' AND chatgpt_chat_items
.deleted_at
IS NULL ORDER BY chatgpt_chat_items
.id
LIMIT 1
2023-09-11T21:03:56.291+0800 INFO handler/chat_handler.go:96 New websocket connected, IP: 20.14.92.85:59940, Username: 123456
虽然等了挺久,但是还是可以正常打开界面,下面是开始对话后的一些异常信息
2023/09/11 21:13:24 /go/chatgpt-plus/api/handler/openai_handler.go:265 record not found
[0.501ms] [rows:0] SELECT * FROM chatgpt_chat_items
WHERE chat_id = 'dfa86294-4e70-412c-aba9-0299ff095b32' AND chatgpt_chat_items
.deleted_at
IS NULL ORDER BY chatgpt_chat_items
.id
LIMIT 1
2023-09-11T21:13:24.592+0800 INFO handler/chat_handler.go:139 回答完毕: 你是谁
2023-09-11T21:13:39.418+0800 INFO handler/chat_handler.go:129 Receive a message: 你是gpt4吗
2023-09-11T21:13:39.427+0800 INFO handler/chat_handler.go:381 Sending OpenAI request, KEY: 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, PROXY: , Model: gpt-3.5-turbo-16k
2023-09-11T21:13:39.904+0800 INFO handler/openai_handler.go:33 HTTP请求完成,耗时:485.105256ms
2023-09-11T21:13:44.402+0800 INFO handler/chat_handler.go:139 回答完毕: 你是gpt4吗
2023-09-11T21:13:50.257+0800 ERROR handler/chat_handler.go:121 websocket: close 1006 (abnormal closure): unexpected EOF
2023-09-11T21:13:59.077+0800 ERROR handler/chat_handler.go:121 websocket: close 1006 (abnormal closure): unexpected EOF
2023-09-11T21:14:06.201+0800 INFO handler/chat_handler.go:96 New websocket connected, IP: 20.14.92.85:37388, Username: 123456
2023-09-11T21:14:06.544+0800 ERROR handler/chat_handler.go:121 websocket: close 1005 (no status)
2023/09/11 21:14:07 /go/chatgpt-plus/api/handler/chat_handler.go:85 record not found
[0.515ms] [rows:0] SELECT * FROM chatgpt_chat_items
WHERE chat_id='ccb36ec9-9e8d-44f7-9eda-0329c5dc4edd' AND chatgpt_chat_items
.deleted_at
IS NULL ORDER BY chatgpt_chat_items
.id
LIMIT 1
2023-09-11T21:14:07.118+0800 INFO handler/chat_handler.go:96 New websocket connected, IP: 20.14.92.85:37400, Username: 123456
2023-09-11T21:14:12.839+0800 INFO handler/chat_handler.go:96 New websocket connected, IP: 20.14.92.85:37444, Username: 123456
这些都是正常的聊天程序的日志信息。没有发现异常报错的日志。你不是说后台管理界面报错吗。看着报错信息像是网络问题。卡了很久最后失败了这种情况。建议你再仔细排查下是不是地址写错了, 这访问地址看起来有问题,中间还有空格。
地址没问题,其实这种报错的情况,并不是一直报错,昨晚试了一下,访问又正常了,现在就是这种一会儿行一会儿不行的情况 2023-09-11T21:13:50.257+0800 ERROR handler/chat_handler.go:121 websocket: close 1006 (abnormal closure): unexpected EOF 2023-09-11T21:13:59.077+0800 ERROR handler/chat_handler.go:121 websocket: close 1006 (abnormal closure): unexpected EOF 2023-09-11T21:14:06.201+0800 INFO handler/chat_handler.go:96 New websocket connected, IP: 20.14.92.85:37388, Username: 123456 2023-09-11T21:14:06.544+0800 ERROR handler/chat_handler.go:121 websocket: close 1005 (no status)
2023/09/11 21:14:07 /go/chatgpt-plus/api/handler/chat_handler.go:85 record not found 因为我看日志这里有些报错,不知道是否正常现象
received non-nil error from function "chatplus/store".NewRedisClient /go/chatgpt-plus/api/store/redis.go:9: dial tcp 127.0.0.1:6379: connect: connection refused Redis 连接不上怎么解决啊
原来,使用docker部署的话,config.toml文件中,要使用项目首页的配置文件信息并将其他不用的参数使用#来注释掉,不然就会报错,这还是因为我基本功不行,另外,跑起来以后,页面打开较慢,一直在转圈
大佬,这个是啥意思啊,把什么不需要的注释掉啊?我有点看不明白,我报的错是跟你第一次一模一样的
⚠️ 确认 issue 是否已存在 ⚠️
GPT-3 or GPT-4
GPT-3.5
操作系统
Linux
Bug 描述 📝
使用docker-compose up -d创建chatgpt-plus-api和chatgpt-plus-web两个容器后,容器chatgpt-plus-api一直无法正常运行,用docker logs查看,提示如下 [Fx] ERROR fx.Invoke(main.main.func3()) called from: main.main /go/chatgpt-plus/api/main.go:85 runtime.main /usr/local/go/src/runtime/proc.go:250 Failed: could not build arguments for function "main".main.func3 /go/chatgpt-plus/api/main.go:85: failed to build redis.Client: received non-nil error from function "chatplus/store".NewRedisClient /go/chatgpt-plus/api/store/redis.go:9: dial tcp 127.0.0.1:6379: connect: connection refused [Fx] ERROR Failed to start: could not build arguments for function "main".main.func3 /go/chatgpt-plus/api/main.go:85: failed to build redis.Client: received non-nil error from function "chatplus/store".NewRedisClient /go/chatgpt-plus/api/store/redis.go:9: dial tcp 127.0.0.1:6379: connect: connection refused 2023/09/05 22:42:58 could not build arguments for function "main".main.func3 (/go/chatgpt-plus/api/main.go:85): failed to build *redis.Client: received non-nil error from function "chatplus/store".NewRedisClient (/go/chatgpt-plus/api/store/redis.go:9): dial tcp 127.0.0.1:6379: connect: connection refused
重现步骤 🕹
No response
你的应用配置信息