Ollama2 aktiviert
This commit is contained in:
@@ -10,6 +10,7 @@ using System.Text.Json;
|
||||
using BS.Shared.Interface;
|
||||
using BeWo.ServerUtils.ApiFacade;
|
||||
using BS.Shared.Logger;
|
||||
using BS.Shared;
|
||||
|
||||
namespace AICore.Facade.LLM
|
||||
{
|
||||
|
||||
@@ -15,9 +15,14 @@ namespace AICore.Facade.LLM
|
||||
{
|
||||
public class OllamaApiClient : BaseLLMApiClient
|
||||
{
|
||||
public OllamaApiClient(string base_url, string api_key) : base(base_url, api_key)
|
||||
{
|
||||
private AiModelSource _aiModelSource;
|
||||
|
||||
public OllamaApiClient(string base_url, string api_key, AiModelSource modelSource = AiModelSource.ollama) : base(base_url, api_key)
|
||||
{
|
||||
_aiModelSource = modelSource;
|
||||
|
||||
if (modelSource != AiModelSource.ollama && modelSource != AiModelSource.ollama2)
|
||||
throw new NotImplementedException("err4548975");
|
||||
}
|
||||
|
||||
public override ApiResponse<IEnumerable<AiModelDC>> GetAiModelle()
|
||||
@@ -48,7 +53,7 @@ namespace AICore.Facade.LLM
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
var data = response.Data.models.Select(x => new AiModelDC(BS.Shared.AiModelSource.ollama, x.name, x.details.max_context_size));
|
||||
var data = response.Data.models.Select(x => new AiModelDC(_aiModelSource, x.name, x.details.max_context_size));
|
||||
|
||||
return ApiResponse<IEnumerable<AiModelDC>>.SuccessResponse(data);
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace AICore.Facade.LLM
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
var data = response.Data.data.Select(x => new AiModelDC(BS.Shared.AiModelSource.openwebui, x.name, x.details?.max_context_size ?? -2));
|
||||
var data = response.Data.data.Select(x => new AiModelDC(AiModelSource.openwebui, x.name, x.details?.max_context_size ?? -2));
|
||||
|
||||
return ApiResponse<IEnumerable<AiModelDC>>.SuccessResponse(data);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace BeWo.Service
|
||||
{
|
||||
OpenWebUIUrl,
|
||||
OllamaUrl,
|
||||
OllamaUrl2,
|
||||
Ollama2Url,
|
||||
XRechnungApiUrl,
|
||||
StoredFilesFolderPath,
|
||||
StoredTenantFilesFolderPath,
|
||||
|
||||
@@ -12,12 +12,23 @@ 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)));
|
||||
=> 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)));
|
||||
=> new OllamaApiClient(
|
||||
MergedConfig.GetSetting(WebConfigSetting.OllamaUrl),
|
||||
MergedConfig.GetSecretSetting(WebSecretConfigSetting.OllamaKey)));
|
||||
|
||||
private static readonly Lazy<OllamaApiClient> _Ollama2ApiClient = new Lazy<OllamaApiClient>(()
|
||||
=> new OllamaApiClient(MergedConfig.GetSetting(WebConfigSetting.OllamaUrl2), MergedConfig.GetSecretSetting(WebSecretConfigSetting.OllamaKey)));
|
||||
private static readonly Lazy<XRechnungApiClient> _XRechnungFacade = new Lazy<XRechnungApiClient>(() => new XRechnungApiClient());
|
||||
=> new OllamaApiClient(
|
||||
MergedConfig.GetSetting(WebConfigSetting.Ollama2Url),
|
||||
MergedConfig.GetSecretSetting(WebSecretConfigSetting.OllamaKey),
|
||||
AiModelSource.ollama2));
|
||||
|
||||
private static readonly Lazy<XRechnungApiClient> _XRechnungFacade = new Lazy<XRechnungApiClient>(()
|
||||
=> new XRechnungApiClient());
|
||||
|
||||
public static OpenWebApiClient OpenWebApiClient => _OpenWebApiClient.Value;
|
||||
public static OllamaApiClient OllamaApiClient => _OllamaApiClient.Value;
|
||||
|
||||
Reference in New Issue
Block a user