11using Discord ;
22using Estranged . Automation . Events ;
33using Microsoft . Extensions . AI ;
4+ using Estranged . Automation . Events ;
5+ using Microsoft . Extensions . AI ;
46using Microsoft . Extensions . Configuration ;
7+ using Microsoft . Extensions . Logging ;
58using System ;
69using System . IO ;
710using System . Net . Http ;
@@ -19,13 +22,15 @@ namespace Estranged.Automation.Responders
1922 internal sealed class StableDiffusionResponder : IResponder
2023 {
2124 private readonly IHttpClientFactory _httpClientFactory ;
25+ private readonly ILogger < StableDiffusionResponder > _logger ;
2226 private readonly IConfiguration _configuration ;
2327 private readonly IFeatureFlags _featureFlags ;
2428 private readonly IChatClientFactory _chatClientFactory ;
2529 private int _steps = 20 ;
2630
27- public StableDiffusionResponder ( IHttpClientFactory httpClientFactory , IConfiguration configuration , IFeatureFlags featureFlags , IChatClientFactory chatClientFactory )
31+ public StableDiffusionResponder ( ILogger < StableDiffusionResponder > logger , IHttpClientFactory httpClientFactory , IConfiguration configuration , IFeatureFlags featureFlags , IChatClientFactory chatClientFactory )
2832 {
33+ _logger = logger ;
2934 _httpClientFactory = httpClientFactory ;
3035 _configuration = configuration ;
3136 _featureFlags = featureFlags ;
@@ -72,6 +77,8 @@ public async Task ProcessMessage(IMessage message, CancellationToken token)
7277
7378 var enhancedPrompt = response . Text . Trim ( ) ;
7479
80+ _logger . LogInformation ( "Enhanced prompt: {EnhancedPrompt}" , enhancedPrompt ) ;
81+
7582 var result = await GenerateImageWithGif ( enhancedPrompt , token ) ;
7683 using var gifStream = result . gifStream ;
7784 await message . Channel . SendFileAsync ( gifStream , $ "{ Guid . NewGuid ( ) } .gif", text : enhancedPrompt , messageReference : new MessageReference ( message . Id ) , options : token . ToRequestOptions ( ) ) ;
0 commit comments