Skip to content

Commit

Permalink
oai did
Browse files Browse the repository at this point in the history
  • Loading branch information
madoka committed Apr 2, 2024
1 parent cadc027 commit 38eaba0
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 234 deletions.
177 changes: 0 additions & 177 deletions internal/bard/lib.go

This file was deleted.

21 changes: 0 additions & 21 deletions internal/bard/request.go

This file was deleted.

30 changes: 0 additions & 30 deletions internal/bard/utilities.go

This file was deleted.

21 changes: 15 additions & 6 deletions internal/chatgpt/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"context"
"encoding/base64"
"encoding/json"
"fmt"
"freechatgpt/typings"
chatgpt_types "freechatgpt/typings/chatgpt"
"io"
Expand Down Expand Up @@ -209,27 +210,35 @@ func getOidDid() string {
for _, cookie := range getResp.Cookies() {
if cookie.Name == "oai-did" {
oaiDid = cookie.Value
fmt.Print(oaiDid)
break
}
}

return oaiDid
}

func CheckRequire(access_token string, puid string, proxy string) *ChatRequire {
if proxy != "" {
client.SetProxy(proxy)
}
var oaiDid string

func init() {
oaiDid := ""
for i := 0; i < 10; i++ {
for i := 0; i < 20; i++ {
oaiDid = getOidDid()
if oaiDid != "" {
break
}
time.Sleep(time.Second)
}

print(oaiDid)
if oaiDid == "" {
panic("Failed to get oai-did")
}
}

func CheckRequire(access_token string, puid string, proxy string) *ChatRequire {
if proxy != "" {
client.SetProxy(proxy)
}

request, err := http.NewRequest(http.MethodPost, "https://chat.openai.com/backend-anon/sentinel/chat-requirements", bytes.NewBuffer([]byte(`{}`)))
if err != nil {
Expand Down

0 comments on commit 38eaba0

Please sign in to comment.