1
0

weird code deleted

This commit is contained in:
Antonio 2023-06-12 23:17:26 +08:00
parent 7f6be5660b
commit 6bfe081f13

View File

@ -3,17 +3,14 @@ package chatgpt
import (
chatgpt_types "freechatgpt/typings/chatgpt"
official_types "freechatgpt/typings/official"
"strings"
)
func ConvertAPIRequest(api_request official_types.APIRequest) chatgpt_types.ChatGPTRequest {
chatgpt_request := chatgpt_types.NewChatGPTRequest()
if strings.HasPrefix(api_request.Model, "gpt-4") {
chatgpt_request.Model = "gpt-4"
if api_request.Model == "gpt-4-browsing" || api_request.Model == "gpt-4-plugins" || api_request.Model == "gpt-4-mobile" || api_request.Model == "gpt-4-code-interpreter" {
chatgpt_request.Model = api_request.Model
}
if api_request.Model == "gpt-4" || api_request.Model == "gpt-4-browsing" || api_request.Model == "gpt-4-plugins" || api_request.Model == "gpt-4-mobile" || api_request.Model == "gpt-4-code-interpreter" {
chatgpt_request.Model = api_request.Model
}
for _, api_message := range api_request.Messages {
if api_message.Role == "system" {
api_message.Role = "critic"