mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-02-18 20:30:51 +08:00
fixed: #1407
fix(translator): adjust "developer" role to "user" and ignore unsupported tool types
This commit is contained in:
@@ -68,6 +68,9 @@ func ConvertOpenAIResponsesRequestToOpenAIChatCompletions(modelName string, inpu
|
|||||||
case "message", "":
|
case "message", "":
|
||||||
// Handle regular message conversion
|
// Handle regular message conversion
|
||||||
role := item.Get("role").String()
|
role := item.Get("role").String()
|
||||||
|
if role == "developer" {
|
||||||
|
role = "user"
|
||||||
|
}
|
||||||
message := `{"role":"","content":""}`
|
message := `{"role":"","content":""}`
|
||||||
message, _ = sjson.Set(message, "role", role)
|
message, _ = sjson.Set(message, "role", role)
|
||||||
|
|
||||||
@@ -167,7 +170,8 @@ func ConvertOpenAIResponsesRequestToOpenAIChatCompletions(modelName string, inpu
|
|||||||
// Only function tools need structural conversion because Chat Completions nests details under "function".
|
// Only function tools need structural conversion because Chat Completions nests details under "function".
|
||||||
toolType := tool.Get("type").String()
|
toolType := tool.Get("type").String()
|
||||||
if toolType != "" && toolType != "function" && tool.IsObject() {
|
if toolType != "" && toolType != "function" && tool.IsObject() {
|
||||||
chatCompletionsTools = append(chatCompletionsTools, tool.Value())
|
// Almost all providers lack built-in tools, so we just ignore them.
|
||||||
|
// chatCompletionsTools = append(chatCompletionsTools, tool.Value())
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user