Skip to content

Commit

Permalink
fix upload max-age
Browse files Browse the repository at this point in the history
  • Loading branch information
xqdoo00o committed May 30, 2024
1 parent abdd3b1 commit 842a0d4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion conversion/requests/chatgpt/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func ConvertAPIRequest(api_request official_types.APIRequest, account string, se
chatgpt_request.ConversationMode.Kind = "gizmo_interaction"
chatgpt_request.ConversationMode.GizmoId = "g-" + matches[1]
}
ifMultimodel := secret.Token != ""
ifMultimodel := strings.HasPrefix(api_request.Model, "gpt-4")
for _, api_message := range api_request.Messages {
if api_message.Role == "system" {
api_message.Role = "critic"
Expand Down
6 changes: 3 additions & 3 deletions typings/chatgpt/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ type FileResult struct {
Filesize int
Isimage bool
Bounds [2]int
// Current file max-age 1 year
// Current file max-age 30 days
Upload int64
}

Expand Down Expand Up @@ -289,7 +289,7 @@ func processUrl(urlstr string, account string, secret *tokens.Secret, deviceId s
hasher := sha1.New()
hasher.Write(binary)
hash := account + secret.TeamUserID + hex.EncodeToString(hasher.Sum(nil))
if fileHashPool[hash] != nil && time.Now().Unix() < fileHashPool[hash].Upload+31536000 {
if fileHashPool[hash] != nil && time.Now().Unix() < fileHashPool[hash].Upload+2592000 {
return fileHashPool[hash]
}
isImg := strings.HasPrefix(mimeType, "image")
Expand Down Expand Up @@ -319,7 +319,7 @@ func processDataUrl(data string, account string, secret *tokens.Secret, deviceId
hasher := sha1.New()
hasher.Write(binary)
hash := account + secret.TeamUserID + hex.EncodeToString(hasher.Sum(nil))
if fileHashPool[hash] != nil && time.Now().Unix() < fileHashPool[hash].Upload+31536000 {
if fileHashPool[hash] != nil && time.Now().Unix() < fileHashPool[hash].Upload+2592000 {
return fileHashPool[hash]
}
startIdx := strings.Index(data, ":")
Expand Down

0 comments on commit 842a0d4

Please sign in to comment.