59 lines
1.9 KiB
C#
59 lines
1.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using AICore.Facade.LLM;
|
|
using BeWo.Service.Core;
|
|
using BS.Shared;
|
|
using BS.Shared.Core;
|
|
|
|
namespace BeWo.Service.ServiceProxy
|
|
{
|
|
public static class ServiceFacade
|
|
{
|
|
//private static readonly Lazy<OpenWebApiClient> _OpenWebApiClient = new Lazy<OpenWebApiClient>(()
|
|
// => new OpenWebApiClient(
|
|
// MergedConfig.GetSetting(WebConfigSetting.OpenWebUIUrl),
|
|
// MergedConfig.GetSecretSetting(WebSecretConfigSetting.OpenWebUIKey)));
|
|
|
|
private static readonly Lazy<OllamaApiClient> _OllamaApiClient = new Lazy<OllamaApiClient>(()
|
|
=> new OllamaApiClient(
|
|
MergedConfig.GetSetting(WebConfigSetting.OllamaUrl),
|
|
MergedConfig.GetSecretSetting(WebSecretConfigSetting.OllamaKey)));
|
|
|
|
private static readonly Lazy<OllamaApiClient> _Ollama2ApiClient = new Lazy<OllamaApiClient>(()
|
|
=> new OllamaApiClient(
|
|
MergedConfig.GetSetting(WebConfigSetting.Ollama2Url),
|
|
MergedConfig.GetSecretSetting(WebSecretConfigSetting.Ollama2Key),
|
|
AiModelSource.ollama2));
|
|
|
|
private static readonly Lazy<XRechnungApiClient> _XRechnungFacade = new Lazy<XRechnungApiClient>(()
|
|
=> new XRechnungApiClient());
|
|
|
|
public static OllamaApiClient OllamaApiClient => _OllamaApiClient.Value;
|
|
public static OllamaApiClient Ollama2ApiClient => _Ollama2ApiClient.Value;
|
|
public static XRechnungApiClient XRechnung => _XRechnungFacade.Value;
|
|
|
|
public static BaseLLMApiClient GetLLMApiClientByConfig(AiModelSource aiModelSource)
|
|
{
|
|
switch (aiModelSource)
|
|
{
|
|
case AiModelSource.openwebui:
|
|
throw new NotImplementedException();
|
|
case AiModelSource.ollama:
|
|
return OllamaApiClient;
|
|
case AiModelSource.ollama2:
|
|
return Ollama2ApiClient;
|
|
}
|
|
|
|
throw new NotImplementedException("err653463");
|
|
}
|
|
|
|
public static BaseLLMApiClient[] GetActiveApiClients()
|
|
{
|
|
return new BaseLLMApiClient[] { OllamaApiClient, Ollama2ApiClient };
|
|
}
|
|
}
|
|
}
|