feat(translator): add developer role support for Gemini translators
Unified · Split
| @@ -184,7 +184,7 @@ func ConvertOpenAIRequestToAntigravity(modelName string, inputRawJSON []byte, _ · 183 unmodified lines | ||
| 184 | 184 | role := m.Get("role").String() |
| 185 | 185 | content := m.Get("content") |
| 186 | 186 | |
| 187 | − if role == "system" && len(arr) > 1 { | |
| 187 | + if (role == "system" || role == "developer") && len(arr) > 1 { | |
| 188 | 188 | // system -> request.systemInstruction as a user message style |
| 189 | 189 | if content.Type == gjson.String { |
| 190 | 190 | out, _ = sjson.SetBytes(out, "request.systemInstruction.role", "user") |
| @@ -201,7 +201,7 @@ func ConvertOpenAIRequestToAntigravity(modelName string, inputRawJSON []byte, _ · 10 unmodified lines | ||
| 201 | 201 | } |
| 202 | 202 | } |
| 203 | 203 | } |
| 204 | − } else if role == "user" || (role == "system" && len(arr) == 1) { | |
| 204 | + } else if role == "user" || ((role == "system" || role == "developer") && len(arr) == 1) { | |
| 205 | 205 | // Build single user content node to avoid splitting into multiple contents |
| 206 | 206 | node := []byte(`{"role":"user","parts":[]}`) |
| 207 | 207 | if content.Type == gjson.String { |
| @@ -152,7 +152,7 @@ func ConvertOpenAIRequestToGeminiCLI(modelName string, inputRawJSON []byte, _ bo · 151 unmodified lines | ||
| 152 | 152 | role := m.Get("role").String() |
| 153 | 153 | content := m.Get("content") |
| 154 | 154 | |
| 155 | − if role == "system" && len(arr) > 1 { | |
| 155 | + if (role == "system" || role == "developer") && len(arr) > 1 { | |
| 156 | 156 | // system -> request.systemInstruction as a user message style |
| 157 | 157 | if content.Type == gjson.String { |
| 158 | 158 | out, _ = sjson.SetBytes(out, "request.systemInstruction.role", "user") |
| @@ -169,7 +169,7 @@ func ConvertOpenAIRequestToGeminiCLI(modelName string, inputRawJSON []byte, _ bo · 10 unmodified lines | ||
| 169 | 169 | } |
| 170 | 170 | } |
| 171 | 171 | } |
| 172 | − } else if role == "user" || (role == "system" && len(arr) == 1) { | |
| 172 | + } else if role == "user" || ((role == "system" || role == "developer") && len(arr) == 1) { | |
| 173 | 173 | // Build single user content node to avoid splitting into multiple contents |
| 174 | 174 | node := []byte(`{"role":"user","parts":[]}`) |
| 175 | 175 | if content.Type == gjson.String { |
| @@ -170,7 +170,7 @@ func ConvertOpenAIRequestToGemini(modelName string, inputRawJSON []byte, _ bool) · 169 unmodified lines | ||
| 170 | 170 | role := m.Get("role").String() |
| 171 | 171 | content := m.Get("content") |
| 172 | 172 | |
| 173 | − if role == "system" && len(arr) > 1 { | |
| 173 | + if (role == "system" || role == "developer") && len(arr) > 1 { | |
| 174 | 174 | // system -> system_instruction as a user message style |
| 175 | 175 | if content.Type == gjson.String { |
| 176 | 176 | out, _ = sjson.SetBytes(out, "system_instruction.role", "user") |
| @@ -187,7 +187,7 @@ func ConvertOpenAIRequestToGemini(modelName string, inputRawJSON []byte, _ bool) · 10 unmodified lines | ||
| 187 | 187 | } |
| 188 | 188 | } |
| 189 | 189 | } |
| 190 | − } else if role == "user" || (role == "system" && len(arr) == 1) { | |
| 190 | + } else if role == "user" || ((role == "system" || role == "developer") && len(arr) == 1) { | |
| 191 | 191 | // Build single user content node to avoid splitting into multiple contents |
| 192 | 192 | node := []byte(`{"role":"user","parts":[]}`) |
| 193 | 193 | if content.Type == gjson.String { |