AICore abkapseln

This commit is contained in:
2025-09-08 15:17:51 +02:00
parent 3c7d953d67
commit 4acad3adaf
62 changed files with 202 additions and 130 deletions

View File

@@ -6,7 +6,7 @@ using BS.Shared.DataContracts.Compact;
namespace AICore.Context.Core namespace AICore.Context.Core
{ {
public static class ContextEntryMapperFactory internal static class ContextEntryMapperFactory
{ {
public static CustomerContextEntryMapper CustomerMapper { get; } = new CustomerContextEntryMapper(); public static CustomerContextEntryMapper CustomerMapper { get; } = new CustomerContextEntryMapper();
public static EmployeeContextEntryMapper EmployeeMapper { get; } = new EmployeeContextEntryMapper(); public static EmployeeContextEntryMapper EmployeeMapper { get; } = new EmployeeContextEntryMapper();

View File

@@ -9,7 +9,7 @@ using System.Collections.Generic;
namespace AICore.Context.SummaryMapper namespace AICore.Context.SummaryMapper
{ {
public static class ContextSummaryFactory internal static class ContextSummaryFactory
{ {
public static DetailContextSummary<TEntry, TEntity> CreateDetailContext<TEntry, TEntity>(TEntity entity) public static DetailContextSummary<TEntry, TEntity> CreateDetailContext<TEntry, TEntity>(TEntity entity)
where TEntry : DetailContextEntry<TEntity> where TEntry : DetailContextEntry<TEntity>

View File

@@ -1,6 +1,6 @@
namespace AICore.Context.Entry namespace AICore.Context.Entry
{ {
public abstract class BaseContextEntry internal abstract class BaseContextEntry
{ {
} }

View File

@@ -4,7 +4,7 @@ using System.Text.Json.Serialization;
namespace AICore.Context.Entry namespace AICore.Context.Entry
{ {
public class CustomerDetailContextEntry : DetailContextEntry<CustomerDC> internal class CustomerDetailContextEntry : DetailContextEntry<CustomerDC>
{ {
[JsonPropertyName("Klient-ID")] [JsonPropertyName("Klient-ID")]
public long CustomerOid { get; set; } public long CustomerOid { get; set; }

View File

@@ -1,6 +1,6 @@
namespace AICore.Context.Entry namespace AICore.Context.Entry
{ {
public abstract class DetailContextEntry<T> : BaseContextEntry internal abstract class DetailContextEntry<T> : BaseContextEntry
{ {
} }

View File

@@ -2,7 +2,7 @@
namespace AICore.Context.Entry namespace AICore.Context.Entry
{ {
public class EmployeeDetailContextEntry : DetailContextEntry<EmployeeDC> internal class EmployeeDetailContextEntry : DetailContextEntry<EmployeeDC>
{ {
} }

View File

@@ -2,7 +2,7 @@
namespace AICore.Context.Entry namespace AICore.Context.Entry
{ {
public class OrganisationDetailContextEntry : DetailContextEntry<OrganisationDC> internal class OrganisationDetailContextEntry : DetailContextEntry<OrganisationDC>
{ {
} }

View File

@@ -2,7 +2,7 @@
namespace AICore.Context.Entry namespace AICore.Context.Entry
{ {
public class PersonDetailContextEntry : DetailContextEntry<PersonDC> internal class PersonDetailContextEntry : DetailContextEntry<PersonDC>
{ {
} }

View File

@@ -2,7 +2,7 @@
namespace AICore.Context.Entry namespace AICore.Context.Entry
{ {
public class SupportConceptDetailContextEntry : DetailContextEntry<SupportConceptDC> internal class SupportConceptDetailContextEntry : DetailContextEntry<SupportConceptDC>
{ {
} }

View File

@@ -5,7 +5,7 @@ using System.Text.Json.Serialization;
namespace AICore.Context.Entry.Navigation namespace AICore.Context.Entry.Navigation
{ {
public class CustomerNavigationContextEntry : NavigationContextEntry<CompactCustomerDC> internal class CustomerNavigationContextEntry : NavigationContextEntry<CompactCustomerDC>
{ {
[JsonPropertyName("Adresse")] [JsonPropertyName("Adresse")]
public string AddressString { get; set; } public string AddressString { get; set; }

View File

@@ -3,7 +3,7 @@ using System.Text.Json.Serialization;
namespace AICore.Context.Entry.Navigation namespace AICore.Context.Entry.Navigation
{ {
public class EmployeeNavigationContextEntry : NavigationContextEntry<CompactEmployeeDC> internal class EmployeeNavigationContextEntry : NavigationContextEntry<CompactEmployeeDC>
{ {
[JsonPropertyName("Mitarbeiter-ID")] [JsonPropertyName("Mitarbeiter-ID")]
public long EmployeeOid { get; set; } public long EmployeeOid { get; set; }

View File

@@ -1,6 +1,6 @@
namespace AICore.Context.Entry.Navigation namespace AICore.Context.Entry.Navigation
{ {
public abstract class NavigationContextEntry<T> : BaseContextEntry internal abstract class NavigationContextEntry<T> : BaseContextEntry
{ {
} }

View File

@@ -3,7 +3,7 @@ using System.Text.Json.Serialization;
namespace AICore.Context.Entry.Navigation namespace AICore.Context.Entry.Navigation
{ {
public class OrganisationNavigationContextEntry : NavigationContextEntry<CompactOrganisationDC> internal class OrganisationNavigationContextEntry : NavigationContextEntry<CompactOrganisationDC>
{ {
[JsonPropertyName("Organisation-ID")] [JsonPropertyName("Organisation-ID")]
public long OrganisationOid { get; set; } public long OrganisationOid { get; set; }

View File

@@ -4,7 +4,7 @@ using System.Text.Json.Serialization;
namespace AICore.Context.Entry.Navigation namespace AICore.Context.Entry.Navigation
{ {
public class PersonNavigationContextEntry : NavigationContextEntry<CompactPersonDC> internal class PersonNavigationContextEntry : NavigationContextEntry<CompactPersonDC>
{ {
[JsonPropertyName("Adresse")] [JsonPropertyName("Adresse")]
public string AddressString { get; set; } public string AddressString { get; set; }

View File

@@ -4,7 +4,7 @@ using System.Text.Json.Serialization;
namespace AICore.Context.Entry.Navigation namespace AICore.Context.Entry.Navigation
{ {
public class ServiceRecordContextEntry : NavigationContextEntry<ServiceRecordDC> internal class ServiceRecordContextEntry : NavigationContextEntry<ServiceRecordDC>
{ {
[JsonPropertyName("Zeiteintrag-ID")] [JsonPropertyName("Zeiteintrag-ID")]
public long ServiceRecordOid { get; set; } public long ServiceRecordOid { get; set; }

View File

@@ -5,7 +5,7 @@ using System.Text.Json.Serialization;
namespace AICore.Context.Entry.Navigation namespace AICore.Context.Entry.Navigation
{ {
public class SupportConceptNavigationContextEntry : NavigationContextEntry<CompactSupportConceptDC> internal class SupportConceptNavigationContextEntry : NavigationContextEntry<CompactSupportConceptDC>
{ {
[JsonPropertyName("Hilfeplan-ID")] [JsonPropertyName("Hilfeplan-ID")]
public long SupportConceptOid { get; set; } public long SupportConceptOid { get; set; }

View File

@@ -4,7 +4,7 @@ using System.Linq;
namespace AICore.Context.EntryMapper namespace AICore.Context.EntryMapper
{ {
public abstract class BaseContextEntryMapper<TObject, TContext> internal abstract class BaseContextEntryMapper<TObject, TContext>
where TObject : class, new() where TContext : BaseContextEntry, new() where TObject : class, new() where TContext : BaseContextEntry, new()
{ {
public virtual TContext MapToNewContext(TObject pObject) public virtual TContext MapToNewContext(TObject pObject)

View File

@@ -4,7 +4,7 @@ using BS.Shared.Extensions;
namespace AICore.Context.EntryMapper.Detail namespace AICore.Context.EntryMapper.Detail
{ {
public class CustomerContextEntryMapper : BaseContextEntryMapper<CustomerDC, CustomerDetailContextEntry> internal class CustomerContextEntryMapper : BaseContextEntryMapper<CustomerDC, CustomerDetailContextEntry>
{ {
public override void MergeWithObject(CustomerDC pObject, CustomerDetailContextEntry pContext) public override void MergeWithObject(CustomerDC pObject, CustomerDetailContextEntry pContext)
{ {

View File

@@ -5,7 +5,7 @@ using BS.Shared.DataContracts;
namespace AICore.Context.EntryMapper.Detail namespace AICore.Context.EntryMapper.Detail
{ {
public class EmployeeContextEntryMapper : BaseContextEntryMapper<EmployeeDC, EmployeeDetailContextEntry> internal class EmployeeContextEntryMapper : BaseContextEntryMapper<EmployeeDC, EmployeeDetailContextEntry>
{ {
public override void MergeWithObject(EmployeeDC pObject, EmployeeDetailContextEntry pContext) public override void MergeWithObject(EmployeeDC pObject, EmployeeDetailContextEntry pContext)
{ {

View File

@@ -5,7 +5,7 @@ using BS.Shared.DataContracts;
namespace AICore.Context.EntryMapper.Detail namespace AICore.Context.EntryMapper.Detail
{ {
public class OrganisationContextEntryMapper : BaseContextEntryMapper<OrganisationDC, OrganisationDetailContextEntry> internal class OrganisationContextEntryMapper : BaseContextEntryMapper<OrganisationDC, OrganisationDetailContextEntry>
{ {
public override void MergeWithObject(OrganisationDC pObject, OrganisationDetailContextEntry pContext) public override void MergeWithObject(OrganisationDC pObject, OrganisationDetailContextEntry pContext)
{ {

View File

@@ -5,7 +5,7 @@ using BS.Shared.DataContracts;
namespace AICore.Context.EntryMapper.Detail namespace AICore.Context.EntryMapper.Detail
{ {
public class PersonContextEntryMapper : BaseContextEntryMapper<PersonDC, PersonDetailContextEntry> internal class PersonContextEntryMapper : BaseContextEntryMapper<PersonDC, PersonDetailContextEntry>
{ {
public override void MergeWithObject(PersonDC pObject, PersonDetailContextEntry pContext) public override void MergeWithObject(PersonDC pObject, PersonDetailContextEntry pContext)
{ {

View File

@@ -5,7 +5,7 @@ using BS.Shared.DataContracts;
namespace AICore.Context.EntryMapper.Detail namespace AICore.Context.EntryMapper.Detail
{ {
public class ServiceRecordContextEntryMapper : BaseContextEntryMapper<ServiceRecordDC, ServiceRecordContextEntry> internal class ServiceRecordContextEntryMapper : BaseContextEntryMapper<ServiceRecordDC, ServiceRecordContextEntry>
{ {
public override void MergeWithObject(ServiceRecordDC pObject, ServiceRecordContextEntry pContext) public override void MergeWithObject(ServiceRecordDC pObject, ServiceRecordContextEntry pContext)
{ {

View File

@@ -5,7 +5,7 @@ using BS.Shared.DataContracts;
namespace AICore.Context.EntryMapper.Detail namespace AICore.Context.EntryMapper.Detail
{ {
public class SupportConceptContextEntryMapper : BaseContextEntryMapper<SupportConceptDC, SupportConceptDetailContextEntry> internal class SupportConceptContextEntryMapper : BaseContextEntryMapper<SupportConceptDC, SupportConceptDetailContextEntry>
{ {
public override void MergeWithObject(SupportConceptDC pObject, SupportConceptDetailContextEntry pContext) public override void MergeWithObject(SupportConceptDC pObject, SupportConceptDetailContextEntry pContext)
{ {

View File

@@ -6,7 +6,7 @@ using BS.Shared.Extensions;
namespace AICore.Context.EntryMapper.Navigation namespace AICore.Context.EntryMapper.Navigation
{ {
public class CustomerNavigationContextEntryMapper : BaseContextEntryMapper<CompactCustomerDC, CustomerNavigationContextEntry> internal class CustomerNavigationContextEntryMapper : BaseContextEntryMapper<CompactCustomerDC, CustomerNavigationContextEntry>
{ {
public override void MergeWithObject(CompactCustomerDC pObject, CustomerNavigationContextEntry pContext) public override void MergeWithObject(CompactCustomerDC pObject, CustomerNavigationContextEntry pContext)
{ {

View File

@@ -9,7 +9,7 @@ using BS.Shared.Extensions;
namespace AICore.Context.EntryMapper.Navigation namespace AICore.Context.EntryMapper.Navigation
{ {
public class EmployeeNavigationContextEntryMapper : BaseContextEntryMapper<CompactEmployeeDC, EmployeeNavigationContextEntry> internal class EmployeeNavigationContextEntryMapper : BaseContextEntryMapper<CompactEmployeeDC, EmployeeNavigationContextEntry>
{ {
public override void MergeWithObject(CompactEmployeeDC pObject, EmployeeNavigationContextEntry pContext) public override void MergeWithObject(CompactEmployeeDC pObject, EmployeeNavigationContextEntry pContext)
{ {

View File

@@ -6,7 +6,7 @@ using BS.Shared.Extensions;
namespace AICore.Context.EntryMapper.Navigation namespace AICore.Context.EntryMapper.Navigation
{ {
public class OrganisationNavigationContextEntryMapper : BaseContextEntryMapper<CompactOrganisationDC, OrganisationNavigationContextEntry> internal class OrganisationNavigationContextEntryMapper : BaseContextEntryMapper<CompactOrganisationDC, OrganisationNavigationContextEntry>
{ {
public override void MergeWithObject(CompactOrganisationDC pObject, OrganisationNavigationContextEntry pContext) public override void MergeWithObject(CompactOrganisationDC pObject, OrganisationNavigationContextEntry pContext)
{ {

View File

@@ -8,7 +8,7 @@ using BS.Shared.DataContracts.Compact;
namespace AICore.Context.EntryMapper.Navigation namespace AICore.Context.EntryMapper.Navigation
{ {
public class PersonNavigationContextEntryMapper : BaseContextEntryMapper<CompactPersonDC, PersonNavigationContextEntry> internal class PersonNavigationContextEntryMapper : BaseContextEntryMapper<CompactPersonDC, PersonNavigationContextEntry>
{ {
public override void MergeWithObject(CompactPersonDC pObject, PersonNavigationContextEntry pContext) public override void MergeWithObject(CompactPersonDC pObject, PersonNavigationContextEntry pContext)
{ {

View File

@@ -9,7 +9,7 @@ using BS.Shared.Extensions;
namespace AICore.Context.EntryMapper.Navigation namespace AICore.Context.EntryMapper.Navigation
{ {
public class SupportConceptNavigationContextEntryMapper : BaseContextEntryMapper<CompactSupportConceptDC, SupportConceptNavigationContextEntry> internal class SupportConceptNavigationContextEntryMapper : BaseContextEntryMapper<CompactSupportConceptDC, SupportConceptNavigationContextEntry>
{ {
public override void MergeWithObject(CompactSupportConceptDC pObject, SupportConceptNavigationContextEntry pContext) public override void MergeWithObject(CompactSupportConceptDC pObject, SupportConceptNavigationContextEntry pContext)
{ {

View File

@@ -1,6 +1,6 @@
namespace AICore.Context.Summary namespace AICore.Context.Summary
{ {
public abstract class BaseContextSummary internal abstract class BaseContextSummary
{ {
public object Context { get; set; } public object Context { get; set; }
} }

View File

@@ -3,8 +3,8 @@ using BS.Shared.DataContracts;
namespace AICore.Context.Summary namespace AICore.Context.Summary
{ {
public class CustomerDetailContextSummary : DetailContextSummary<CustomerDetailContextEntry, CustomerDC> internal class CustomerDetailContextSummary : DetailContextSummary<CustomerDetailContextEntry, CustomerDC>
{ {
public CustomerDetailContextSummary(CustomerDetailContextEntry customer) : base(customer) { } internal CustomerDetailContextSummary(CustomerDetailContextEntry customer) : base(customer) { }
} }
} }

View File

@@ -4,8 +4,8 @@ using BS.Shared.DataContracts.Compact;
namespace AICore.Context.Summary namespace AICore.Context.Summary
{ {
public class CustomerNavigationContextSummary : NavigationContextSummary<CustomerNavigationContextEntry, CompactCustomerDC> internal class CustomerNavigationContextSummary : NavigationContextSummary<CustomerNavigationContextEntry, CompactCustomerDC>
{ {
public CustomerNavigationContextSummary(IEnumerable<CustomerNavigationContextEntry> customers) : base(customers) { } internal CustomerNavigationContextSummary(IEnumerable<CustomerNavigationContextEntry> customers) : base(customers) { }
} }
} }

View File

@@ -2,9 +2,9 @@
namespace AICore.Context.Summary namespace AICore.Context.Summary
{ {
public abstract class DetailContextSummary<TEntry, TEntity> : BaseContextSummary where TEntry : DetailContextEntry<TEntity> internal abstract class DetailContextSummary<TEntry, TEntity> : BaseContextSummary where TEntry : DetailContextEntry<TEntity>
{ {
public TEntry DataContext { get; set; } internal TEntry DataContext { get; set; }
protected DetailContextSummary(TEntry dataContext) protected DetailContextSummary(TEntry dataContext)
{ {

View File

@@ -3,8 +3,8 @@ using BS.Shared.DataContracts;
namespace AICore.Context.Summary namespace AICore.Context.Summary
{ {
public class EmployeeDetailContextSummary : DetailContextSummary<EmployeeDetailContextEntry, EmployeeDC> internal class EmployeeDetailContextSummary : DetailContextSummary<EmployeeDetailContextEntry, EmployeeDC>
{ {
public EmployeeDetailContextSummary(EmployeeDetailContextEntry employee) : base(employee) { } internal EmployeeDetailContextSummary(EmployeeDetailContextEntry employee) : base(employee) { }
} }
} }

View File

@@ -4,8 +4,8 @@ using BS.Shared.DataContracts.Compact;
namespace AICore.Context.Summary namespace AICore.Context.Summary
{ {
public class EmployeeNavigationContextSummary : NavigationContextSummary<EmployeeNavigationContextEntry, CompactEmployeeDC> internal class EmployeeNavigationContextSummary : NavigationContextSummary<EmployeeNavigationContextEntry, CompactEmployeeDC>
{ {
public EmployeeNavigationContextSummary(IEnumerable<EmployeeNavigationContextEntry> employee) : base(employee) { } internal EmployeeNavigationContextSummary(IEnumerable<EmployeeNavigationContextEntry> employee) : base(employee) { }
} }
} }

View File

@@ -3,9 +3,9 @@ using AICore.Context.Entry.Navigation;
namespace AICore.Context.Summary namespace AICore.Context.Summary
{ {
public abstract class NavigationContextSummary<TEntry, TEntity> : BaseContextSummary where TEntry : NavigationContextEntry<TEntity> internal abstract class NavigationContextSummary<TEntry, TEntity> : BaseContextSummary where TEntry : NavigationContextEntry<TEntity>
{ {
public IEnumerable<TEntry> DataContext { get; set; } internal IEnumerable<TEntry> DataContext { get; set; }
protected NavigationContextSummary(IEnumerable<TEntry> dataContext) protected NavigationContextSummary(IEnumerable<TEntry> dataContext)
{ {

View File

@@ -3,8 +3,8 @@ using BS.Shared.DataContracts;
namespace AICore.Context.Summary namespace AICore.Context.Summary
{ {
public class OrganisationDetailContextSummary : DetailContextSummary<OrganisationDetailContextEntry, OrganisationDC> internal class OrganisationDetailContextSummary : DetailContextSummary<OrganisationDetailContextEntry, OrganisationDC>
{ {
public OrganisationDetailContextSummary(OrganisationDetailContextEntry organisation) : base(organisation) { } internal OrganisationDetailContextSummary(OrganisationDetailContextEntry organisation) : base(organisation) { }
} }
} }

View File

@@ -4,8 +4,8 @@ using BS.Shared.DataContracts.Compact;
namespace AICore.Context.Summary namespace AICore.Context.Summary
{ {
public class OrganisationNavigationContextSummary : NavigationContextSummary<OrganisationNavigationContextEntry, CompactOrganisationDC> internal class OrganisationNavigationContextSummary : NavigationContextSummary<OrganisationNavigationContextEntry, CompactOrganisationDC>
{ {
public OrganisationNavigationContextSummary(IEnumerable<OrganisationNavigationContextEntry> organisation) : base(organisation) { } internal OrganisationNavigationContextSummary(IEnumerable<OrganisationNavigationContextEntry> organisation) : base(organisation) { }
} }
} }

View File

@@ -3,8 +3,8 @@ using BS.Shared.DataContracts;
namespace AICore.Context.Summary namespace AICore.Context.Summary
{ {
public class PersonDetailContextSummary : DetailContextSummary<PersonDetailContextEntry, PersonDC> internal class PersonDetailContextSummary : DetailContextSummary<PersonDetailContextEntry, PersonDC>
{ {
public PersonDetailContextSummary(PersonDetailContextEntry person) : base(person) { } internal PersonDetailContextSummary(PersonDetailContextEntry person) : base(person) { }
} }
} }

View File

@@ -4,8 +4,8 @@ using BS.Shared.DataContracts.Compact;
namespace AICore.Context.Summary namespace AICore.Context.Summary
{ {
public class PersonNavigationContextSummary : NavigationContextSummary<PersonNavigationContextEntry, CompactPersonDC> internal class PersonNavigationContextSummary : NavigationContextSummary<PersonNavigationContextEntry, CompactPersonDC>
{ {
public PersonNavigationContextSummary(IEnumerable<PersonNavigationContextEntry> person) : base(person) { } internal PersonNavigationContextSummary(IEnumerable<PersonNavigationContextEntry> person) : base(person) { }
} }
} }

View File

@@ -4,13 +4,13 @@ using System.Collections.Generic;
namespace AICore.Context.Summary namespace AICore.Context.Summary
{ {
public class ServiceRecordNavigationContextSummary : NavigationContextSummary<ServiceRecordContextEntry, ServiceRecordDC> internal class ServiceRecordNavigationContextSummary : NavigationContextSummary<ServiceRecordContextEntry, ServiceRecordDC>
{ {
public CustomerNavigationContextEntry Customer { get; set; } internal CustomerNavigationContextEntry Customer { get; set; }
public string CostBearer { get; set; } internal string CostBearer { get; set; }
public string SupportConcept { get; set; } internal string SupportConcept { get; set; }
public ServiceRecordNavigationContextSummary(IEnumerable<ServiceRecordContextEntry> serviceRecords, CustomerNavigationContextEntry customer, string costBearer, string supportConcept) internal ServiceRecordNavigationContextSummary(IEnumerable<ServiceRecordContextEntry> serviceRecords, CustomerNavigationContextEntry customer, string costBearer, string supportConcept)
: base(serviceRecords) : base(serviceRecords)
{ {
Customer = customer; Customer = customer;

View File

@@ -3,8 +3,8 @@ using BS.Shared.DataContracts;
namespace AICore.Context.Summary namespace AICore.Context.Summary
{ {
public class SupportConceptDetailContextSummary : DetailContextSummary<SupportConceptDetailContextEntry, SupportConceptDC> internal class SupportConceptDetailContextSummary : DetailContextSummary<SupportConceptDetailContextEntry, SupportConceptDC>
{ {
public SupportConceptDetailContextSummary(SupportConceptDetailContextEntry supportConcept) : base(supportConcept) { } internal SupportConceptDetailContextSummary(SupportConceptDetailContextEntry supportConcept) : base(supportConcept) { }
} }
} }

View File

@@ -4,8 +4,8 @@ using BS.Shared.DataContracts.Compact;
namespace AICore.Context.Summary namespace AICore.Context.Summary
{ {
public class SupportConceptNavigationContextSummary : NavigationContextSummary<SupportConceptNavigationContextEntry, CompactSupportConceptDC> internal class SupportConceptNavigationContextSummary : NavigationContextSummary<SupportConceptNavigationContextEntry, CompactSupportConceptDC>
{ {
public SupportConceptNavigationContextSummary(IEnumerable<SupportConceptNavigationContextEntry> supportConcept) : base(supportConcept) { } internal SupportConceptNavigationContextSummary(IEnumerable<SupportConceptNavigationContextEntry> supportConcept) : base(supportConcept) { }
} }
} }

View File

@@ -9,7 +9,7 @@ using System.Threading.Tasks;
namespace AICore.Context.SummaryParser namespace AICore.Context.SummaryParser
{ {
public abstract class BaseContextSummaryParser internal abstract class BaseContextSummaryParser
{ {
public abstract string Parse(AiContextType uicontext, BaseContextSummary context); public abstract string Parse(AiContextType uicontext, BaseContextSummary context);
} }

View File

@@ -12,7 +12,7 @@ using System.Threading.Tasks;
namespace AICore.Context.SummaryParser namespace AICore.Context.SummaryParser
{ {
public class CsvContextSummaryParser : BaseContextSummaryParser internal class CsvContextSummaryParser : BaseContextSummaryParser
{ {
private string _Delimiter; private string _Delimiter;
private bool _StrictEscapeCsvField; private bool _StrictEscapeCsvField;

View File

@@ -9,7 +9,7 @@ using System.Threading.Tasks;
namespace AICore.Context.SummaryParser namespace AICore.Context.SummaryParser
{ {
public class JsonContextSummaryParser : BaseContextSummaryParser internal class JsonContextSummaryParser : BaseContextSummaryParser
{ {
public override string Parse(AiContextType uicontext, BaseContextSummary context) public override string Parse(AiContextType uicontext, BaseContextSummary context)
{ {

View File

@@ -1,12 +1,13 @@
using BS.Shared.DataContracts; using BS.Shared.DataContracts;
using BS.Shared.Exceptions; using BS.Shared.Exceptions;
using BS.Shared.Interface.Feature.AICore;
using System.Collections.Generic; using System.Collections.Generic;
namespace AICore.Prompt.Core namespace AICore.Prompt.Core
{ {
public static class AiUtils public static class AiUtils
{ {
public static void CheckTokenSize(IList<AiConversationMessageDC> messages, string modelName, int max_context_size) public static void CheckTokenSize(IEnumerable<IAiConversationMessage> messages, string modelName, int max_context_size)
{ {
var buffer = 500; var buffer = 500;
@@ -28,7 +29,7 @@ namespace AICore.Prompt.Core
} }
} }
private static int CalculateTokensByModel(IList<AiConversationMessageDC> messages, string modelName) private static int CalculateTokensByModel(IEnumerable<IAiConversationMessage> messages, string modelName)
{ {
var count = 0; var count = 0;

View File

@@ -45,7 +45,7 @@ namespace AICore.Prompt.Factories
{ {
sb.AppendLine("Du erhälst folgende Daten:"); sb.AppendLine("Du erhälst folgende Daten:");
var parser = GetParser(aiDataContextType); var parser = GetParser(aiDataContextType);
var parsed = LoadContext(uicontext, bewoobjects, parser); var parsed = CreateContext(uicontext, bewoobjects, parser);
sb.AppendLine(parsed); sb.AppendLine(parsed);
} }
@@ -73,7 +73,7 @@ namespace AICore.Prompt.Factories
throw BeWoNotImplementedException.CreateFromEnum(aiDataContextType); throw BeWoNotImplementedException.CreateFromEnum(aiDataContextType);
} }
private string LoadContext(AiContextType uicontext, IEnumerable<IDataContract> bewoobjects, BaseContextSummaryParser parser) private string CreateContext(AiContextType uicontext, IEnumerable<IDataContract> bewoobjects, BaseContextSummaryParser parser)
{ {
var context = GetContext(uicontext, bewoobjects); var context = GetContext(uicontext, bewoobjects);
@@ -81,28 +81,28 @@ namespace AICore.Prompt.Factories
return parsed; return parsed;
} }
protected BaseContextSummary GetContext(AiContextType uicontext, IEnumerable<IDataContract> bewoobjects) private BaseContextSummary GetContext(AiContextType uicontext, IEnumerable<IDataContract> bewoobjects)
{ {
switch (uicontext) switch (uicontext)
{ {
case AiContextType.SupportConcept: case AiContextType.SupportConceptNavigation:
return GetNavigationContext<SupportConceptNavigationContextEntry, CompactSupportConceptDC>(bewoobjects); return GetNavigationContext<SupportConceptNavigationContextEntry, CompactSupportConceptDC>(bewoobjects);
case AiContextType.Customer: case AiContextType.CustomerNavigation:
return GetNavigationContext<CustomerNavigationContextEntry, CompactCustomerDC>(bewoobjects); return GetNavigationContext<CustomerNavigationContextEntry, CompactCustomerDC>(bewoobjects);
case AiContextType.Person: case AiContextType.PersonNavigation:
return GetNavigationContext<PersonNavigationContextEntry, CompactPersonDC>(bewoobjects); return GetNavigationContext<PersonNavigationContextEntry, CompactPersonDC>(bewoobjects);
case AiContextType.Employee: case AiContextType.EmployeeNavigation:
return GetNavigationContext<EmployeeNavigationContextEntry, CompactEmployeeDC>(bewoobjects); return GetNavigationContext<EmployeeNavigationContextEntry, CompactEmployeeDC>(bewoobjects);
case AiContextType.Organisation: case AiContextType.OrganisationNavigation:
return GetNavigationContext<OrganisationNavigationContextEntry, CompactOrganisationDC>(bewoobjects); return GetNavigationContext<OrganisationNavigationContextEntry, CompactOrganisationDC>(bewoobjects);
case AiContextType.ServiceRecord: case AiContextType.ServiceRecord:
return GetServiceRecordsContext(bewoobjects); return GetServiceRecordsContext(bewoobjects);
case AiContextType.CustomerSingle: case AiContextType.CustomerDetail:
return GetDetailContext<CustomerDetailContextEntry, CustomerDC>(bewoobjects); return GetDetailContext<CustomerDetailContextEntry, CustomerDC>(bewoobjects);
case AiContextType.PersonSingle: case AiContextType.PersonDetail:
return GetDetailContext<PersonDetailContextEntry, PersonDC>(bewoobjects); return GetDetailContext<PersonDetailContextEntry, PersonDC>(bewoobjects);
case AiContextType.EmployeeSingle: case AiContextType.EmployeeDetail:
return GetDetailContext<EmployeeDetailContextEntry, EmployeeDC>(bewoobjects); return GetDetailContext<EmployeeDetailContextEntry, EmployeeDC>(bewoobjects);
default: default:
throw BeWoNotImplementedException.CreateFromEnum(uicontext); throw BeWoNotImplementedException.CreateFromEnum(uicontext);

View File

@@ -26,11 +26,11 @@ namespace BeWo.Services
private string getStyleString(AiContextType uIContext) { private string getStyleString(AiContextType uIContext) {
switch (uIContext) switch (uIContext)
{ {
case AiContextType.SupportConcept: return "ModuleAiControlSupportConceptStyle"; case AiContextType.SupportConceptNavigation: return "ModuleAiControlSupportConceptStyle";
case AiContextType.Customer: return "ModuleAiControlCustomerStyle"; case AiContextType.CustomerNavigation: return "ModuleAiControlCustomerStyle";
case AiContextType.Person: return "ModuleAiControlPersonStyle"; case AiContextType.PersonNavigation: return "ModuleAiControlPersonStyle";
case AiContextType.Employee: return "ModuleAiControlEmployeeStyle"; case AiContextType.EmployeeNavigation: return "ModuleAiControlEmployeeStyle";
case AiContextType.Organisation: return "ModuleAiControlOrganisationStyle"; case AiContextType.OrganisationNavigation: return "ModuleAiControlOrganisationStyle";
case AiContextType.Team: case AiContextType.Team:
break; break;
case AiContextType.Dokumente: case AiContextType.Dokumente:
@@ -56,9 +56,9 @@ namespace BeWo.Services
case AiContextType.Administration: case AiContextType.Administration:
break; break;
case AiContextType.ServiceRecord: return "ModuleAiControlZeiterfassungStyle"; case AiContextType.ServiceRecord: return "ModuleAiControlZeiterfassungStyle";
case AiContextType.CustomerSingle: return "ModuleAiControlCustomerStyle"; case AiContextType.CustomerDetail: return "ModuleAiControlCustomerStyle";
case AiContextType.PersonSingle: return "ModuleAiControlPersonStyle"; case AiContextType.PersonDetail: return "ModuleAiControlPersonStyle";
case AiContextType.EmployeeSingle: return "ModuleAiControlEmployeeStyle"; case AiContextType.EmployeeDetail: return "ModuleAiControlEmployeeStyle";
} }
return null; return null;

View File

@@ -18,12 +18,12 @@ namespace BeWo.Services
public Dictionary<AiContextType, string> UIContext2Header { get; set; } = new Dictionary<AiContextType, string>() public Dictionary<AiContextType, string> UIContext2Header { get; set; } = new Dictionary<AiContextType, string>()
{ {
{AiContextType.ServiceRecord, "KI Chat: Zeiterfassung" }, {AiContextType.ServiceRecord, "KI Chat: Zeiterfassung" },
{AiContextType.Customer, "KI Chat: Klienten Übersicht" }, {AiContextType.CustomerNavigation, "KI Chat: Klienten Übersicht" },
{AiContextType.Person, "KI Chat: Personen Übersicht" }, {AiContextType.PersonNavigation, "KI Chat: Personen Übersicht" },
{AiContextType.Employee, "KI Chat: Mitarbeiter Übersicht" }, {AiContextType.EmployeeNavigation, "KI Chat: Mitarbeiter Übersicht" },
{AiContextType.Organisation, "KI Chat: Organisation Übersicht" }, {AiContextType.OrganisationNavigation, "KI Chat: Organisation Übersicht" },
{AiContextType.SupportConcept, "KI Chat: Hilfeplan Übersicht" }, {AiContextType.SupportConceptNavigation, "KI Chat: Hilfeplan Übersicht" },
{AiContextType.CustomerSingle, "KI Chat: Klient" }, {AiContextType.CustomerDetail, "KI Chat: Klient" },
}; };
public AnimatedBeWoWindow GetAiConversationWindow(AiConversationChatViewModel viewModel, Control control, double height = 600, double width = 1200) public AnimatedBeWoWindow GetAiConversationWindow(AiConversationChatViewModel viewModel, Control control, double height = 600, double width = 1200)

View File

@@ -320,7 +320,7 @@ namespace BeWo.View.Detail
var customer_oid = ViewModel.DataContract.CustomerOid; var customer_oid = ViewModel.DataContract.CustomerOid;
var context = GetVisibleInformationReferences(); var context = GetVisibleInformationReferences();
var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.CustomerSingle, context, customer_oid); var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.CustomerDetail, context, customer_oid);
return vm; return vm;
} }

View File

@@ -207,7 +207,7 @@ namespace BeWo.View.Navigation
{ {
var context = GetVisibleInformationReferences(); var context = GetVisibleInformationReferences();
var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.Customer, context); var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.CustomerNavigation, context);
return vm; return vm;
} }

View File

@@ -113,7 +113,7 @@ namespace BeWo.View.Navigation
{ {
var context = GetVisibleInformationReferences(); var context = GetVisibleInformationReferences();
var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.Employee, context); var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.EmployeeNavigation, context);
return vm; return vm;
} }

View File

@@ -79,7 +79,7 @@ namespace BeWo.View.Navigation
{ {
var context = GetVisibleInformationReferences(); var context = GetVisibleInformationReferences();
var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.Organisation, context); var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.OrganisationNavigation, context);
return vm; return vm;
} }

View File

@@ -117,7 +117,7 @@ namespace BeWo.View.Navigation
{ {
var context = GetVisibleInformationReferences(); var context = GetVisibleInformationReferences();
var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.Person, context); var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.PersonNavigation, context);
return vm; return vm;
} }

View File

@@ -230,7 +230,7 @@ namespace BeWo.View.Navigation
{ {
var context = GetVisibleInformationReferences(); var context = GetVisibleInformationReferences();
var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.SupportConcept, context); var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.SupportConceptNavigation, context);
return vm; return vm;
} }

View File

@@ -3,10 +3,11 @@ using System.Collections.Generic;
using BS.Shared; using BS.Shared;
using BS.Shared.Core; using BS.Shared.Core;
using BS.Shared.Interface.Feature.AICore;
namespace BeWo.Data.Entities namespace BeWo.Data.Entities
{ {
public class AiConversationMessage : BeWoEntityBase public class AiConversationMessage : BeWoEntityBase, IAiConversationMessage
{ {
public AiConversationMessage() public AiConversationMessage()
{ {

View File

@@ -15,6 +15,7 @@ using BeWo.Service.Core;
using BeWo.Service.DCEntityMapper; using BeWo.Service.DCEntityMapper;
using BeWo.Service.Invoicing; using BeWo.Service.Invoicing;
using BeWo.Service.ServiceContracts; using BeWo.Service.ServiceContracts;
using BeWo.Service.ServiceImplementations;
using BeWo.Service.ServiceProxy; using BeWo.Service.ServiceProxy;
using BS.Shared; using BS.Shared;
using BS.Shared.Core; using BS.Shared.Core;
@@ -265,16 +266,19 @@ namespace BeWo.Service.Plugins
return models; return models;
} }
protected virtual AiConversation createAiConversation(AiContextType uicontext, Dictionary<TableID, IDataContract[]> context, long modell_oid, AiDataContextType context_Type) protected virtual AiConversation createAiConversation(AiContextType uicontext, Dictionary<TableID, long[]> context_reference, long modell_oid, AiDataContextType context_Type)
{ {
var current_user = UserRightHelper.GetLoggedInUserWithOid(); var current_user = UserRightHelper.GetLoggedInUserWithOid();
var factory = new AiPromptFactory(); var factory = new AiPromptFactory();
var system_prompt = factory.CreateSystemInstructions(uicontext, context, context_Type); loadContext(uicontext, context_reference, out var context_loaded);
var system_prompt = factory.CreateSystemInstructions(uicontext, context_loaded, context_Type);
var conv = new AiConversation(); var conv = new AiConversation();
conv.Created = DateTime.Now; conv.Created = DateTime.Now;
conv.ContextBeWoObjects = MapperFactory.AiConversation.Parse(context);
// RETODO Muss noch bzgl Sicherheit geprüft werden.
conv.ContextBeWoObjects = MapperFactory.AiConversation.Parse(context_reference);
conv.Displayname = "Neue Unterhaltung"; conv.Displayname = "Neue Unterhaltung";
conv.Messages = new List<AiConversationMessage>(); conv.Messages = new List<AiConversationMessage>();
conv.Modell = DAOFactory.GenericDAO.LoadByID<AiModel>(modell_oid); conv.Modell = DAOFactory.GenericDAO.LoadByID<AiModel>(modell_oid);
@@ -373,5 +377,51 @@ namespace BeWo.Service.Plugins
return new AiConversationMessageDC[] { user_msg_dc, assi_msg_dc }; return new AiConversationMessageDC[] { user_msg_dc, assi_msg_dc };
} }
protected virtual IEnumerable<IDataContract> loadContext(AiContextType uicontext, Dictionary<TableID, long[]> context_reference)
{
switch (uicontext)
{
case AiContextType.SupportConceptNavigation:
return new CustomerServiceImp().GetAllAuthorizedCompactSupportConcepts()
.Where(x => oidsContainsOid(context_reference[TableID.SupportConcept], x.SupportConceptOid));
case AiContextType.CustomerNavigation:
return new CustomerServiceImp().GetAllAuthorizedCompactCustomers()
.Where(x => oidsContainsOid(context_reference[TableID.Customer], x.CustomerOid));
case AiContextType.PersonNavigation:
return new CustomerServiceImp().GetAllAuthorizedCompactPersons()
.Where(x => oidsContainsOid(context_reference[TableID.Person], x.PersonOid));
case AiContextType.EmployeeNavigation:
return new EmployeeServiceImp().GetAllCompactEmployees()
.Where(x => oidsContainsOid(context_reference[TableID.Employee], x.EmployeeOid));
case AiContextType.OrganisationNavigation:
return new CustomerServiceImp().GetAllOrganisationsCompact()
.Where(x => oidsContainsOid(context_reference[TableID.Organisation], x.OrganisationOid));
case AiContextType.ServiceRecord:
break;
case AiContextType.CustomerDetail:
break;
case AiContextType.PersonDetail:
break;
case AiContextType.EmployeeDetail:
break;
case AiContextType.OrganisationDetail:
break;
case AiContextType.SupportConceptDetail:
break;
default:
break;
}
throw new NotImplementedException();
}
private bool oidsContainsOid(long[] oids, long oid)
{
if(oids == null || oids.Length == 0)
return false;
return oids.Contains(oid);
}
} }
} }

View File

@@ -1385,31 +1385,31 @@ namespace BS.Shared
public enum AiContextType public enum AiContextType
{ {
SupportConcept = 0, SupportConceptNavigation = 0,
Customer = 1, CustomerNavigation = 1,
Person = 2, PersonNavigation = 2,
Employee = 3, EmployeeNavigation = 3,
Organisation = 4, OrganisationNavigation = 4,
Team = 5, //Team = 5,
Dokumente = 6, //Dokumente = 6,
User = 7, //User = 7,
UserGroup = 8, //UserGroup = 8,
Report = 9, //Report = 9,
Scheduler = 10, //Scheduler = 10,
Wohnheim = 11, //Wohnheim = 11,
Vertretungen = 12, //Vertretungen = 12,
CustomerTeam = 13, //CustomerTeam = 13,
Scheduling = 14, //Scheduling = 14,
Finance = 15, //Finance = 15,
Administration = 16, //Administration = 16,
//AiConversation = 17, //AiConversation = 17,
//AiConversationPopup = 18, //AiConversationPopup = 18,
ServiceRecord = 19, ServiceRecord = 19,
CustomerSingle = 20, CustomerDetail = 20,
PersonSingle = 21, PersonDetail = 21,
EmployeeSingle = 22, EmployeeDetail = 22,
OrganisationSingle = 23, OrganisationDetail = 23,
SupportConceptSingle = 24, SupportConceptDetail = 24,
} }
public enum AiModelSource public enum AiModelSource

View File

@@ -1145,15 +1145,15 @@ namespace BS.Shared.Core
{ {
var dict = new Dictionary<Enum, string>(); var dict = new Dictionary<Enum, string>();
dict.Add(AiContextType.SupportConcept, "Hilfeplan Navigation"); dict.Add(AiContextType.SupportConceptNavigation, "Hilfeplan Navigation");
dict.Add(AiContextType.Customer, "Klienten Navigation"); dict.Add(AiContextType.CustomerNavigation, "Klienten Navigation");
dict.Add(AiContextType.Person, "Personen Navigation"); dict.Add(AiContextType.PersonNavigation, "Personen Navigation");
dict.Add(AiContextType.Employee, "Mitarbeiter Navigation"); dict.Add(AiContextType.EmployeeNavigation, "Mitarbeiter Navigation");
dict.Add(AiContextType.Organisation, "Organisationen Navigation"); dict.Add(AiContextType.OrganisationNavigation, "Organisationen Navigation");
dict.Add(AiContextType.ServiceRecord, "Zeiterfassung"); dict.Add(AiContextType.ServiceRecord, "Zeiterfassung");
dict.Add(AiContextType.CustomerSingle, "Klienten Ansicht"); dict.Add(AiContextType.CustomerDetail, "Klienten Ansicht");
dict.Add(AiContextType.EmployeeSingle, "Personen Ansicht"); dict.Add(AiContextType.EmployeeDetail, "Personen Ansicht");
dict.Add(AiContextType.PersonSingle, "Mitarbeiter Ansicht"); dict.Add(AiContextType.PersonDetail, "Mitarbeiter Ansicht");
return dict; return dict;
} }

View File

@@ -1,4 +1,5 @@
using BS.Shared.DataContracts.Feature.AI; using BS.Shared.DataContracts.Feature.AI;
using BS.Shared.Interface.Feature.AICore;
using Newtonsoft.Json; using Newtonsoft.Json;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -10,7 +11,7 @@ using System.Threading.Tasks;
namespace BS.Shared.DataContracts namespace BS.Shared.DataContracts
{ {
[DataContract] [DataContract]
public class AiConversationMessageDC : BeWoDataContract public class AiConversationMessageDC : BeWoDataContract, IAiConversationMessage
{ {
[DataMember] public string Message { get; set; } [DataMember] public string Message { get; set; }
[DataMember] public AiConversationMessageRole Role { get; set; } [DataMember] public AiConversationMessageRole Role { get; set; }

View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace BS.Shared.Interface.Feature.AICore
{
public interface IAiConversationMessage
{
string Message { get; }
AiConversationMessageRole Role { get; }
DateTime Created { get; }
string ModelName { get; }
int? Duration { get; }
}
}

View File

@@ -400,6 +400,7 @@
<Compile Include="Extensions\PersonNameableExtensions.cs" /> <Compile Include="Extensions\PersonNameableExtensions.cs" />
<Compile Include="Extensions\TimeIntervalExtensions.cs" /> <Compile Include="Extensions\TimeIntervalExtensions.cs" />
<Compile Include="Interface\Abstract\IAddressable.cs" /> <Compile Include="Interface\Abstract\IAddressable.cs" />
<Compile Include="Interface\Feature\AICore\IAiConversationMessage.cs" />
<Compile Include="Interface\IApiErrorExtractor.cs" /> <Compile Include="Interface\IApiErrorExtractor.cs" />
<Compile Include="Interface\IContact.cs" /> <Compile Include="Interface\IContact.cs" />
<Compile Include="Interface\IGkvAbrechnung.cs" /> <Compile Include="Interface\IGkvAbrechnung.cs" />