1
0

Merge pull request #29 from xqdoo00o/test

This commit is contained in:
Antonio Cheong 2023-05-23 14:58:59 +08:00 committed by GitHub
commit 64689873d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View File

@ -142,6 +142,9 @@ func nightmare(c *gin.Context) {
if original_response.Error != nil {
return
}
if original_response.Message.Content.Parts == nil {
continue
}
if original_response.Message.Content.Parts[0] == "" || original_response.Message.Author.Role != "assistant" {
continue
}

View File

@ -2,10 +2,17 @@ package chatgpt
import (
typings "freechatgpt/internal/typings"
"strings"
)
func ConvertAPIRequest(api_request typings.APIRequest) ChatGPTRequest {
chatgpt_request := NewChatGPTRequest()
if strings.HasPrefix(api_request.Model, "gpt-4") {
chatgpt_request.Model = "gpt-4"
if api_request.Model == "gpt-4-browsing" {
chatgpt_request.Model = "gpt-4-browsing"
}
}
for _, api_message := range api_request.Messages {
if api_message.Role == "system" {
api_message.Role = "critic"