chore: tf-azure-ai-foundry#43
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR refactors Azure AI Foundry Content Safety integration to create the resource via Terraform instead of using external variables. The changes make the content safety service optional and improve error handling.
- Adds Terraform resource for Azure Cognitive Account (Content Safety)
- Makes Content Safety client optional with graceful error handling
- Removes external variables in favor of direct resource references
Reviewed Changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| ObjectStorageService.cs | Refactored constructor to make Content Safety client optional with error handling |
| EmailBackgroundService.cs | Simplified logger extension usage |
| BookingService.cs | Removed unused Exists method |
| Settings.cs | Added ReSharper suppressions for model class |
| variables.tf | Removed Content Safety external variables |
| container-app.tf | Updated environment variables to use Terraform resource references |
| ai-content-moderation.tf | Added new Terraform resource for Content Safety service |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| // silence the error | ||
| _logger.LogError("error creating content safety client: {}. Content moderation skipped.", ex.Message); |
There was a problem hiding this comment.
The error message uses a placeholder '{}' which is not standard for .NET logging. Use '{Message}' or positional parameters like '{0}' for proper structured logging.
| response = await _contentSafetyClient.AnalyzeImageAsync(request); | ||
| } catch (RequestFailedException ex) { | ||
| logger.LogContentModerationError(ex.Status.ToString(), ex.ErrorCode ?? "", ex.Message); | ||
| _logger.LogContentModerationError(statusCode: ex.Status.ToString(), errorCode: ex.ErrorCode ?? "", ex.Message); |
There was a problem hiding this comment.
The named parameter 'statusCode:' is inconsistent with the other unnamed parameters. Either use named parameters for all arguments or remove the named parameter for consistency.
| _logger.LogContentModerationError(statusCode: ex.Status.ToString(), errorCode: ex.ErrorCode ?? "", ex.Message); | |
| _logger.LogContentModerationError(ex.Status.ToString(), ex.ErrorCode ?? "", ex.Message); |
No description provided.