feat: add tri-state support for disable-image-generation configuration
- Introduced `DisableImageGenerationMode` with support for `false`, `true`, and `chat` values. - Updated payload handling to preserve `image_generation` on images endpoints when `chat` mode is enabled. - Modified OpenAI image handlers (`ImagesGenerations`, `ImagesEdits`) to respect tri-state logic. - Added unit tests for `DisableImageGenerationMode` behavior and endpoint-specific handling. - Enhanced configuration diff logging to support `DisableImageGenerationMode`.
This commit is contained in:
@@ -198,9 +198,14 @@ func requestExecutionMetadata(ctx context.Context) map[string]any {
|
||||
// Idempotency-Key is an optional client-supplied header used to correlate retries.
|
||||
// Only include it if the client explicitly provides it.
|
||||
key := ""
|
||||
requestPath := ""
|
||||
if ctx != nil {
|
||||
if ginCtx, ok := ctx.Value("gin").(*gin.Context); ok && ginCtx != nil && ginCtx.Request != nil {
|
||||
key = strings.TrimSpace(ginCtx.GetHeader("Idempotency-Key"))
|
||||
requestPath = strings.TrimSpace(ginCtx.FullPath())
|
||||
if requestPath == "" && ginCtx.Request.URL != nil {
|
||||
requestPath = strings.TrimSpace(ginCtx.Request.URL.Path)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -208,6 +213,9 @@ func requestExecutionMetadata(ctx context.Context) map[string]any {
|
||||
if key != "" {
|
||||
meta[idempotencyKeyMetadataKey] = key
|
||||
}
|
||||
if requestPath != "" {
|
||||
meta[coreexecutor.RequestPathMetadataKey] = requestPath
|
||||
}
|
||||
if pinnedAuthID := pinnedAuthIDFromContext(ctx); pinnedAuthID != "" {
|
||||
meta[coreexecutor.PinnedAuthMetadataKey] = pinnedAuthID
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user