Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* 1

* fix
  • Loading branch information
xiaozhou26 authored Apr 5, 2024
1 parent 01a82f9 commit 2d0e6e9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ jobs:
${{ env.GHCR_REPO }}:latest
${{ env.GHCR_REPO }}:${{ github.sha }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache,mode=max
cache-to: type=local,dest=/tmp/.buildx-cache,mode=max
11 changes: 5 additions & 6 deletions internal/chatgpt/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ var (
)

func getWSURL(token string, retry int) (string, error) {

request, err := http.NewRequest(http.MethodPost, "https://chat.openai.com/backend-api/register-websocket", nil)
request, err := http.NewRequest(http.MethodPost, "https://chat.openai.com/backend-anon/register-websocket", nil)
if err != nil {
return "", err
}
Expand Down Expand Up @@ -243,7 +242,7 @@ func POSTTurnStile(secret *tokens.Secret, proxy string) (*http.Response, error)
if proxy != "" {
client.SetProxy(proxy)
}
apiUrl := "https://chat.openai.com/backend-api/sentinel/chat-requirements"
apiUrl := "https://chat.openai.com/backend-anon/sentinel/chat-requirements"
payload := strings.NewReader(`{"conversation_mode_kind":"primary_assistant"}`)
request, err := http.NewRequest(http.MethodPost, apiUrl, payload)
if err != nil {
Expand Down Expand Up @@ -276,7 +275,7 @@ type urlAttr struct {
}

func getURLAttribution(access_token string, puid string, url string) string {
request, err := http.NewRequest(http.MethodPost, "https://chat.openai.com/backend-api/attributions", bytes.NewBuffer([]byte(`{"urls":["`+url+`"]}`)))
request, err := http.NewRequest(http.MethodPost, "https://chat.openai.com/backend-anon/attributions", bytes.NewBuffer([]byte(`{"urls":["`+url+`"]}`)))
if err != nil {
return ""
}
Expand Down Expand Up @@ -311,7 +310,7 @@ func POSTconversation(message chatgpt_types.ChatGPTRequest, secret *tokens.Secre
if proxy != "" {
client.SetProxy(proxy)
}
apiUrl := "https://chat.openai.com/backend-api/conversation"
apiUrl := "https://chat.openai.com/backend-anon/conversation"
if API_REVERSE_PROXY != "" {
apiUrl = API_REVERSE_PROXY
}
Expand Down Expand Up @@ -380,7 +379,7 @@ func GETengines(secret *tokens.Secret, proxy string) (*EnginesData, int, error)
if proxy != "" {
client.SetProxy(proxy)
}
reqUrl := "https://chat.openai.com/backend-api/models"
reqUrl := "https://chat.openai.com/backend-anon/models"
req, _ := http.NewRequest("GET", reqUrl, nil)
req.Header.Set("Content-Type", "application/json")
req.Header.Set("User-Agent", userAgent)
Expand Down

0 comments on commit 2d0e6e9

Please sign in to comment.