From 4acad3adafce9a0d64fbaf375b0408946760c382 Mon Sep 17 00:00:00 2001 From: Rene Evertz Date: Mon, 8 Sep 2025 15:17:51 +0200 Subject: [PATCH] AICore abkapseln --- .../Context/Core/ContextEntryMapperFactory.cs | 2 +- AICore/Context/Core/ContextSummaryFactory.cs | 2 +- AICore/Context/Entry/BaseContextEntry.cs | 2 +- .../Detail/CustomerDetailContextEntry.cs | 2 +- .../Entry/Detail/DetailContextEntry.cs | 2 +- .../Detail/EmployeeDetailContextEntry.cs | 2 +- .../Detail/OrganisationDetailContextEntry.cs | 2 +- .../Entry/Detail/PersonDetailContextEntry.cs | 2 +- .../SupportConceptDetailContextEntry.cs | 2 +- .../CustomerNavigationContextEntry.cs | 2 +- .../EmployeeNavigationContextEntry.cs | 2 +- .../Navigation/NavigationContextEntry.cs | 2 +- .../OrganisationNavigationContextEntry.cs | 2 +- .../PersonNavigationContextEntry.cs | 2 +- .../Navigation/ServiceRecordContextEntry.cs | 2 +- .../SupportConceptNavigationContextEntry.cs | 2 +- .../EntryMapper/BaseContextEntryMapper.cs | 2 +- .../Detail/CustomerContextEntryMapper.cs | 2 +- .../Detail/EmployeeContextEntryMapper.cs | 2 +- .../Detail/OrganisationContextEntryMapper.cs | 2 +- .../Detail/PersonContextEntryMapper.cs | 2 +- .../Detail/ServiceRecordContextEntryMapper.cs | 2 +- .../SupportConceptContextEntryMapper.cs | 2 +- .../CustomerNavigationContextEntryMapper.cs | 2 +- .../EmployeeNavigationContextEntryMapper.cs | 2 +- ...rganisationNavigationContextEntryMapper.cs | 2 +- .../PersonNavigationContextEntryMapper.cs | 2 +- ...portConceptNavigationContextEntryMapper.cs | 2 +- AICore/Context/Summary/BaseContextSummary.cs | 2 +- .../Summary/CustomerDetailContextSummary.cs | 4 +- .../CustomerNavigationContextSummary.cs | 4 +- .../Context/Summary/DetailContextSummary.cs | 4 +- .../Summary/EmployeeDetailContextSummary.cs | 4 +- .../EmployeeNavigationContextSummary.cs | 4 +- .../Summary/NavigationContextSummary.cs | 4 +- .../OrganisationDetailContextSummary.cs | 4 +- .../OrganisationNavigationContextSummary.cs | 4 +- .../Summary/PersonDetailContextSummary.cs | 4 +- .../Summary/PersonNavigationContextSummary.cs | 4 +- .../ServiceRecordNavigationContextSummary.cs | 10 ++-- .../SupportConceptDetailContextSummary.cs | 4 +- .../SupportConceptNavigationContextSummary.cs | 4 +- .../SummaryParser/BaseContextSummaryParser.cs | 2 +- .../SummaryParser/CsvContextSummaryParser.cs | 2 +- .../SummaryParser/JsonContextSummaryParser.cs | 2 +- AICore/Prompt/Core/AiUtils.cs | 5 +- AICore/Prompt/Factories/AiPromptFactory.cs | 24 ++++---- BeWo/Services/BeWoControlFactory.cs | 16 +++--- BeWo/Services/BeWoWindowFactory.cs | 12 ++-- BeWo/View/Detail/CustomerView.xaml.cs | 2 +- .../Navigation/CustomerNavigationView.xaml.cs | 2 +- .../Navigation/EmployeeNavigationView.xaml.cs | 2 +- .../OrganisationNavigationView.xaml.cs | 2 +- .../Navigation/PersonNavigationView.xaml.cs | 2 +- .../SupportConceptNavigationView.xaml.cs | 2 +- Data/Entities/AiConversationMessage.cs | 3 +- Service/Plugins/AiService2.cs | 56 ++++++++++++++++++- Shared/BeWoEntityEnums.cs | 44 +++++++-------- Shared/Core/EnumTranslations.cs | 16 +++--- .../Feature/AI/AiConversationMessageDC.cs | 3 +- .../Feature/AICore/IAiConversationMessage.cs | 18 ++++++ Shared/Shared.csproj | 1 + 62 files changed, 202 insertions(+), 130 deletions(-) create mode 100644 Shared/Interface/Feature/AICore/IAiConversationMessage.cs diff --git a/AICore/Context/Core/ContextEntryMapperFactory.cs b/AICore/Context/Core/ContextEntryMapperFactory.cs index 0f5e25b8b..c2075b7ab 100644 --- a/AICore/Context/Core/ContextEntryMapperFactory.cs +++ b/AICore/Context/Core/ContextEntryMapperFactory.cs @@ -6,7 +6,7 @@ using BS.Shared.DataContracts.Compact; namespace AICore.Context.Core { - public static class ContextEntryMapperFactory + internal static class ContextEntryMapperFactory { public static CustomerContextEntryMapper CustomerMapper { get; } = new CustomerContextEntryMapper(); public static EmployeeContextEntryMapper EmployeeMapper { get; } = new EmployeeContextEntryMapper(); diff --git a/AICore/Context/Core/ContextSummaryFactory.cs b/AICore/Context/Core/ContextSummaryFactory.cs index f1f2cb470..47f287070 100644 --- a/AICore/Context/Core/ContextSummaryFactory.cs +++ b/AICore/Context/Core/ContextSummaryFactory.cs @@ -9,7 +9,7 @@ using System.Collections.Generic; namespace AICore.Context.SummaryMapper { - public static class ContextSummaryFactory + internal static class ContextSummaryFactory { public static DetailContextSummary CreateDetailContext(TEntity entity) where TEntry : DetailContextEntry diff --git a/AICore/Context/Entry/BaseContextEntry.cs b/AICore/Context/Entry/BaseContextEntry.cs index 96df1d2f5..793385279 100644 --- a/AICore/Context/Entry/BaseContextEntry.cs +++ b/AICore/Context/Entry/BaseContextEntry.cs @@ -1,6 +1,6 @@ namespace AICore.Context.Entry { - public abstract class BaseContextEntry + internal abstract class BaseContextEntry { } diff --git a/AICore/Context/Entry/Detail/CustomerDetailContextEntry.cs b/AICore/Context/Entry/Detail/CustomerDetailContextEntry.cs index 3e875012c..c5874551c 100644 --- a/AICore/Context/Entry/Detail/CustomerDetailContextEntry.cs +++ b/AICore/Context/Entry/Detail/CustomerDetailContextEntry.cs @@ -4,7 +4,7 @@ using System.Text.Json.Serialization; namespace AICore.Context.Entry { - public class CustomerDetailContextEntry : DetailContextEntry + internal class CustomerDetailContextEntry : DetailContextEntry { [JsonPropertyName("Klient-ID")] public long CustomerOid { get; set; } diff --git a/AICore/Context/Entry/Detail/DetailContextEntry.cs b/AICore/Context/Entry/Detail/DetailContextEntry.cs index 2b4571801..7a33f1b93 100644 --- a/AICore/Context/Entry/Detail/DetailContextEntry.cs +++ b/AICore/Context/Entry/Detail/DetailContextEntry.cs @@ -1,6 +1,6 @@ namespace AICore.Context.Entry { - public abstract class DetailContextEntry : BaseContextEntry + internal abstract class DetailContextEntry : BaseContextEntry { } diff --git a/AICore/Context/Entry/Detail/EmployeeDetailContextEntry.cs b/AICore/Context/Entry/Detail/EmployeeDetailContextEntry.cs index 96ee657e9..85d7abb10 100644 --- a/AICore/Context/Entry/Detail/EmployeeDetailContextEntry.cs +++ b/AICore/Context/Entry/Detail/EmployeeDetailContextEntry.cs @@ -2,7 +2,7 @@ namespace AICore.Context.Entry { - public class EmployeeDetailContextEntry : DetailContextEntry + internal class EmployeeDetailContextEntry : DetailContextEntry { } diff --git a/AICore/Context/Entry/Detail/OrganisationDetailContextEntry.cs b/AICore/Context/Entry/Detail/OrganisationDetailContextEntry.cs index cbc48c842..3301fc358 100644 --- a/AICore/Context/Entry/Detail/OrganisationDetailContextEntry.cs +++ b/AICore/Context/Entry/Detail/OrganisationDetailContextEntry.cs @@ -2,7 +2,7 @@ namespace AICore.Context.Entry { - public class OrganisationDetailContextEntry : DetailContextEntry + internal class OrganisationDetailContextEntry : DetailContextEntry { } diff --git a/AICore/Context/Entry/Detail/PersonDetailContextEntry.cs b/AICore/Context/Entry/Detail/PersonDetailContextEntry.cs index 3e79a6181..a15334b01 100644 --- a/AICore/Context/Entry/Detail/PersonDetailContextEntry.cs +++ b/AICore/Context/Entry/Detail/PersonDetailContextEntry.cs @@ -2,7 +2,7 @@ namespace AICore.Context.Entry { - public class PersonDetailContextEntry : DetailContextEntry + internal class PersonDetailContextEntry : DetailContextEntry { } diff --git a/AICore/Context/Entry/Detail/SupportConceptDetailContextEntry.cs b/AICore/Context/Entry/Detail/SupportConceptDetailContextEntry.cs index ab9026d97..3a67e918d 100644 --- a/AICore/Context/Entry/Detail/SupportConceptDetailContextEntry.cs +++ b/AICore/Context/Entry/Detail/SupportConceptDetailContextEntry.cs @@ -2,7 +2,7 @@ namespace AICore.Context.Entry { - public class SupportConceptDetailContextEntry : DetailContextEntry + internal class SupportConceptDetailContextEntry : DetailContextEntry { } diff --git a/AICore/Context/Entry/Navigation/CustomerNavigationContextEntry.cs b/AICore/Context/Entry/Navigation/CustomerNavigationContextEntry.cs index 428842b7e..43153cf13 100644 --- a/AICore/Context/Entry/Navigation/CustomerNavigationContextEntry.cs +++ b/AICore/Context/Entry/Navigation/CustomerNavigationContextEntry.cs @@ -5,7 +5,7 @@ using System.Text.Json.Serialization; namespace AICore.Context.Entry.Navigation { - public class CustomerNavigationContextEntry : NavigationContextEntry + internal class CustomerNavigationContextEntry : NavigationContextEntry { [JsonPropertyName("Adresse")] public string AddressString { get; set; } diff --git a/AICore/Context/Entry/Navigation/EmployeeNavigationContextEntry.cs b/AICore/Context/Entry/Navigation/EmployeeNavigationContextEntry.cs index e913e6d27..5c0159422 100644 --- a/AICore/Context/Entry/Navigation/EmployeeNavigationContextEntry.cs +++ b/AICore/Context/Entry/Navigation/EmployeeNavigationContextEntry.cs @@ -3,7 +3,7 @@ using System.Text.Json.Serialization; namespace AICore.Context.Entry.Navigation { - public class EmployeeNavigationContextEntry : NavigationContextEntry + internal class EmployeeNavigationContextEntry : NavigationContextEntry { [JsonPropertyName("Mitarbeiter-ID")] public long EmployeeOid { get; set; } diff --git a/AICore/Context/Entry/Navigation/NavigationContextEntry.cs b/AICore/Context/Entry/Navigation/NavigationContextEntry.cs index 58a8ee815..8c43e2150 100644 --- a/AICore/Context/Entry/Navigation/NavigationContextEntry.cs +++ b/AICore/Context/Entry/Navigation/NavigationContextEntry.cs @@ -1,6 +1,6 @@ namespace AICore.Context.Entry.Navigation { - public abstract class NavigationContextEntry : BaseContextEntry + internal abstract class NavigationContextEntry : BaseContextEntry { } diff --git a/AICore/Context/Entry/Navigation/OrganisationNavigationContextEntry.cs b/AICore/Context/Entry/Navigation/OrganisationNavigationContextEntry.cs index 36714b310..2fb4d2a94 100644 --- a/AICore/Context/Entry/Navigation/OrganisationNavigationContextEntry.cs +++ b/AICore/Context/Entry/Navigation/OrganisationNavigationContextEntry.cs @@ -3,7 +3,7 @@ using System.Text.Json.Serialization; namespace AICore.Context.Entry.Navigation { - public class OrganisationNavigationContextEntry : NavigationContextEntry + internal class OrganisationNavigationContextEntry : NavigationContextEntry { [JsonPropertyName("Organisation-ID")] public long OrganisationOid { get; set; } diff --git a/AICore/Context/Entry/Navigation/PersonNavigationContextEntry.cs b/AICore/Context/Entry/Navigation/PersonNavigationContextEntry.cs index 7ec4eb25f..d678f6220 100644 --- a/AICore/Context/Entry/Navigation/PersonNavigationContextEntry.cs +++ b/AICore/Context/Entry/Navigation/PersonNavigationContextEntry.cs @@ -4,7 +4,7 @@ using System.Text.Json.Serialization; namespace AICore.Context.Entry.Navigation { - public class PersonNavigationContextEntry : NavigationContextEntry + internal class PersonNavigationContextEntry : NavigationContextEntry { [JsonPropertyName("Adresse")] public string AddressString { get; set; } diff --git a/AICore/Context/Entry/Navigation/ServiceRecordContextEntry.cs b/AICore/Context/Entry/Navigation/ServiceRecordContextEntry.cs index 8f890b6c5..f6c233f2e 100644 --- a/AICore/Context/Entry/Navigation/ServiceRecordContextEntry.cs +++ b/AICore/Context/Entry/Navigation/ServiceRecordContextEntry.cs @@ -4,7 +4,7 @@ using System.Text.Json.Serialization; namespace AICore.Context.Entry.Navigation { - public class ServiceRecordContextEntry : NavigationContextEntry + internal class ServiceRecordContextEntry : NavigationContextEntry { [JsonPropertyName("Zeiteintrag-ID")] public long ServiceRecordOid { get; set; } diff --git a/AICore/Context/Entry/Navigation/SupportConceptNavigationContextEntry.cs b/AICore/Context/Entry/Navigation/SupportConceptNavigationContextEntry.cs index 8b0d9fc30..ab51b346a 100644 --- a/AICore/Context/Entry/Navigation/SupportConceptNavigationContextEntry.cs +++ b/AICore/Context/Entry/Navigation/SupportConceptNavigationContextEntry.cs @@ -5,7 +5,7 @@ using System.Text.Json.Serialization; namespace AICore.Context.Entry.Navigation { - public class SupportConceptNavigationContextEntry : NavigationContextEntry + internal class SupportConceptNavigationContextEntry : NavigationContextEntry { [JsonPropertyName("Hilfeplan-ID")] public long SupportConceptOid { get; set; } diff --git a/AICore/Context/EntryMapper/BaseContextEntryMapper.cs b/AICore/Context/EntryMapper/BaseContextEntryMapper.cs index 77141b2fe..33bb6c59c 100644 --- a/AICore/Context/EntryMapper/BaseContextEntryMapper.cs +++ b/AICore/Context/EntryMapper/BaseContextEntryMapper.cs @@ -4,7 +4,7 @@ using System.Linq; namespace AICore.Context.EntryMapper { - public abstract class BaseContextEntryMapper + internal abstract class BaseContextEntryMapper where TObject : class, new() where TContext : BaseContextEntry, new() { public virtual TContext MapToNewContext(TObject pObject) diff --git a/AICore/Context/EntryMapper/Detail/CustomerContextEntryMapper.cs b/AICore/Context/EntryMapper/Detail/CustomerContextEntryMapper.cs index 32a324462..8c04ecd11 100644 --- a/AICore/Context/EntryMapper/Detail/CustomerContextEntryMapper.cs +++ b/AICore/Context/EntryMapper/Detail/CustomerContextEntryMapper.cs @@ -4,7 +4,7 @@ using BS.Shared.Extensions; namespace AICore.Context.EntryMapper.Detail { - public class CustomerContextEntryMapper : BaseContextEntryMapper + internal class CustomerContextEntryMapper : BaseContextEntryMapper { public override void MergeWithObject(CustomerDC pObject, CustomerDetailContextEntry pContext) { diff --git a/AICore/Context/EntryMapper/Detail/EmployeeContextEntryMapper.cs b/AICore/Context/EntryMapper/Detail/EmployeeContextEntryMapper.cs index 1479a16ab..f423bb244 100644 --- a/AICore/Context/EntryMapper/Detail/EmployeeContextEntryMapper.cs +++ b/AICore/Context/EntryMapper/Detail/EmployeeContextEntryMapper.cs @@ -5,7 +5,7 @@ using BS.Shared.DataContracts; namespace AICore.Context.EntryMapper.Detail { - public class EmployeeContextEntryMapper : BaseContextEntryMapper + internal class EmployeeContextEntryMapper : BaseContextEntryMapper { public override void MergeWithObject(EmployeeDC pObject, EmployeeDetailContextEntry pContext) { diff --git a/AICore/Context/EntryMapper/Detail/OrganisationContextEntryMapper.cs b/AICore/Context/EntryMapper/Detail/OrganisationContextEntryMapper.cs index d25a95a0e..2eb54e19a 100644 --- a/AICore/Context/EntryMapper/Detail/OrganisationContextEntryMapper.cs +++ b/AICore/Context/EntryMapper/Detail/OrganisationContextEntryMapper.cs @@ -5,7 +5,7 @@ using BS.Shared.DataContracts; namespace AICore.Context.EntryMapper.Detail { - public class OrganisationContextEntryMapper : BaseContextEntryMapper + internal class OrganisationContextEntryMapper : BaseContextEntryMapper { public override void MergeWithObject(OrganisationDC pObject, OrganisationDetailContextEntry pContext) { diff --git a/AICore/Context/EntryMapper/Detail/PersonContextEntryMapper.cs b/AICore/Context/EntryMapper/Detail/PersonContextEntryMapper.cs index a447fa2db..0f8e2a95c 100644 --- a/AICore/Context/EntryMapper/Detail/PersonContextEntryMapper.cs +++ b/AICore/Context/EntryMapper/Detail/PersonContextEntryMapper.cs @@ -5,7 +5,7 @@ using BS.Shared.DataContracts; namespace AICore.Context.EntryMapper.Detail { - public class PersonContextEntryMapper : BaseContextEntryMapper + internal class PersonContextEntryMapper : BaseContextEntryMapper { public override void MergeWithObject(PersonDC pObject, PersonDetailContextEntry pContext) { diff --git a/AICore/Context/EntryMapper/Detail/ServiceRecordContextEntryMapper.cs b/AICore/Context/EntryMapper/Detail/ServiceRecordContextEntryMapper.cs index fbd3b0219..4945ab5b0 100644 --- a/AICore/Context/EntryMapper/Detail/ServiceRecordContextEntryMapper.cs +++ b/AICore/Context/EntryMapper/Detail/ServiceRecordContextEntryMapper.cs @@ -5,7 +5,7 @@ using BS.Shared.DataContracts; namespace AICore.Context.EntryMapper.Detail { - public class ServiceRecordContextEntryMapper : BaseContextEntryMapper + internal class ServiceRecordContextEntryMapper : BaseContextEntryMapper { public override void MergeWithObject(ServiceRecordDC pObject, ServiceRecordContextEntry pContext) { diff --git a/AICore/Context/EntryMapper/Detail/SupportConceptContextEntryMapper.cs b/AICore/Context/EntryMapper/Detail/SupportConceptContextEntryMapper.cs index 44d22dda2..4c1c2353e 100644 --- a/AICore/Context/EntryMapper/Detail/SupportConceptContextEntryMapper.cs +++ b/AICore/Context/EntryMapper/Detail/SupportConceptContextEntryMapper.cs @@ -5,7 +5,7 @@ using BS.Shared.DataContracts; namespace AICore.Context.EntryMapper.Detail { - public class SupportConceptContextEntryMapper : BaseContextEntryMapper + internal class SupportConceptContextEntryMapper : BaseContextEntryMapper { public override void MergeWithObject(SupportConceptDC pObject, SupportConceptDetailContextEntry pContext) { diff --git a/AICore/Context/EntryMapper/Navigation/CustomerNavigationContextEntryMapper.cs b/AICore/Context/EntryMapper/Navigation/CustomerNavigationContextEntryMapper.cs index aca731d19..93927bd3f 100644 --- a/AICore/Context/EntryMapper/Navigation/CustomerNavigationContextEntryMapper.cs +++ b/AICore/Context/EntryMapper/Navigation/CustomerNavigationContextEntryMapper.cs @@ -6,7 +6,7 @@ using BS.Shared.Extensions; namespace AICore.Context.EntryMapper.Navigation { - public class CustomerNavigationContextEntryMapper : BaseContextEntryMapper + internal class CustomerNavigationContextEntryMapper : BaseContextEntryMapper { public override void MergeWithObject(CompactCustomerDC pObject, CustomerNavigationContextEntry pContext) { diff --git a/AICore/Context/EntryMapper/Navigation/EmployeeNavigationContextEntryMapper.cs b/AICore/Context/EntryMapper/Navigation/EmployeeNavigationContextEntryMapper.cs index 33fb6acc8..6b8dc80db 100644 --- a/AICore/Context/EntryMapper/Navigation/EmployeeNavigationContextEntryMapper.cs +++ b/AICore/Context/EntryMapper/Navigation/EmployeeNavigationContextEntryMapper.cs @@ -9,7 +9,7 @@ using BS.Shared.Extensions; namespace AICore.Context.EntryMapper.Navigation { - public class EmployeeNavigationContextEntryMapper : BaseContextEntryMapper + internal class EmployeeNavigationContextEntryMapper : BaseContextEntryMapper { public override void MergeWithObject(CompactEmployeeDC pObject, EmployeeNavigationContextEntry pContext) { diff --git a/AICore/Context/EntryMapper/Navigation/OrganisationNavigationContextEntryMapper.cs b/AICore/Context/EntryMapper/Navigation/OrganisationNavigationContextEntryMapper.cs index d131a67d9..9e3d87982 100644 --- a/AICore/Context/EntryMapper/Navigation/OrganisationNavigationContextEntryMapper.cs +++ b/AICore/Context/EntryMapper/Navigation/OrganisationNavigationContextEntryMapper.cs @@ -6,7 +6,7 @@ using BS.Shared.Extensions; namespace AICore.Context.EntryMapper.Navigation { - public class OrganisationNavigationContextEntryMapper : BaseContextEntryMapper + internal class OrganisationNavigationContextEntryMapper : BaseContextEntryMapper { public override void MergeWithObject(CompactOrganisationDC pObject, OrganisationNavigationContextEntry pContext) { diff --git a/AICore/Context/EntryMapper/Navigation/PersonNavigationContextEntryMapper.cs b/AICore/Context/EntryMapper/Navigation/PersonNavigationContextEntryMapper.cs index acb671c2c..05cea4c38 100644 --- a/AICore/Context/EntryMapper/Navigation/PersonNavigationContextEntryMapper.cs +++ b/AICore/Context/EntryMapper/Navigation/PersonNavigationContextEntryMapper.cs @@ -8,7 +8,7 @@ using BS.Shared.DataContracts.Compact; namespace AICore.Context.EntryMapper.Navigation { - public class PersonNavigationContextEntryMapper : BaseContextEntryMapper + internal class PersonNavigationContextEntryMapper : BaseContextEntryMapper { public override void MergeWithObject(CompactPersonDC pObject, PersonNavigationContextEntry pContext) { diff --git a/AICore/Context/EntryMapper/Navigation/SupportConceptNavigationContextEntryMapper.cs b/AICore/Context/EntryMapper/Navigation/SupportConceptNavigationContextEntryMapper.cs index ce5128ee8..928cc0072 100644 --- a/AICore/Context/EntryMapper/Navigation/SupportConceptNavigationContextEntryMapper.cs +++ b/AICore/Context/EntryMapper/Navigation/SupportConceptNavigationContextEntryMapper.cs @@ -9,7 +9,7 @@ using BS.Shared.Extensions; namespace AICore.Context.EntryMapper.Navigation { - public class SupportConceptNavigationContextEntryMapper : BaseContextEntryMapper + internal class SupportConceptNavigationContextEntryMapper : BaseContextEntryMapper { public override void MergeWithObject(CompactSupportConceptDC pObject, SupportConceptNavigationContextEntry pContext) { diff --git a/AICore/Context/Summary/BaseContextSummary.cs b/AICore/Context/Summary/BaseContextSummary.cs index c90ee50dc..d217f38e3 100644 --- a/AICore/Context/Summary/BaseContextSummary.cs +++ b/AICore/Context/Summary/BaseContextSummary.cs @@ -1,6 +1,6 @@ namespace AICore.Context.Summary { - public abstract class BaseContextSummary + internal abstract class BaseContextSummary { public object Context { get; set; } } diff --git a/AICore/Context/Summary/CustomerDetailContextSummary.cs b/AICore/Context/Summary/CustomerDetailContextSummary.cs index 1f9257c94..fe0c70d98 100644 --- a/AICore/Context/Summary/CustomerDetailContextSummary.cs +++ b/AICore/Context/Summary/CustomerDetailContextSummary.cs @@ -3,8 +3,8 @@ using BS.Shared.DataContracts; namespace AICore.Context.Summary { - public class CustomerDetailContextSummary : DetailContextSummary + internal class CustomerDetailContextSummary : DetailContextSummary { - public CustomerDetailContextSummary(CustomerDetailContextEntry customer) : base(customer) { } + internal CustomerDetailContextSummary(CustomerDetailContextEntry customer) : base(customer) { } } } diff --git a/AICore/Context/Summary/CustomerNavigationContextSummary.cs b/AICore/Context/Summary/CustomerNavigationContextSummary.cs index 17bf0268a..8c1a13bfd 100644 --- a/AICore/Context/Summary/CustomerNavigationContextSummary.cs +++ b/AICore/Context/Summary/CustomerNavigationContextSummary.cs @@ -4,8 +4,8 @@ using BS.Shared.DataContracts.Compact; namespace AICore.Context.Summary { - public class CustomerNavigationContextSummary : NavigationContextSummary + internal class CustomerNavigationContextSummary : NavigationContextSummary { - public CustomerNavigationContextSummary(IEnumerable customers) : base(customers) { } + internal CustomerNavigationContextSummary(IEnumerable customers) : base(customers) { } } } diff --git a/AICore/Context/Summary/DetailContextSummary.cs b/AICore/Context/Summary/DetailContextSummary.cs index 743dc71d1..4a5884bab 100644 --- a/AICore/Context/Summary/DetailContextSummary.cs +++ b/AICore/Context/Summary/DetailContextSummary.cs @@ -2,9 +2,9 @@ namespace AICore.Context.Summary { - public abstract class DetailContextSummary : BaseContextSummary where TEntry : DetailContextEntry + internal abstract class DetailContextSummary : BaseContextSummary where TEntry : DetailContextEntry { - public TEntry DataContext { get; set; } + internal TEntry DataContext { get; set; } protected DetailContextSummary(TEntry dataContext) { diff --git a/AICore/Context/Summary/EmployeeDetailContextSummary.cs b/AICore/Context/Summary/EmployeeDetailContextSummary.cs index 5970148a8..1642807f7 100644 --- a/AICore/Context/Summary/EmployeeDetailContextSummary.cs +++ b/AICore/Context/Summary/EmployeeDetailContextSummary.cs @@ -3,8 +3,8 @@ using BS.Shared.DataContracts; namespace AICore.Context.Summary { - public class EmployeeDetailContextSummary : DetailContextSummary + internal class EmployeeDetailContextSummary : DetailContextSummary { - public EmployeeDetailContextSummary(EmployeeDetailContextEntry employee) : base(employee) { } + internal EmployeeDetailContextSummary(EmployeeDetailContextEntry employee) : base(employee) { } } } diff --git a/AICore/Context/Summary/EmployeeNavigationContextSummary.cs b/AICore/Context/Summary/EmployeeNavigationContextSummary.cs index 252629d36..fe29a9655 100644 --- a/AICore/Context/Summary/EmployeeNavigationContextSummary.cs +++ b/AICore/Context/Summary/EmployeeNavigationContextSummary.cs @@ -4,8 +4,8 @@ using BS.Shared.DataContracts.Compact; namespace AICore.Context.Summary { - public class EmployeeNavigationContextSummary : NavigationContextSummary + internal class EmployeeNavigationContextSummary : NavigationContextSummary { - public EmployeeNavigationContextSummary(IEnumerable employee) : base(employee) { } + internal EmployeeNavigationContextSummary(IEnumerable employee) : base(employee) { } } } diff --git a/AICore/Context/Summary/NavigationContextSummary.cs b/AICore/Context/Summary/NavigationContextSummary.cs index e7b7a3606..e06ae2d3c 100644 --- a/AICore/Context/Summary/NavigationContextSummary.cs +++ b/AICore/Context/Summary/NavigationContextSummary.cs @@ -3,9 +3,9 @@ using AICore.Context.Entry.Navigation; namespace AICore.Context.Summary { - public abstract class NavigationContextSummary : BaseContextSummary where TEntry : NavigationContextEntry + internal abstract class NavigationContextSummary : BaseContextSummary where TEntry : NavigationContextEntry { - public IEnumerable DataContext { get; set; } + internal IEnumerable DataContext { get; set; } protected NavigationContextSummary(IEnumerable dataContext) { diff --git a/AICore/Context/Summary/OrganisationDetailContextSummary.cs b/AICore/Context/Summary/OrganisationDetailContextSummary.cs index cc42560ef..f58fe3009 100644 --- a/AICore/Context/Summary/OrganisationDetailContextSummary.cs +++ b/AICore/Context/Summary/OrganisationDetailContextSummary.cs @@ -3,8 +3,8 @@ using BS.Shared.DataContracts; namespace AICore.Context.Summary { - public class OrganisationDetailContextSummary : DetailContextSummary + internal class OrganisationDetailContextSummary : DetailContextSummary { - public OrganisationDetailContextSummary(OrganisationDetailContextEntry organisation) : base(organisation) { } + internal OrganisationDetailContextSummary(OrganisationDetailContextEntry organisation) : base(organisation) { } } } diff --git a/AICore/Context/Summary/OrganisationNavigationContextSummary.cs b/AICore/Context/Summary/OrganisationNavigationContextSummary.cs index 4e9566853..f990f804e 100644 --- a/AICore/Context/Summary/OrganisationNavigationContextSummary.cs +++ b/AICore/Context/Summary/OrganisationNavigationContextSummary.cs @@ -4,8 +4,8 @@ using BS.Shared.DataContracts.Compact; namespace AICore.Context.Summary { - public class OrganisationNavigationContextSummary : NavigationContextSummary + internal class OrganisationNavigationContextSummary : NavigationContextSummary { - public OrganisationNavigationContextSummary(IEnumerable organisation) : base(organisation) { } + internal OrganisationNavigationContextSummary(IEnumerable organisation) : base(organisation) { } } } diff --git a/AICore/Context/Summary/PersonDetailContextSummary.cs b/AICore/Context/Summary/PersonDetailContextSummary.cs index 321670a0f..87c06400d 100644 --- a/AICore/Context/Summary/PersonDetailContextSummary.cs +++ b/AICore/Context/Summary/PersonDetailContextSummary.cs @@ -3,8 +3,8 @@ using BS.Shared.DataContracts; namespace AICore.Context.Summary { - public class PersonDetailContextSummary : DetailContextSummary + internal class PersonDetailContextSummary : DetailContextSummary { - public PersonDetailContextSummary(PersonDetailContextEntry person) : base(person) { } + internal PersonDetailContextSummary(PersonDetailContextEntry person) : base(person) { } } } diff --git a/AICore/Context/Summary/PersonNavigationContextSummary.cs b/AICore/Context/Summary/PersonNavigationContextSummary.cs index 9f73e5930..654604d5d 100644 --- a/AICore/Context/Summary/PersonNavigationContextSummary.cs +++ b/AICore/Context/Summary/PersonNavigationContextSummary.cs @@ -4,8 +4,8 @@ using BS.Shared.DataContracts.Compact; namespace AICore.Context.Summary { - public class PersonNavigationContextSummary : NavigationContextSummary + internal class PersonNavigationContextSummary : NavigationContextSummary { - public PersonNavigationContextSummary(IEnumerable person) : base(person) { } + internal PersonNavigationContextSummary(IEnumerable person) : base(person) { } } } diff --git a/AICore/Context/Summary/ServiceRecordNavigationContextSummary.cs b/AICore/Context/Summary/ServiceRecordNavigationContextSummary.cs index c39edab02..22404f841 100644 --- a/AICore/Context/Summary/ServiceRecordNavigationContextSummary.cs +++ b/AICore/Context/Summary/ServiceRecordNavigationContextSummary.cs @@ -4,13 +4,13 @@ using System.Collections.Generic; namespace AICore.Context.Summary { - public class ServiceRecordNavigationContextSummary : NavigationContextSummary + internal class ServiceRecordNavigationContextSummary : NavigationContextSummary { - public CustomerNavigationContextEntry Customer { get; set; } - public string CostBearer { get; set; } - public string SupportConcept { get; set; } + internal CustomerNavigationContextEntry Customer { get; set; } + internal string CostBearer { get; set; } + internal string SupportConcept { get; set; } - public ServiceRecordNavigationContextSummary(IEnumerable serviceRecords, CustomerNavigationContextEntry customer, string costBearer, string supportConcept) + internal ServiceRecordNavigationContextSummary(IEnumerable serviceRecords, CustomerNavigationContextEntry customer, string costBearer, string supportConcept) : base(serviceRecords) { Customer = customer; diff --git a/AICore/Context/Summary/SupportConceptDetailContextSummary.cs b/AICore/Context/Summary/SupportConceptDetailContextSummary.cs index 03075000a..607d45e09 100644 --- a/AICore/Context/Summary/SupportConceptDetailContextSummary.cs +++ b/AICore/Context/Summary/SupportConceptDetailContextSummary.cs @@ -3,8 +3,8 @@ using BS.Shared.DataContracts; namespace AICore.Context.Summary { - public class SupportConceptDetailContextSummary : DetailContextSummary + internal class SupportConceptDetailContextSummary : DetailContextSummary { - public SupportConceptDetailContextSummary(SupportConceptDetailContextEntry supportConcept) : base(supportConcept) { } + internal SupportConceptDetailContextSummary(SupportConceptDetailContextEntry supportConcept) : base(supportConcept) { } } } diff --git a/AICore/Context/Summary/SupportConceptNavigationContextSummary.cs b/AICore/Context/Summary/SupportConceptNavigationContextSummary.cs index c7c527fe1..534439184 100644 --- a/AICore/Context/Summary/SupportConceptNavigationContextSummary.cs +++ b/AICore/Context/Summary/SupportConceptNavigationContextSummary.cs @@ -4,8 +4,8 @@ using BS.Shared.DataContracts.Compact; namespace AICore.Context.Summary { - public class SupportConceptNavigationContextSummary : NavigationContextSummary + internal class SupportConceptNavigationContextSummary : NavigationContextSummary { - public SupportConceptNavigationContextSummary(IEnumerable supportConcept) : base(supportConcept) { } + internal SupportConceptNavigationContextSummary(IEnumerable supportConcept) : base(supportConcept) { } } } diff --git a/AICore/Context/SummaryParser/BaseContextSummaryParser.cs b/AICore/Context/SummaryParser/BaseContextSummaryParser.cs index 13e2f6b8c..c9439a98b 100644 --- a/AICore/Context/SummaryParser/BaseContextSummaryParser.cs +++ b/AICore/Context/SummaryParser/BaseContextSummaryParser.cs @@ -9,7 +9,7 @@ using System.Threading.Tasks; namespace AICore.Context.SummaryParser { - public abstract class BaseContextSummaryParser + internal abstract class BaseContextSummaryParser { public abstract string Parse(AiContextType uicontext, BaseContextSummary context); } diff --git a/AICore/Context/SummaryParser/CsvContextSummaryParser.cs b/AICore/Context/SummaryParser/CsvContextSummaryParser.cs index 9a7a900e3..2acd48667 100644 --- a/AICore/Context/SummaryParser/CsvContextSummaryParser.cs +++ b/AICore/Context/SummaryParser/CsvContextSummaryParser.cs @@ -12,7 +12,7 @@ using System.Threading.Tasks; namespace AICore.Context.SummaryParser { - public class CsvContextSummaryParser : BaseContextSummaryParser + internal class CsvContextSummaryParser : BaseContextSummaryParser { private string _Delimiter; private bool _StrictEscapeCsvField; diff --git a/AICore/Context/SummaryParser/JsonContextSummaryParser.cs b/AICore/Context/SummaryParser/JsonContextSummaryParser.cs index 0743720dd..9d585b340 100644 --- a/AICore/Context/SummaryParser/JsonContextSummaryParser.cs +++ b/AICore/Context/SummaryParser/JsonContextSummaryParser.cs @@ -9,7 +9,7 @@ using System.Threading.Tasks; namespace AICore.Context.SummaryParser { - public class JsonContextSummaryParser : BaseContextSummaryParser + internal class JsonContextSummaryParser : BaseContextSummaryParser { public override string Parse(AiContextType uicontext, BaseContextSummary context) { diff --git a/AICore/Prompt/Core/AiUtils.cs b/AICore/Prompt/Core/AiUtils.cs index 98e469601..785443b36 100644 --- a/AICore/Prompt/Core/AiUtils.cs +++ b/AICore/Prompt/Core/AiUtils.cs @@ -1,12 +1,13 @@ using BS.Shared.DataContracts; using BS.Shared.Exceptions; +using BS.Shared.Interface.Feature.AICore; using System.Collections.Generic; namespace AICore.Prompt.Core { public static class AiUtils { - public static void CheckTokenSize(IList messages, string modelName, int max_context_size) + public static void CheckTokenSize(IEnumerable messages, string modelName, int max_context_size) { var buffer = 500; @@ -28,7 +29,7 @@ namespace AICore.Prompt.Core } } - private static int CalculateTokensByModel(IList messages, string modelName) + private static int CalculateTokensByModel(IEnumerable messages, string modelName) { var count = 0; diff --git a/AICore/Prompt/Factories/AiPromptFactory.cs b/AICore/Prompt/Factories/AiPromptFactory.cs index 9cd617b1c..9b7bfc46a 100644 --- a/AICore/Prompt/Factories/AiPromptFactory.cs +++ b/AICore/Prompt/Factories/AiPromptFactory.cs @@ -45,7 +45,7 @@ namespace AICore.Prompt.Factories { sb.AppendLine("Du erhälst folgende Daten:"); var parser = GetParser(aiDataContextType); - var parsed = LoadContext(uicontext, bewoobjects, parser); + var parsed = CreateContext(uicontext, bewoobjects, parser); sb.AppendLine(parsed); } @@ -73,7 +73,7 @@ namespace AICore.Prompt.Factories throw BeWoNotImplementedException.CreateFromEnum(aiDataContextType); } - private string LoadContext(AiContextType uicontext, IEnumerable bewoobjects, BaseContextSummaryParser parser) + private string CreateContext(AiContextType uicontext, IEnumerable bewoobjects, BaseContextSummaryParser parser) { var context = GetContext(uicontext, bewoobjects); @@ -81,28 +81,28 @@ namespace AICore.Prompt.Factories return parsed; } - - protected BaseContextSummary GetContext(AiContextType uicontext, IEnumerable bewoobjects) + + private BaseContextSummary GetContext(AiContextType uicontext, IEnumerable bewoobjects) { switch (uicontext) { - case AiContextType.SupportConcept: + case AiContextType.SupportConceptNavigation: return GetNavigationContext(bewoobjects); - case AiContextType.Customer: + case AiContextType.CustomerNavigation: return GetNavigationContext(bewoobjects); - case AiContextType.Person: + case AiContextType.PersonNavigation: return GetNavigationContext(bewoobjects); - case AiContextType.Employee: + case AiContextType.EmployeeNavigation: return GetNavigationContext(bewoobjects); - case AiContextType.Organisation: + case AiContextType.OrganisationNavigation: return GetNavigationContext(bewoobjects); case AiContextType.ServiceRecord: return GetServiceRecordsContext(bewoobjects); - case AiContextType.CustomerSingle: + case AiContextType.CustomerDetail: return GetDetailContext(bewoobjects); - case AiContextType.PersonSingle: + case AiContextType.PersonDetail: return GetDetailContext(bewoobjects); - case AiContextType.EmployeeSingle: + case AiContextType.EmployeeDetail: return GetDetailContext(bewoobjects); default: throw BeWoNotImplementedException.CreateFromEnum(uicontext); diff --git a/BeWo/Services/BeWoControlFactory.cs b/BeWo/Services/BeWoControlFactory.cs index 41440d551..53d1b4303 100644 --- a/BeWo/Services/BeWoControlFactory.cs +++ b/BeWo/Services/BeWoControlFactory.cs @@ -26,11 +26,11 @@ namespace BeWo.Services private string getStyleString(AiContextType uIContext) { switch (uIContext) { - case AiContextType.SupportConcept: return "ModuleAiControlSupportConceptStyle"; - case AiContextType.Customer: return "ModuleAiControlCustomerStyle"; - case AiContextType.Person: return "ModuleAiControlPersonStyle"; - case AiContextType.Employee: return "ModuleAiControlEmployeeStyle"; - case AiContextType.Organisation: return "ModuleAiControlOrganisationStyle"; + case AiContextType.SupportConceptNavigation: return "ModuleAiControlSupportConceptStyle"; + case AiContextType.CustomerNavigation: return "ModuleAiControlCustomerStyle"; + case AiContextType.PersonNavigation: return "ModuleAiControlPersonStyle"; + case AiContextType.EmployeeNavigation: return "ModuleAiControlEmployeeStyle"; + case AiContextType.OrganisationNavigation: return "ModuleAiControlOrganisationStyle"; case AiContextType.Team: break; case AiContextType.Dokumente: @@ -56,9 +56,9 @@ namespace BeWo.Services case AiContextType.Administration: break; case AiContextType.ServiceRecord: return "ModuleAiControlZeiterfassungStyle"; - case AiContextType.CustomerSingle: return "ModuleAiControlCustomerStyle"; - case AiContextType.PersonSingle: return "ModuleAiControlPersonStyle"; - case AiContextType.EmployeeSingle: return "ModuleAiControlEmployeeStyle"; + case AiContextType.CustomerDetail: return "ModuleAiControlCustomerStyle"; + case AiContextType.PersonDetail: return "ModuleAiControlPersonStyle"; + case AiContextType.EmployeeDetail: return "ModuleAiControlEmployeeStyle"; } return null; diff --git a/BeWo/Services/BeWoWindowFactory.cs b/BeWo/Services/BeWoWindowFactory.cs index a6fa7dbc8..8549246d1 100644 --- a/BeWo/Services/BeWoWindowFactory.cs +++ b/BeWo/Services/BeWoWindowFactory.cs @@ -18,12 +18,12 @@ namespace BeWo.Services public Dictionary UIContext2Header { get; set; } = new Dictionary() { {AiContextType.ServiceRecord, "KI Chat: Zeiterfassung" }, - {AiContextType.Customer, "KI Chat: Klienten Übersicht" }, - {AiContextType.Person, "KI Chat: Personen Übersicht" }, - {AiContextType.Employee, "KI Chat: Mitarbeiter Übersicht" }, - {AiContextType.Organisation, "KI Chat: Organisation Übersicht" }, - {AiContextType.SupportConcept, "KI Chat: Hilfeplan Übersicht" }, - {AiContextType.CustomerSingle, "KI Chat: Klient" }, + {AiContextType.CustomerNavigation, "KI Chat: Klienten Übersicht" }, + {AiContextType.PersonNavigation, "KI Chat: Personen Übersicht" }, + {AiContextType.EmployeeNavigation, "KI Chat: Mitarbeiter Übersicht" }, + {AiContextType.OrganisationNavigation, "KI Chat: Organisation Übersicht" }, + {AiContextType.SupportConceptNavigation, "KI Chat: Hilfeplan Übersicht" }, + {AiContextType.CustomerDetail, "KI Chat: Klient" }, }; public AnimatedBeWoWindow GetAiConversationWindow(AiConversationChatViewModel viewModel, Control control, double height = 600, double width = 1200) diff --git a/BeWo/View/Detail/CustomerView.xaml.cs b/BeWo/View/Detail/CustomerView.xaml.cs index 7ccba17be..2941a5749 100644 --- a/BeWo/View/Detail/CustomerView.xaml.cs +++ b/BeWo/View/Detail/CustomerView.xaml.cs @@ -320,7 +320,7 @@ namespace BeWo.View.Detail var customer_oid = ViewModel.DataContract.CustomerOid; var context = GetVisibleInformationReferences(); - var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.CustomerSingle, context, customer_oid); + var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.CustomerDetail, context, customer_oid); return vm; } diff --git a/BeWo/View/Navigation/CustomerNavigationView.xaml.cs b/BeWo/View/Navigation/CustomerNavigationView.xaml.cs index b1bf10360..4f72f947b 100644 --- a/BeWo/View/Navigation/CustomerNavigationView.xaml.cs +++ b/BeWo/View/Navigation/CustomerNavigationView.xaml.cs @@ -207,7 +207,7 @@ namespace BeWo.View.Navigation { var context = GetVisibleInformationReferences(); - var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.Customer, context); + var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.CustomerNavigation, context); return vm; } diff --git a/BeWo/View/Navigation/EmployeeNavigationView.xaml.cs b/BeWo/View/Navigation/EmployeeNavigationView.xaml.cs index 44659143e..920609d6d 100644 --- a/BeWo/View/Navigation/EmployeeNavigationView.xaml.cs +++ b/BeWo/View/Navigation/EmployeeNavigationView.xaml.cs @@ -113,7 +113,7 @@ namespace BeWo.View.Navigation { var context = GetVisibleInformationReferences(); - var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.Employee, context); + var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.EmployeeNavigation, context); return vm; } diff --git a/BeWo/View/Navigation/OrganisationNavigationView.xaml.cs b/BeWo/View/Navigation/OrganisationNavigationView.xaml.cs index 29d0c6055..c585f6870 100644 --- a/BeWo/View/Navigation/OrganisationNavigationView.xaml.cs +++ b/BeWo/View/Navigation/OrganisationNavigationView.xaml.cs @@ -79,7 +79,7 @@ namespace BeWo.View.Navigation { var context = GetVisibleInformationReferences(); - var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.Organisation, context); + var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.OrganisationNavigation, context); return vm; } diff --git a/BeWo/View/Navigation/PersonNavigationView.xaml.cs b/BeWo/View/Navigation/PersonNavigationView.xaml.cs index 5749ebd49..1aa32771f 100644 --- a/BeWo/View/Navigation/PersonNavigationView.xaml.cs +++ b/BeWo/View/Navigation/PersonNavigationView.xaml.cs @@ -117,7 +117,7 @@ namespace BeWo.View.Navigation { var context = GetVisibleInformationReferences(); - var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.Person, context); + var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.PersonNavigation, context); return vm; } diff --git a/BeWo/View/Navigation/SupportConceptNavigationView.xaml.cs b/BeWo/View/Navigation/SupportConceptNavigationView.xaml.cs index f3e3e14f9..3baf66f87 100644 --- a/BeWo/View/Navigation/SupportConceptNavigationView.xaml.cs +++ b/BeWo/View/Navigation/SupportConceptNavigationView.xaml.cs @@ -230,7 +230,7 @@ namespace BeWo.View.Navigation { var context = GetVisibleInformationReferences(); - var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.SupportConcept, context); + var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.SupportConceptNavigation, context); return vm; } diff --git a/Data/Entities/AiConversationMessage.cs b/Data/Entities/AiConversationMessage.cs index ea8c28e27..6779c7d19 100644 --- a/Data/Entities/AiConversationMessage.cs +++ b/Data/Entities/AiConversationMessage.cs @@ -3,10 +3,11 @@ using System.Collections.Generic; using BS.Shared; using BS.Shared.Core; +using BS.Shared.Interface.Feature.AICore; namespace BeWo.Data.Entities { - public class AiConversationMessage : BeWoEntityBase + public class AiConversationMessage : BeWoEntityBase, IAiConversationMessage { public AiConversationMessage() { diff --git a/Service/Plugins/AiService2.cs b/Service/Plugins/AiService2.cs index 52b785a40..01a9d8e40 100644 --- a/Service/Plugins/AiService2.cs +++ b/Service/Plugins/AiService2.cs @@ -15,6 +15,7 @@ using BeWo.Service.Core; using BeWo.Service.DCEntityMapper; using BeWo.Service.Invoicing; using BeWo.Service.ServiceContracts; +using BeWo.Service.ServiceImplementations; using BeWo.Service.ServiceProxy; using BS.Shared; using BS.Shared.Core; @@ -265,16 +266,19 @@ namespace BeWo.Service.Plugins return models; } - protected virtual AiConversation createAiConversation(AiContextType uicontext, Dictionary context, long modell_oid, AiDataContextType context_Type) + protected virtual AiConversation createAiConversation(AiContextType uicontext, Dictionary context_reference, long modell_oid, AiDataContextType context_Type) { var current_user = UserRightHelper.GetLoggedInUserWithOid(); 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(); 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.Messages = new List(); conv.Modell = DAOFactory.GenericDAO.LoadByID(modell_oid); @@ -373,5 +377,51 @@ namespace BeWo.Service.Plugins return new AiConversationMessageDC[] { user_msg_dc, assi_msg_dc }; } + + protected virtual IEnumerable loadContext(AiContextType uicontext, Dictionary 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); + } } } \ No newline at end of file diff --git a/Shared/BeWoEntityEnums.cs b/Shared/BeWoEntityEnums.cs index 275364785..1fb4ab3e1 100644 --- a/Shared/BeWoEntityEnums.cs +++ b/Shared/BeWoEntityEnums.cs @@ -1385,31 +1385,31 @@ namespace BS.Shared public enum AiContextType { - SupportConcept = 0, - Customer = 1, - Person = 2, - Employee = 3, - Organisation = 4, - Team = 5, - Dokumente = 6, - User = 7, - UserGroup = 8, - Report = 9, - Scheduler = 10, - Wohnheim = 11, - Vertretungen = 12, - CustomerTeam = 13, - Scheduling = 14, - Finance = 15, - Administration = 16, + SupportConceptNavigation = 0, + CustomerNavigation = 1, + PersonNavigation = 2, + EmployeeNavigation = 3, + OrganisationNavigation = 4, + //Team = 5, + //Dokumente = 6, + //User = 7, + //UserGroup = 8, + //Report = 9, + //Scheduler = 10, + //Wohnheim = 11, + //Vertretungen = 12, + //CustomerTeam = 13, + //Scheduling = 14, + //Finance = 15, + //Administration = 16, //AiConversation = 17, //AiConversationPopup = 18, ServiceRecord = 19, - CustomerSingle = 20, - PersonSingle = 21, - EmployeeSingle = 22, - OrganisationSingle = 23, - SupportConceptSingle = 24, + CustomerDetail = 20, + PersonDetail = 21, + EmployeeDetail = 22, + OrganisationDetail = 23, + SupportConceptDetail = 24, } public enum AiModelSource diff --git a/Shared/Core/EnumTranslations.cs b/Shared/Core/EnumTranslations.cs index 4b7953d86..73e7e2ed0 100644 --- a/Shared/Core/EnumTranslations.cs +++ b/Shared/Core/EnumTranslations.cs @@ -1145,15 +1145,15 @@ namespace BS.Shared.Core { var dict = new Dictionary(); - dict.Add(AiContextType.SupportConcept, "Hilfeplan Navigation"); - dict.Add(AiContextType.Customer, "Klienten Navigation"); - dict.Add(AiContextType.Person, "Personen Navigation"); - dict.Add(AiContextType.Employee, "Mitarbeiter Navigation"); - dict.Add(AiContextType.Organisation, "Organisationen Navigation"); + dict.Add(AiContextType.SupportConceptNavigation, "Hilfeplan Navigation"); + dict.Add(AiContextType.CustomerNavigation, "Klienten Navigation"); + dict.Add(AiContextType.PersonNavigation, "Personen Navigation"); + dict.Add(AiContextType.EmployeeNavigation, "Mitarbeiter Navigation"); + dict.Add(AiContextType.OrganisationNavigation, "Organisationen Navigation"); dict.Add(AiContextType.ServiceRecord, "Zeiterfassung"); - dict.Add(AiContextType.CustomerSingle, "Klienten Ansicht"); - dict.Add(AiContextType.EmployeeSingle, "Personen Ansicht"); - dict.Add(AiContextType.PersonSingle, "Mitarbeiter Ansicht"); + dict.Add(AiContextType.CustomerDetail, "Klienten Ansicht"); + dict.Add(AiContextType.EmployeeDetail, "Personen Ansicht"); + dict.Add(AiContextType.PersonDetail, "Mitarbeiter Ansicht"); return dict; } diff --git a/Shared/DataContracts/Feature/AI/AiConversationMessageDC.cs b/Shared/DataContracts/Feature/AI/AiConversationMessageDC.cs index 225498544..1429b0f58 100644 --- a/Shared/DataContracts/Feature/AI/AiConversationMessageDC.cs +++ b/Shared/DataContracts/Feature/AI/AiConversationMessageDC.cs @@ -1,4 +1,5 @@ using BS.Shared.DataContracts.Feature.AI; +using BS.Shared.Interface.Feature.AICore; using Newtonsoft.Json; using System; using System.Collections.Generic; @@ -10,7 +11,7 @@ using System.Threading.Tasks; namespace BS.Shared.DataContracts { [DataContract] - public class AiConversationMessageDC : BeWoDataContract + public class AiConversationMessageDC : BeWoDataContract, IAiConversationMessage { [DataMember] public string Message { get; set; } [DataMember] public AiConversationMessageRole Role { get; set; } diff --git a/Shared/Interface/Feature/AICore/IAiConversationMessage.cs b/Shared/Interface/Feature/AICore/IAiConversationMessage.cs new file mode 100644 index 000000000..5ae2af344 --- /dev/null +++ b/Shared/Interface/Feature/AICore/IAiConversationMessage.cs @@ -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; } + } +} diff --git a/Shared/Shared.csproj b/Shared/Shared.csproj index ec32a07c9..d75d5402b 100644 --- a/Shared/Shared.csproj +++ b/Shared/Shared.csproj @@ -400,6 +400,7 @@ +