From d03c6946d9b90191df68c88a5c1d2ba8aa2e4e34 Mon Sep 17 00:00:00 2001 From: Andrew Date: Sun, 4 Feb 2024 10:04:04 +0300 Subject: [PATCH] Quick fix --- main.go | 2 +- providers/opengpts/opengpts.go | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 3f52821..227c5c7 100644 --- a/main.go +++ b/main.go @@ -22,7 +22,7 @@ import ( "github.com/olekukonko/ts" ) -const localVersion = "2.6.0" +const localVersion = "2.6.1" var bold = color.New(color.Bold) var boldBlue = color.New(color.Bold, color.FgBlue) diff --git a/providers/opengpts/opengpts.go b/providers/opengpts/opengpts.go index ad66ca5..e85a473 100644 --- a/providers/opengpts/opengpts.go +++ b/providers/opengpts/opengpts.go @@ -11,6 +11,7 @@ import ( "github.com/aandrew-me/tgpt/v2/client" "github.com/aandrew-me/tgpt/v2/structs" + "github.com/aandrew-me/tgpt/v2/utils" ) type Message struct { @@ -35,6 +36,12 @@ func NewRequest(input string, params structs.Params, extraOptions structs.ExtraO } safeInput, _ := json.Marshal(input) + randID := utils.RandomString(36) + + if len(extraOptions.ThreadID) > 1 { + randID = extraOptions.ThreadID; + } + var data = strings.NewReader(fmt.Sprintf(`{ "input": [ { @@ -61,7 +68,7 @@ func NewRequest(input string, params structs.Params, extraOptions structs.ExtraO req.Header.Add("accept-language", "en-US,en;q=0.7") req.Header.Add("cache-control", "no-cache") req.Header.Add("content-type", "application/json") - req.Header.Add("cookie", "opengpts_user_id="+extraOptions.ThreadID) + req.Header.Add("cookie", "opengpts_user_id="+randID) req.Header.Add("origin", "https://opengpts-example-vz4y4ooboq-uc.a.run.app") req.Header.Add("pragma", "no-cache") req.Header.Add("referer", "https://opengpts-example-vz4y4ooboq-uc.a.run.app/")