Skip to content

Commit

Permalink
#4 get conversation endpoint from env
Browse files Browse the repository at this point in the history
  • Loading branch information
cherryReptile committed Apr 13, 2023
1 parent d8c31bd commit f3b8c7b
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions config/gpt.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,7 @@ type GPT struct {
}

func NewGpt() (*GPT, error) {
var u string
switch os.Getenv("ENDPOINT_REGION") {
case "China":
u = "https://edge.churchless.tech/edgesvc/turing/conversation/create"
default:
u = "https://edgeservices.bing.com/edgesvc/turing/conversation/create"
}

cu, err := url.Parse(u)
cu, err := url.Parse(getConversationEndpoint())
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -74,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 f3b8c7b

Please sign in to comment.