From 00bb7a3cb1475926e5f005568375444afb534c5f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 15 Feb 2026 23:16:37 +0000 Subject: [PATCH 1/3] Initial plan From ca425a8f1692bdcda7666a8e939b245f8aa84653 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 15 Feb 2026 23:20:14 +0000 Subject: [PATCH 2/3] Rename AuthVerbose to Verbose and add verbosity control for bulk upload messages Co-authored-by: awagner-mainz <2088443+awagner-mainz@users.noreply.github.com> --- .../deployment/environment-variables.md | 22 +++++------ docs/content/getting-started/configuration.md | 23 +++++------ internal/auth/auth_verbose_test.go | 38 +++++++++---------- internal/auth/authenticate.go | 36 +++++++++--------- internal/handlers/embeddings.go | 10 ++++- internal/handlers/handlers_test.go | 2 +- internal/models/options.go | 2 +- main.go | 4 +- template.env | 2 +- 9 files changed, 74 insertions(+), 65 deletions(-) diff --git a/docs/content/deployment/environment-variables.md b/docs/content/deployment/environment-variables.md index e612284..ff5ec23 100644 --- a/docs/content/deployment/environment-variables.md +++ b/docs/content/deployment/environment-variables.md @@ -108,23 +108,23 @@ SERVICE_DEBUG=true # Development (verbose) - `true`: Detailed logs, useful for debugging - `false`: Minimal logs, recommended for production -### SERVICE_AUTH_VERBOSE +### SERVICE_VERBOSE -Enable verbose authentication logging. +Enable verbose logging. - **Type:** Boolean - **Required:** No - **Default:** `false` -- **Environment Variable:** `SERVICE_AUTH_VERBOSE` -- **Command-line Flag:** `--auth-verbose` +- **Environment Variable:** `SERVICE_VERBOSE` +- **Command-line Flag:** `--verbose` -**Description:** Controls authentication log output. When enabled, logs all authentication attempts including successful and failed authentications. When disabled (default), authentication operates silently. +**Description:** Controls verbose log output. When enabled, logs all authentication attempts, project lookups, and other operational details. When disabled (default), most operational logs are suppressed for cleaner output. **Example:** ```bash -SERVICE_AUTH_VERBOSE=false # Quiet mode (default, recommended for production) -SERVICE_AUTH_VERBOSE=true # Verbose mode (useful for debugging) +SERVICE_VERBOSE=false # Quiet mode (default, recommended for production) +SERVICE_VERBOSE=true # Verbose mode (useful for debugging) ``` **Use Cases:** @@ -320,7 +320,7 @@ SERVICE_DBNAME=embapi_test # Testing database ```bash # .env file for development SERVICE_DEBUG=true -SERVICE_AUTH_VERBOSE=true +SERVICE_VERBOSE=true SERVICE_HOST=localhost SERVICE_PORT=8880 SERVICE_DBHOST=localhost @@ -337,7 +337,7 @@ ENCRYPTION_KEY=dev-encryption-key-min-32-chars-long ```bash # .env file for Docker Compose SERVICE_DEBUG=false -SERVICE_AUTH_VERBOSE=false +SERVICE_VERBOSE=false SERVICE_HOST=0.0.0.0 SERVICE_PORT=8880 SERVICE_DBHOST=postgres @@ -354,7 +354,7 @@ ENCRYPTION_KEY=generated_encryption_key_from_setup_script ```bash # .env file for production (or use secrets management) SERVICE_DEBUG=false -SERVICE_AUTH_VERBOSE=false +SERVICE_VERBOSE=false SERVICE_HOST=0.0.0.0 SERVICE_PORT=8880 SERVICE_DBHOST=db.internal.example.com @@ -432,7 +432,7 @@ Some variables support command-line flags: ```bash ./embapi \ --debug \ - --auth-verbose \ + --verbose \ --host 0.0.0.0 \ --port 8880 \ --admin-key your-admin-key \ diff --git a/docs/content/getting-started/configuration.md b/docs/content/getting-started/configuration.md index 641acd1..9c6bc49 100644 --- a/docs/content/getting-started/configuration.md +++ b/docs/content/getting-started/configuration.md @@ -16,7 +16,7 @@ All configuration can be set via environment variables. Use a `.env` file to kee | Variable | Description | Default | Required | |----------|-------------|---------|----------| | `SERVICE_DEBUG` | Enable debug logging | `true` | No | -| `SERVICE_AUTH_VERBOSE` | Enable verbose authentication logging | `false` | No | +| `SERVICE_VERBOSE` | Enable verbose logging | `false` | No | | `SERVICE_HOST` | Hostname to listen on | `localhost` | No | | `SERVICE_PORT` | Port to listen on | `8880` | No | @@ -44,7 +44,7 @@ Create a `.env` file in the project root: ```bash # Service Configuration SERVICE_DEBUG=false -SERVICE_AUTH_VERBOSE=false +SERVICE_VERBOSE=false SERVICE_HOST=0.0.0.0 SERVICE_PORT=8880 @@ -67,7 +67,7 @@ You can also provide configuration via command-line flags: ```bash ./embapi \ --debug \ - --auth-verbose \ + --verbose \ -p 8880 \ --db-host localhost \ --db-port 5432 \ @@ -119,7 +119,7 @@ Configuration is loaded in the following order (later sources override earlier o ```bash # .env (development) SERVICE_DEBUG=true -SERVICE_AUTH_VERBOSE=true +SERVICE_VERBOSE=true SERVICE_HOST=localhost SERVICE_PORT=8880 SERVICE_DBHOST=localhost @@ -136,7 +136,7 @@ ENCRYPTION_KEY=dev-encryption-key-32-chars-min ```bash # .env (production) SERVICE_DEBUG=false -SERVICE_AUTH_VERBOSE=false +SERVICE_VERBOSE=false SERVICE_HOST=0.0.0.0 SERVICE_PORT=8880 SERVICE_DBHOST=prod-db.example.com @@ -150,27 +150,28 @@ ENCRYPTION_KEY=$(cat /run/secrets/encryption_key) ## Logging Configuration -### Authentication Logging +### Verbose Logging -The `SERVICE_AUTH_VERBOSE` flag controls authentication log output. This is particularly useful for production environments or during bulk operations: +The `SERVICE_VERBOSE` flag controls verbose log output. This is particularly useful for production environments or during bulk operations: -- **`SERVICE_AUTH_VERBOSE=true`** (verbose mode): Logs all authentication attempts, including successful and failed authentications. Useful for debugging authentication issues or monitoring security events. +- **`SERVICE_VERBOSE=true`** (verbose mode): Logs all authentication attempts, project lookups, and other operational details. Useful for debugging or monitoring system behavior. -- **`SERVICE_AUTH_VERBOSE=false`** (quiet mode, default): Suppresses authentication logs. Recommended for production, especially during: +- **`SERVICE_VERBOSE=false`** (quiet mode, default): Suppresses verbose logs. Recommended for production, especially during: - Bulk upload operations - High-traffic scenarios - When crawlers or automated tools access the API frequently -Example log output with `SERVICE_AUTH_VERBOSE=true`: +Example log output with `SERVICE_VERBOSE=true`: ``` Owner authentication successful: alice Reader auth for owner=bob project=test definition= instance= running... Checking project access... Reader authentication successful + Found project test1 ... Authentication failed. ``` -With `SERVICE_AUTH_VERBOSE=false`, these messages are suppressed while authentication still works normally. +With `SERVICE_VERBOSE=false`, these messages are suppressed while operations still work normally. ## Validation diff --git a/internal/auth/auth_verbose_test.go b/internal/auth/auth_verbose_test.go index 8d5639e..9c5432d 100644 --- a/internal/auth/auth_verbose_test.go +++ b/internal/auth/auth_verbose_test.go @@ -17,8 +17,8 @@ import ( "github.com/stretchr/testify/assert" ) -// TestAuthVerboseFlag tests that authentication logging is controlled by the AuthVerbose flag -func TestAuthVerboseFlag(t *testing.T) { +// TestVerboseFlag tests that authentication logging is controlled by the Verbose flag +func TestVerboseFlag(t *testing.T) { // Set required environment variables for testing if os.Getenv("ENCRYPTION_KEY") == "" { os.Setenv("ENCRYPTION_KEY", "test-encryption-key-32-bytes-long-1234567890") @@ -30,12 +30,12 @@ func TestAuthVerboseFlag(t *testing.T) { expectLogs bool }{ { - name: "AuthVerbose=true should produce logs", + name: "Verbose=true should produce logs", authVerbose: true, expectLogs: true, }, { - name: "AuthVerbose=false should suppress logs", + name: "Verbose=false should suppress logs", authVerbose: false, expectLogs: false, }, @@ -50,7 +50,7 @@ func TestAuthVerboseFlag(t *testing.T) { // Create test options options := &models.Options{ - AuthVerbose: tt.authVerbose, + Verbose: tt.authVerbose, AdminKey: "test-admin-key", } @@ -128,25 +128,25 @@ func TestAuthVerboseFlag(t *testing.T) { } } -// TestAuthVerboseEnvironmentVariable tests that the environment variable is properly handled -func TestAuthVerboseEnvironmentVariable(t *testing.T) { +// TestVerboseEnvironmentVariable tests that the environment variable is properly handled +func TestVerboseEnvironmentVariable(t *testing.T) { tests := []struct { name string envValue string expected bool }{ { - name: "SERVICE_AUTH_VERBOSE=true", + name: "SERVICE_VERBOSE=true", envValue: "true", expected: true, }, { - name: "SERVICE_AUTH_VERBOSE=false", + name: "SERVICE_VERBOSE=false", envValue: "false", expected: false, }, { - name: "SERVICE_AUTH_VERBOSE empty", + name: "SERVICE_VERBOSE empty", envValue: "", expected: false, // default value }, @@ -155,28 +155,28 @@ func TestAuthVerboseEnvironmentVariable(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { // Clean up environment - os.Unsetenv("SERVICE_AUTH_VERBOSE") + os.Unsetenv("SERVICE_VERBOSE") if tt.envValue != "" { - os.Setenv("SERVICE_AUTH_VERBOSE", tt.envValue) - defer os.Unsetenv("SERVICE_AUTH_VERBOSE") + os.Setenv("SERVICE_VERBOSE", tt.envValue) + defer os.Unsetenv("SERVICE_VERBOSE") } options := &models.Options{ - AuthVerbose: false, // default + Verbose: false, // default } // Simulate what main.go does - if os.Getenv("SERVICE_AUTH_VERBOSE") != "" { - options.AuthVerbose = os.Getenv("SERVICE_AUTH_VERBOSE") == "true" + if os.Getenv("SERVICE_VERBOSE") != "" { + options.Verbose = os.Getenv("SERVICE_VERBOSE") == "true" } - assert.Equal(t, tt.expected, options.AuthVerbose, "AuthVerbose should match expected value") + assert.Equal(t, tt.expected, options.Verbose, "Verbose should match expected value") }) } } -// TestNoAuthLogsInQuietMode verifies that with AuthVerbose=false, various auth scenarios don't produce logs +// TestNoAuthLogsInQuietMode verifies that with Verbose=false, various auth scenarios don't produce logs func TestNoAuthLogsInQuietMode(t *testing.T) { // This test demonstrates the fix for the bulk upload/crawler scenario // Capture stdout @@ -185,7 +185,7 @@ func TestNoAuthLogsInQuietMode(t *testing.T) { os.Stdout = w options := &models.Options{ - AuthVerbose: false, // Quiet mode + Verbose: false, // Quiet mode AdminKey: "test-admin-key", } diff --git a/internal/auth/authenticate.go b/internal/auth/authenticate.go index 46a5b58..8fef675 100644 --- a/internal/auth/authenticate.go +++ b/internal/auth/authenticate.go @@ -77,7 +77,7 @@ func AuthTermination(api huma.API, options *models.Options) func(ctx huma.Contex next(ctx) return } - if options.AuthVerbose { + if options.Verbose { fmt.Print(" Authentication failed.\n") } _ = huma.WriteErr(api, ctx, http.StatusUnauthorized, "Authentication failed. Perhaps a missing or incorrect API key?") @@ -109,7 +109,7 @@ func EmbAPIKeyAdminAuth(api huma.API, options *models.Options) func(ctx huma.Con if token == options.AdminKey { ctx = huma.WithValue(ctx, IsAdminKey, true) ctx = huma.WithValue(ctx, AuthUserKey, "admin") - if options.AuthVerbose { + if options.Verbose { fmt.Print(" Admin authentication successful\n") } next(ctx) @@ -171,7 +171,7 @@ func EmbAPIKeyOwnerAuth(api huma.API, pool *pgxpool.Pool, options *models.Option if EmbAPIKeyIsValid(token, storedHash) { ctx = huma.WithValue(ctx, IsOwnerKey, true) ctx = huma.WithValue(ctx, AuthUserKey, owner) - if options.AuthVerbose { + if options.Verbose { fmt.Printf(" Owner authentication successful: %s\n", owner) } next(ctx) @@ -219,26 +219,26 @@ func EmbAPIKeyReaderAuth(api huma.API, pool *pgxpool.Pool, options *models.Optio return } - if options.AuthVerbose { + if options.Verbose { fmt.Printf(" Reader auth for owner=%s project=%s definition=%s instance=%s running...\n", owner, project, definition, instance) } // Branch based on whether project, definition, or instance is being accessed if len(project) > 0 { - if options.AuthVerbose { + if options.Verbose { fmt.Print(" Checking project access...\n") } handleProjectReaderAuth(api, pool, owner, project, options)(ctx, next) return } if len(definition) > 0 { - if options.AuthVerbose { + if options.Verbose { fmt.Print(" Checking definition access...\n") } handleDefinitionReaderAuth(api, pool, owner, definition, options)(ctx, next) return } if len(instance) > 0 { - if options.AuthVerbose { + if options.Verbose { fmt.Print(" Checking instance access...\n") } handleInstanceReaderAuth(api, pool, owner, instance, options)(ctx, next) @@ -263,7 +263,7 @@ func handleProjectReaderAuth(api huma.API, pool *pgxpool.Pool, owner string, pro // If project exists and public_read is true, allow unauthenticated access if err == nil && publicRead.Valid && publicRead.Bool { // Public read is enabled, allow unauthenticated access - if options.AuthVerbose { + if options.Verbose { fmt.Print(" Public read access granted (no authentication required)\n") } ctx = huma.WithValue(ctx, AuthUserKey, "public") @@ -294,7 +294,7 @@ func handleProjectReaderAuth(api huma.API, pool *pgxpool.Pool, owner string, pro storedHash := authKey.EmbAPIKey if EmbAPIKeyIsValid(token, storedHash) { - if options.AuthVerbose { + if options.Verbose { fmt.Print(" Reader authentication successful\n") } ctx = huma.WithValue(ctx, AuthUserKey, authKey.UserHandle) @@ -335,7 +335,7 @@ func handleDefinitionReaderAuth(api huma.API, pool *pgxpool.Pool, owner string, storedHash := authKey.EmbAPIKey if EmbAPIKeyIsValid(token, storedHash) { - if options.AuthVerbose { + if options.Verbose { fmt.Print(" Reader authentication successful\n") } ctx = huma.WithValue(ctx, AuthUserKey, authKey.UserHandle) @@ -376,7 +376,7 @@ func handleInstanceReaderAuth(api huma.API, pool *pgxpool.Pool, owner string, in storedHash := authKey.EmbAPIKey if EmbAPIKeyIsValid(token, storedHash) { - if options.AuthVerbose { + if options.Verbose { fmt.Print(" Reader authentication successful\n") } ctx = huma.WithValue(ctx, AuthUserKey, authKey.UserHandle) @@ -428,26 +428,26 @@ func EmbAPIKeyEditorAuth(api huma.API, pool *pgxpool.Pool, options *models.Optio return } - if options.AuthVerbose { + if options.Verbose { fmt.Printf(" Editor auth for owner=%s project=%s definition=%s instance=%s running...\n", owner, project, definition, instance) } // Branch based on whether project, definition, or instance is being accessed if len(project) > 0 { - if options.AuthVerbose { + if options.Verbose { fmt.Print(" Checking project editor access...\n") } handleProjectEditorAuth(api, pool, owner, project, options)(ctx, next) return } if len(definition) > 0 { - if options.AuthVerbose { + if options.Verbose { fmt.Print(" Checking definition editor access...\n") } handleDefinitionEditorAuth(api, pool, owner, definition, options)(ctx, next) return } if len(instance) > 0 { - if options.AuthVerbose { + if options.Verbose { fmt.Print(" Checking instance editor access...\n") } handleInstanceEditorAuth(api, pool, owner, instance, options)(ctx, next) @@ -485,7 +485,7 @@ func handleProjectEditorAuth(api huma.API, pool *pgxpool.Pool, owner string, pro storedHash := authKey.EmbAPIKey if EmbAPIKeyIsValid(token, storedHash) { - if options.AuthVerbose { + if options.Verbose { fmt.Printf(" Editor authentication successful (role: %s)\n", authKey.Role) } ctx = huma.WithValue(ctx, AuthUserKey, authKey.UserHandle) @@ -525,7 +525,7 @@ func handleDefinitionEditorAuth(api huma.API, pool *pgxpool.Pool, owner string, storedHash := authKey.EmbAPIKey if EmbAPIKeyIsValid(token, storedHash) { - if options.AuthVerbose { + if options.Verbose { fmt.Print(" Editor authentication successful\n") } ctx = huma.WithValue(ctx, AuthUserKey, authKey.UserHandle) @@ -567,7 +567,7 @@ func handleInstanceEditorAuth(api huma.API, pool *pgxpool.Pool, owner string, in storedHash := authKey.EmbAPIKey if EmbAPIKeyIsValid(token, storedHash) { - if options.AuthVerbose { + if options.Verbose { fmt.Printf(" Editor authentication successful (role: %s)\n", authKey.Role) } ctx = huma.WithValue(ctx, AuthUserKey, authKey.UserHandle) diff --git a/internal/handlers/embeddings.go b/internal/handlers/embeddings.go index 240e32a..a13ccaf 100644 --- a/internal/handlers/embeddings.go +++ b/internal/handlers/embeddings.go @@ -71,7 +71,15 @@ func postProjEmbeddingsFunc(ctx context.Context, input *models.PostProjEmbedding return nil, huma.Error404NotFound(fmt.Sprintf("Project %s/%s not found: %v", input.UserHandle, input.ProjectHandle, err)) } - fmt.Printf("Found project %s ...", project.ProjectHandle) + // Get options to check verbose flag + options, err := GetOptions(ctx) + if err != nil { + return nil, err + } + + if options.Verbose { + fmt.Printf("Found project %s ...", project.ProjectHandle) + } // Even though each of the submitted embeddings specifies an instance handle, // we may postulate that only one instance is involved: the one that is diff --git a/internal/handlers/handlers_test.go b/internal/handlers/handlers_test.go index b91351b..3a18f2a 100644 --- a/internal/handlers/handlers_test.go +++ b/internal/handlers/handlers_test.go @@ -50,7 +50,7 @@ import ( var ( options = models.Options{ Debug: true, - AuthVerbose: false, // Set to false for cleaner test output + Verbose: false, // Set to false for cleaner test output Host: "localhost", Port: 8080, DBHost: "localhost", diff --git a/internal/models/options.go b/internal/models/options.go index 6b06231..dc5bfdc 100644 --- a/internal/models/options.go +++ b/internal/models/options.go @@ -10,7 +10,7 @@ const ( // Options for the CLI. type Options struct { Debug bool ` env:"SERVICE_DEBUG" doc:"Enable debug logging" short:"d" default:"true"` - AuthVerbose bool `name:"auth-verbose" env:"SERVICE_AUTH_VERBOSE" doc:"Enable verbose authentication logging" default:"false"` + Verbose bool `name:"verbose" env:"SERVICE_VERBOSE" doc:"Enable verbose logging" default:"false"` Host string ` env:"SERVICE_HOST" doc:"Hostname to listen on" default:"localhost"` Port int ` env:"SERVICE_PORT" doc:"Port to listen on" short:"p" default:"8880"` DBHost string `name:"db-host" env:"SERVICE_DBHOST" doc:"Database hostname" default:"localhost"` diff --git a/main.go b/main.go index 595cfac..975c6a4 100644 --- a/main.go +++ b/main.go @@ -35,8 +35,8 @@ func main() { if os.Getenv("SERVICE_DEBUG") != "" { options.Debug = os.Getenv("SERVICE_DEBUG") == "true" } - if os.Getenv("SERVICE_AUTH_VERBOSE") != "" { - options.AuthVerbose = os.Getenv("SERVICE_AUTH_VERBOSE") == "true" + if os.Getenv("SERVICE_VERBOSE") != "" { + options.Verbose = os.Getenv("SERVICE_VERBOSE") == "true" } if os.Getenv("SERVICE_HOST") != "" { options.Host = os.Getenv("SERVICE_HOST") diff --git a/template.env b/template.env index 4fd2053..3354433 100644 --- a/template.env +++ b/template.env @@ -1,7 +1,7 @@ #!/usr/bin/env bash SERVICE_DEBUG=true -SERVICE_AUTH_VERBOSE=false +SERVICE_VERBOSE=false SERVICE_HOST=localhost SERVICE_PORT=8888 SERVICE_DBHOST=localhost From 03de0e1521b7c5f4c8d3e0e2bbd4b63f6862c7b9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 16 Feb 2026 08:11:56 +0000 Subject: [PATCH 3/3] Fix: Add options to embeddings context and rename test variable - Pass options parameter to RegisterEmbeddingsRoutes - Wrap all embeddings handlers with addOptionsToContext middleware - Rename authVerbose to verbose in test struct for consistency - Fixes "options not found in context" error in embeddings tests Co-authored-by: awagner-mainz <2088443+awagner-mainz@users.noreply.github.com> --- internal/auth/auth_verbose_test.go | 22 +++++++++++----------- internal/handlers/embeddings.go | 14 +++++++------- internal/handlers/handlers.go | 2 +- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/internal/auth/auth_verbose_test.go b/internal/auth/auth_verbose_test.go index 9c5432d..cec9f31 100644 --- a/internal/auth/auth_verbose_test.go +++ b/internal/auth/auth_verbose_test.go @@ -25,19 +25,19 @@ func TestVerboseFlag(t *testing.T) { } tests := []struct { - name string - authVerbose bool - expectLogs bool + name string + verbose bool + expectLogs bool }{ { - name: "Verbose=true should produce logs", - authVerbose: true, - expectLogs: true, + name: "Verbose=true should produce logs", + verbose: true, + expectLogs: true, }, { - name: "Verbose=false should suppress logs", - authVerbose: false, - expectLogs: false, + name: "Verbose=false should suppress logs", + verbose: false, + expectLogs: false, }, } @@ -50,8 +50,8 @@ func TestVerboseFlag(t *testing.T) { // Create test options options := &models.Options{ - Verbose: tt.authVerbose, - AdminKey: "test-admin-key", + Verbose: tt.verbose, + AdminKey: "test-admin-key", } // Create a simple API and router diff --git a/internal/handlers/embeddings.go b/internal/handlers/embeddings.go index a13ccaf..5c7cd77 100644 --- a/internal/handlers/embeddings.go +++ b/internal/handlers/embeddings.go @@ -429,7 +429,7 @@ func deleteDocEmbeddingsFunc(ctx context.Context, input *models.DeleteEmbeddings } // RegisterEmbeddingsRoutes registers all the embeddings routes with the API -func RegisterEmbeddingsRoutes(pool *pgxpool.Pool, api huma.API) error { +func RegisterEmbeddingsRoutes(pool *pgxpool.Pool, api huma.API, options *models.Options) error { // Define huma.Operations for each route postProjEmbeddingsOp := huma.Operation{ OperationID: "postEmbeddings", @@ -495,11 +495,11 @@ func RegisterEmbeddingsRoutes(pool *pgxpool.Pool, api huma.API) error { Tags: []string{"embeddings"}, } - // huma.Register(api, putProjEmbeddingsOp, addPoolToContext(pool, putProjEmbeddingsFunc)) - huma.Register(api, postProjEmbeddingsOp, addPoolToContext(pool, postProjEmbeddingsFunc)) - huma.Register(api, getProjEmbeddingsOp, addPoolToContext(pool, getProjEmbeddingsFunc)) - huma.Register(api, deleteProjEmbeddingsOp, addPoolToContext(pool, deleteProjEmbeddingsFunc)) - huma.Register(api, getDocEmbeddingsOp, addPoolToContext(pool, getDocEmbeddingsFunc)) - huma.Register(api, deleteDocEmbeddingsOp, addPoolToContext(pool, deleteDocEmbeddingsFunc)) + // huma.Register(api, putProjEmbeddingsOp, addOptionsToContext(options, addPoolToContext(pool, putProjEmbeddingsFunc))) + huma.Register(api, postProjEmbeddingsOp, addOptionsToContext(options, addPoolToContext(pool, postProjEmbeddingsFunc))) + huma.Register(api, getProjEmbeddingsOp, addOptionsToContext(options, addPoolToContext(pool, getProjEmbeddingsFunc))) + huma.Register(api, deleteProjEmbeddingsOp, addOptionsToContext(options, addPoolToContext(pool, deleteProjEmbeddingsFunc))) + huma.Register(api, getDocEmbeddingsOp, addOptionsToContext(options, addPoolToContext(pool, getDocEmbeddingsFunc))) + huma.Register(api, deleteDocEmbeddingsOp, addOptionsToContext(options, addPoolToContext(pool, deleteDocEmbeddingsFunc))) return nil } diff --git a/internal/handlers/handlers.go b/internal/handlers/handlers.go index 3589c6c..5221c97 100644 --- a/internal/handlers/handlers.go +++ b/internal/handlers/handlers.go @@ -64,7 +64,7 @@ func AddRoutes(pool *pgxpool.Pool, keyGen RandomKeyGenerator, api huma.API, opti fmt.Printf(" Unable to register Projects routes: %v\n", err) return err } - err = RegisterEmbeddingsRoutes(pool, api) + err = RegisterEmbeddingsRoutes(pool, api, options) if err != nil { fmt.Printf(" Unable to register Embeddings routes: %v\n", err) return err