Skip to content

Commit

Permalink
update (swuecho#165)
Browse files Browse the repository at this point in the history
  • Loading branch information
swuecho authored Apr 20, 2023
1 parent c001122 commit 955b356
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion api/chat_main_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,15 @@ func (h *ChatHandler) chatStream(w http.ResponseWriter, chatSession sqlc_queries
RespondWithError(w, http.StatusInternalServerError, eris.Wrap(err, "get chat model").Error(), err)
return "", "", true
} else {
config.BaseURL = chat_model.Url
index := strings.Index(chat_model.Url, "/chat/")
if index != -1 {
// is full url https://api.openai.com/v1/chat/completions
baseUrl := chat_model.Url[:index]
config.BaseURL = baseUrl
} else {
config.BaseURL = chat_model.Url
}

}
client := openai.NewClientWithConfig(config)

Expand Down

0 comments on commit 955b356

Please sign in to comment.