|  |  |  | @ -86,6 +86,35 @@ public class ImageGenerationController : BaseController<ImageGenerationControlle | 
			
		
	
		
			
				
					|  |  |  |  | 		{ | 
			
		
	
		
			
				
					|  |  |  |  | 			_logger.LogCritical(ex.Message, ex); | 
			
		
	
		
			
				
					|  |  |  |  | 			 | 
			
		
	
		
			
				
					|  |  |  |  | 			return HttpContext.Send(EventResult.FromFailure("Can't parse result"), System.Net.HttpStatusCode.InternalServerError); | 
			
		
	
		
			
				
					|  |  |  |  | 		} | 
			
		
	
		
			
				
					|  |  |  |  | 	} | 
			
		
	
		
			
				
					|  |  |  |  | 	[HttpGet("random")] | 
			
		
	
		
			
				
					|  |  |  |  | 	[EndpointMetrics("image.generate.generate.random")] | 
			
		
	
		
			
				
					|  |  |  |  | 	[ProducesResponseType(typeof(Stream), StatusCodes.Status200OK, "image/png")] | 
			
		
	
		
			
				
					|  |  |  |  | 	[ProducesResponseType(typeof(EventResult), StatusCodes.Status400BadRequest)] | 
			
		
	
		
			
				
					|  |  |  |  | 	[ProducesResponseType(typeof(EventResult), StatusCodes.Status404NotFound)] | 
			
		
	
		
			
				
					|  |  |  |  | 	[ProducesResponseType(typeof(EventResult), StatusCodes.Status500InternalServerError)] | 
			
		
	
		
			
				
					|  |  |  |  | 	[IgnoreToken] | 
			
		
	
		
			
				
					|  |  |  |  | 	public async Task<object> GenerateMemeAsync() | 
			
		
	
		
			
				
					|  |  |  |  | 	{ | 
			
		
	
		
			
				
					|  |  |  |  | 		try | 
			
		
	
		
			
				
					|  |  |  |  | 		{ | 
			
		
	
		
			
				
					|  |  |  |  | 			var result = await ImageManager.GenerateImageAsync(Request.HttpContext.RequestAborted); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 			if (result is byte[] data) | 
			
		
	
		
			
				
					|  |  |  |  | 			{ | 
			
		
	
		
			
				
					|  |  |  |  | 				var image = new MemoryStream(data); | 
			
		
	
		
			
				
					|  |  |  |  | 				 | 
			
		
	
		
			
				
					|  |  |  |  | 				return HttpContext.SendStream(image, "image/png"); | 
			
		
	
		
			
				
					|  |  |  |  | 			} | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 			return result as IResult; | 
			
		
	
		
			
				
					|  |  |  |  | 		} | 
			
		
	
		
			
				
					|  |  |  |  | 		catch (ArgumentException ex) | 
			
		
	
		
			
				
					|  |  |  |  | 		{ | 
			
		
	
		
			
				
					|  |  |  |  | 			_logger.LogCritical(ex.Message, ex); | 
			
		
	
		
			
				
					|  |  |  |  | 			 | 
			
		
	
		
			
				
					|  |  |  |  | 			return HttpContext.Send(EventResult.FromFailure("Can't parse result"), System.Net.HttpStatusCode.InternalServerError); | 
			
		
	
		
			
				
					|  |  |  |  | 		} | 
			
		
	
		
			
				
					|  |  |  |  | 	} | 
			
		
	
	
		
			
				
					|  |  |  | 
 |