acheong08 / ChatGPT-to-API

Scalable unofficial ChatGPT API for production.
1.11k stars 373 forks source link

runtime error: invalid memory address or nil pointer dereference #100

Closed Zephon-H closed 11 months ago

Zephon-H commented 11 months ago

POST "/v1/chat/completions" Error

[GIN] 2023/07/30 - 02:44:34 | 500 |          2m7s |      172.19.0.1 | POST     "/v1/chat/completions"

2023/07/30 02:44:34 [Recovery] 2023/07/30 - 02:44:34 panic recovered:
POST /v1/chat/completions HTTP/1.1
Host: 127.0.0.1:8080
Accept: */*
Content-Length: 135
Content-Type: application/x-www-form-urlencoded
User-Agent: curl/7.29.0

runtime error: invalid memory address or nil pointer dereference
/usr/local/go/src/runtime/panic.go:260 (0x44b0dc)
/usr/local/go/src/runtime/signal_unix.go:837 (0x44b0ac)
/app/handlers.go:99 (0x8bf7d5)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/context.go:174 (0x8c0d83)
/app/middleware.go:42 (0x8c0d04)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/context.go:174 (0x8c0c17)
/app/middleware.go:32 (0x8c0bfe)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/context.go:174 (0x8b0101)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/recovery.go:102 (0x8b00ec)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/context.go:174 (0x8af226)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/logger.go:240 (0x8af209)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/context.go:174 (0x8ae2aa)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/gin.go:620 (0x8adf31)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/gin.go:576 (0x8adbdc)
/usr/local/go/src/net/http/server.go:2936 (0x669b95)
/usr/local/go/src/net/http/server.go:1995 (0x666411)
/usr/local/go/src/runtime/asm_amd64.s:1598 (0x467580)
Zephon-H commented 11 months ago

I solved this problem after setting the API_REVERSE_PROXY