diff --git a/config/gpt.go b/config/gpt.go index ab40b02..aa3472b 100644 --- a/config/gpt.go +++ b/config/gpt.go @@ -5,6 +5,7 @@ import ( "github.com/google/uuid" "github.com/pavel-one/EdgeGPT-Go/internal/Helpers" "net/url" + "os" "time" ) @@ -16,7 +17,7 @@ type GPT struct { } func NewGpt() (*GPT, error) { - cu, err := url.Parse("https://edgeservices.bing.com/edgesvc/turing/conversation/create") + cu, err := url.Parse(getConversationEndpoint()) if err != nil { return nil, err } @@ -65,3 +66,11 @@ func NewGpt() (*GPT, error) { }, }, nil } + +func getConversationEndpoint() string { + er := os.Getenv("CONVERSATION_ENDPOINT") + if er != "" { + return er + } + return "https://edgeservices.bing.com/edgesvc/turing/conversation/create" +}