From 25137b1984e6f8ebb7f8182b49beb2a254be26e7 Mon Sep 17 00:00:00 2001 From: Luis Pater Date: Fri, 24 Apr 2026 00:11:42 +0800 Subject: [PATCH] feat(logging): add AI API path support for image routes - Included `/v1/images` in AI API path prefixes. - Introduced tests to validate `/v1/images/generations` and `/v1/images/edits` as AI API paths. --- internal/logging/gin_logger.go | 1 + internal/logging/gin_logger_test.go | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/internal/logging/gin_logger.go b/internal/logging/gin_logger.go index b94d7afe..d92ae985 100644 --- a/internal/logging/gin_logger.go +++ b/internal/logging/gin_logger.go @@ -20,6 +20,7 @@ import ( var aiAPIPrefixes = []string{ "/v1/chat/completions", "/v1/completions", + "/v1/images", "/v1/messages", "/v1/responses", "/v1beta/models/", diff --git a/internal/logging/gin_logger_test.go b/internal/logging/gin_logger_test.go index 7de18338..9bd3ddfb 100644 --- a/internal/logging/gin_logger_test.go +++ b/internal/logging/gin_logger_test.go @@ -58,3 +58,12 @@ func TestGinLogrusRecoveryHandlesRegularPanic(t *testing.T) { t.Fatalf("expected 500, got %d", recorder.Code) } } + +func TestIsAIAPIPathIncludesImages(t *testing.T) { + if !isAIAPIPath("/v1/images/generations") { + t.Fatalf("expected /v1/images/generations to be treated as AI API path") + } + if !isAIAPIPath("/v1/images/edits") { + t.Fatalf("expected /v1/images/edits to be treated as AI API path") + } +}