Unified · Split
| @@ -106,6 +106,9 @@ func (e *CodexExecutor) Execute(ctx context.Context, auth *cliproxyauth.Auth, re · 105 unmodified lines | |||
| 106 | body, _ = sjson.SetBytes(body, "stream", true) | 106 | body, _ = sjson.SetBytes(body, "stream", true) |
| 107 | body, _ = sjson.DeleteBytes(body, "previous_response_id") | 107 | body, _ = sjson.DeleteBytes(body, "previous_response_id") |
| 108 | body, _ = sjson.DeleteBytes(body, "prompt_cache_retention") | 108 | body, _ = sjson.DeleteBytes(body, "prompt_cache_retention") |
| 109 | if !gjson.GetBytes(body, "instructions").Exists() { | ||
| 110 | body, _ = sjson.SetBytes(body, "instructions", "") | ||
| 111 | } | ||
| 109 | 112 | ||
| 110 | url := strings.TrimSuffix(baseURL, "/") + "/responses" | 113 | url := strings.TrimSuffix(baseURL, "/") + "/responses" |
| 111 | httpReq, err := e.cacheHelper(ctx, from, url, req, body) | 114 | httpReq, err := e.cacheHelper(ctx, from, url, req, body) |
| @@ -213,6 +216,9 @@ func (e *CodexExecutor) ExecuteStream(ctx context.Context, auth *cliproxyauth.Au · 101 unmodified lines | |||
| 213 | body, _ = sjson.DeleteBytes(body, "previous_response_id") | 216 | body, _ = sjson.DeleteBytes(body, "previous_response_id") |
| 214 | body, _ = sjson.DeleteBytes(body, "prompt_cache_retention") | 217 | body, _ = sjson.DeleteBytes(body, "prompt_cache_retention") |
| 215 | body, _ = sjson.SetBytes(body, "model", baseModel) | 218 | body, _ = sjson.SetBytes(body, "model", baseModel) |
| 219 | if !gjson.GetBytes(body, "instructions").Exists() { | ||
| 220 | body, _ = sjson.SetBytes(body, "instructions", "") | ||
| 221 | } | ||
| 216 | 222 | ||
| 217 | url := strings.TrimSuffix(baseURL, "/") + "/responses" | 223 | url := strings.TrimSuffix(baseURL, "/") + "/responses" |
| 218 | httpReq, err := e.cacheHelper(ctx, from, url, req, body) | 224 | httpReq, err := e.cacheHelper(ctx, from, url, req, body) |
| @@ -317,6 +323,9 @@ func (e *CodexExecutor) CountTokens(ctx context.Context, auth *cliproxyauth.Auth · 98 unmodified lines | |||
| 317 | body, _ = sjson.DeleteBytes(body, "previous_response_id") | 323 | body, _ = sjson.DeleteBytes(body, "previous_response_id") |
| 318 | body, _ = sjson.DeleteBytes(body, "prompt_cache_retention") | 324 | body, _ = sjson.DeleteBytes(body, "prompt_cache_retention") |
| 319 | body, _ = sjson.SetBytes(body, "stream", false) | 325 | body, _ = sjson.SetBytes(body, "stream", false) |
| 326 | if !gjson.GetBytes(body, "instructions").Exists() { | ||
| 327 | body, _ = sjson.SetBytes(body, "instructions", "") | ||
| 328 | } | ||
| 320 | 329 | ||
| 321 | enc, err := tokenizerForCodexModel(baseModel) | 330 | enc, err := tokenizerForCodexModel(baseModel) |
| 322 | if err != nil { | 331 | if err != nil { |