Skip to content

Commit

Permalink
Merge pull request #5 from pavel-one/endpoint_of_region
Browse files Browse the repository at this point in the history
conversation endoint in env
  • Loading branch information
pavel-one authored Apr 17, 2023
2 parents 51bf376 + f3b8c7b commit fcaf606
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion config/gpt.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"github.com/google/uuid"
"github.com/pavel-one/EdgeGPT-Go/internal/Helpers"
"net/url"
"os"
"time"
)

Expand All @@ -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
}
Expand Down Expand Up @@ -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"
}

0 comments on commit fcaf606

Please sign in to comment.