Unified · Split
| @@ -19,8 +19,10 @@ func ConvertCodexResponseToOpenAIResponses(ctx context.Context, modelName string · 18 unmodified lines | |||
| 19 | if typeResult := gjson.GetBytes(rawJSON, "type"); typeResult.Exists() { | 19 | if typeResult := gjson.GetBytes(rawJSON, "type"); typeResult.Exists() { |
| 20 | typeStr := typeResult.String() | 20 | typeStr := typeResult.String() |
| 21 | if typeStr == "response.created" || typeStr == "response.in_progress" || typeStr == "response.completed" { | 21 | if typeStr == "response.created" || typeStr == "response.in_progress" || typeStr == "response.completed" { |
| 22 | instructions := selectInstructions(originalRequestRawJSON, requestRawJSON) | 22 | if gjson.GetBytes(rawJSON, "response.instructions").Exists() { |
| 23 | rawJSON, _ = sjson.SetBytes(rawJSON, "response.instructions", instructions) | 23 | instructions := selectInstructions(originalRequestRawJSON, requestRawJSON) |
| 24 | rawJSON, _ = sjson.SetBytes(rawJSON, "response.instructions", instructions) | ||
| 25 | } | ||
| 24 | } | 26 | } |
| 25 | } | 27 | } |
| 26 | out := fmt.Sprintf("data: %s", string(rawJSON)) | 28 | out := fmt.Sprintf("data: %s", string(rawJSON)) |
| @@ -39,7 +41,9 @@ func ConvertCodexResponseToOpenAIResponsesNonStream(_ context.Context, modelName · 12 unmodified lines | |||
| 39 | } | 41 | } |
| 40 | responseResult := rootResult.Get("response") | 42 | responseResult := rootResult.Get("response") |
| 41 | template := responseResult.Raw | 43 | template := responseResult.Raw |
| 42 | template, _ = sjson.Set(template, "instructions", selectInstructions(originalRequestRawJSON, requestRawJSON)) | 44 | if responseResult.Get("instructions").Exists() { |
| 45 | template, _ = sjson.Set(template, "instructions", selectInstructions(originalRequestRawJSON, requestRawJSON)) | ||
| 46 | } | ||
| 43 | return template | 47 | return template |
| 44 | } | 48 | } |
| 45 | 49 | ||