Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
leokwsw committed Mar 22, 2024
1 parent cad79b0 commit 1cc49c3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
9 changes: 9 additions & 0 deletions api/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"bytes"
"encoding/json"
"fmt"
"github.com/google/uuid"
"github.com/gorilla/websocket"
"github.com/xqdoo00o/OpenAIAuth/auth"
"github.com/xqdoo00o/funcaptcha"
Expand Down Expand Up @@ -95,6 +96,9 @@ func init() {
ArkoseClient = getHttpClient()

setupID()

logger.Info("User-Agent : " + UserAgent)
logger.Info("Oai-Device-Id : " + OAIDID)
}

func NewHttpClient() tls_client.HttpClient {
Expand Down Expand Up @@ -181,6 +185,11 @@ func setupID() {
password := os.Getenv("OPENAI_PASSWORD")
refreshtoken := os.Getenv("OPENAI_REFRESH_TOKEN")
OAIDID = os.Getenv("OPENAI_DEVICE_ID")

if len(OAIDID) <= 0 {
OAIDID = uuid.NewString()
}

if username != "" && password != "" {
go func() {
for {
Expand Down
3 changes: 1 addition & 2 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ services:
ports:
- 8080:8080
environment:
- TZ=Asia/Shanghai
- TZ=Asia/HongKong
- PORT=8080
- NINJA_URL=http://127.0.0.1:7999
restart: unless-stopped
3 changes: 2 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/leokwsw/go-chatgpt-api/api/platform"
_ "github.com/leokwsw/go-chatgpt-api/env"
"github.com/leokwsw/go-chatgpt-api/middleware"
"github.com/linweiyuan/go-logger/logger"
"log"
"strings"

Expand All @@ -27,7 +28,7 @@ func main() {
if err != nil {
log.Fatal(err)
}
fmt.Println("id :", id)
logger.Info("id : " + id)

flatPort := flag.String("port", "8080", "")
flag.Parse()
Expand Down

0 comments on commit 1cc49c3

Please sign in to comment.