-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathImageGenServiceFactory.cs
More file actions
27 lines (24 loc) · 1.34 KB
/
ImageGenServiceFactory.cs
File metadata and controls
27 lines (24 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
using MaIN.Domain.Configuration;
using MaIN.Services.Services.Abstract;
using MaIN.Services.Services.ImageGenServices;
using Microsoft.Extensions.DependencyInjection;
namespace MaIN.Services.Services.LLMService.Factory;
public class ImageGenServiceFactory(IServiceProvider serviceProvider) : IImageGenServiceFactory
{
public IImageGenService CreateService(BackendType backendType)
{
return backendType switch
{
BackendType.OpenAi => new OpenAiImageGenService(serviceProvider.GetRequiredService<IHttpClientFactory>(),
serviceProvider.GetRequiredService<MaINSettings>()),
BackendType.Gemini => new GeminiImageGenService(serviceProvider.GetRequiredService<IHttpClientFactory>(),
serviceProvider.GetRequiredService<MaINSettings>()),
BackendType.DeepSeek => throw new NotSupportedException("DeepSeek does not support image generation."),
BackendType.GroqCloud => throw new NotSupportedException("Groq Cloud does not support image generation."),
BackendType.Self => new ImageGenService(serviceProvider.GetRequiredService<IHttpClientFactory>(),
serviceProvider.GetRequiredService<MaINSettings>()),
// Add other backends as needed
_ => throw new ArgumentOutOfRangeException(nameof(backendType))
};
}
}