From a8c6a534dd15740b88f09ecbae58e35cc319006a Mon Sep 17 00:00:00 2001 From: Rene Evertz Date: Mon, 8 Dec 2025 15:47:12 +0100 Subject: [PATCH] Neue Endpunkte --- .../GeneratedAiEnhancedService.cs | 21 ++++++--- Service/Plugins/AiPromptbausteineService.cs | 45 ++++++++++++++++--- .../Enhanced/IAiEnhancedService.cs | 30 ++++++++++--- .../Enhanced/AiEnhancedServiceImp.cs | 21 +++++++-- .../Feature/AI/AiPromptbausteinDC.cs | 24 ---------- Shared/Shared.csproj | 1 - 6 files changed, 97 insertions(+), 45 deletions(-) delete mode 100644 Shared/DataContracts/Feature/AI/AiPromptbausteinDC.cs diff --git a/BeWo/ServiceProxy/GeneratedAiEnhancedService.cs b/BeWo/ServiceProxy/GeneratedAiEnhancedService.cs index cc3279fa8..4b048e404 100644 --- a/BeWo/ServiceProxy/GeneratedAiEnhancedService.cs +++ b/BeWo/ServiceProxy/GeneratedAiEnhancedService.cs @@ -59,17 +59,21 @@ namespace BeWo.ServiceProxy [System.ServiceModel.FaultContractAttribute(typeof(BS.Shared.Core.BeWoFault), Action="http://tempuri.org/IAiEnhancedService/SendNewMessageBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BS.Shared.Core")] System.Collections.Generic.List SendNewMessage(long conversation, string message); + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAiEnhancedService/GetAiPromptbausteineTree", ReplyAction="http://tempuri.org/IAiEnhancedService/GetAiPromptbausteineTreeResponse")] + [System.ServiceModel.FaultContractAttribute(typeof(BS.Shared.Core.BeWoFault), Action="http://tempuri.org/IAiEnhancedService/GetAiPromptbausteineTreeBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BS.Shared.Core")] + System.Collections.Generic.List GetAiPromptbausteineTree(); + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAiEnhancedService/GetAiPromptbausteine", ReplyAction="http://tempuri.org/IAiEnhancedService/GetAiPromptbausteineResponse")] [System.ServiceModel.FaultContractAttribute(typeof(BS.Shared.Core.BeWoFault), Action="http://tempuri.org/IAiEnhancedService/GetAiPromptbausteineBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BS.Shared.Core")] - System.Collections.Generic.List GetAiPromptbausteine(); + System.Collections.Generic.List GetAiPromptbausteine(); [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAiEnhancedService/CreateAiPromptbausteine", ReplyAction="http://tempuri.org/IAiEnhancedService/CreateAiPromptbausteineResponse")] [System.ServiceModel.FaultContractAttribute(typeof(BS.Shared.Core.BeWoFault), Action="http://tempuri.org/IAiEnhancedService/CreateAiPromptbausteineBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BS.Shared.Core")] - System.Collections.Generic.List CreateAiPromptbausteine(System.Collections.Generic.List aiPromptbausteinDC); + System.Collections.Generic.List CreateAiPromptbausteine(System.Collections.Generic.List aiPromptbausteinDC); [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAiEnhancedService/UpdateAiPromptbausteine", ReplyAction="http://tempuri.org/IAiEnhancedService/UpdateAiPromptbausteineResponse")] [System.ServiceModel.FaultContractAttribute(typeof(BS.Shared.Core.BeWoFault), Action="http://tempuri.org/IAiEnhancedService/UpdateAiPromptbausteineBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BS.Shared.Core")] - System.Collections.Generic.Dictionary UpdateAiPromptbausteine(System.Collections.Generic.List aiPromptbausteinDCs); + System.Collections.Generic.Dictionary UpdateAiPromptbausteine(System.Collections.Generic.List aiPromptbausteinDCs); [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAiEnhancedService/DeleteAiPromptbausteine", ReplyAction="http://tempuri.org/IAiEnhancedService/DeleteAiPromptbausteineResponse")] [System.ServiceModel.FaultContractAttribute(typeof(BS.Shared.Core.BeWoFault), Action="http://tempuri.org/IAiEnhancedService/DeleteAiPromptbausteineBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BS.Shared.Core")] @@ -167,17 +171,22 @@ namespace BeWo.ServiceProxy return base.Channel.SendNewMessage(conversation, message); } - public System.Collections.Generic.List GetAiPromptbausteine() + public System.Collections.Generic.List GetAiPromptbausteineTree() + { + return base.Channel.GetAiPromptbausteineTree(); + } + + public System.Collections.Generic.List GetAiPromptbausteine() { return base.Channel.GetAiPromptbausteine(); } - public System.Collections.Generic.List CreateAiPromptbausteine(System.Collections.Generic.List aiPromptbausteinDC) + public System.Collections.Generic.List CreateAiPromptbausteine(System.Collections.Generic.List aiPromptbausteinDC) { return base.Channel.CreateAiPromptbausteine(aiPromptbausteinDC); } - public System.Collections.Generic.Dictionary UpdateAiPromptbausteine(System.Collections.Generic.List aiPromptbausteinDCs) + public System.Collections.Generic.Dictionary UpdateAiPromptbausteine(System.Collections.Generic.List aiPromptbausteinDCs) { return base.Channel.UpdateAiPromptbausteine(aiPromptbausteinDCs); } diff --git a/Service/Plugins/AiPromptbausteineService.cs b/Service/Plugins/AiPromptbausteineService.cs index 9b034ca4d..a6e7d04c9 100644 --- a/Service/Plugins/AiPromptbausteineService.cs +++ b/Service/Plugins/AiPromptbausteineService.cs @@ -1,6 +1,7 @@ using BeWo.Data.Access; using BeWo.Data.Entities; using BeWo.Service.DCEntityMapper; +using BS.Shared.DataContracts; using BS.Shared.DataContracts.Feature.AI; using System; using System.Collections.Generic; @@ -12,7 +13,7 @@ namespace BeWo.Service.Plugins { public class AiPromptbausteineService { - public IEnumerable GetAiPromptbausteine() + public IEnumerable GetAiPromptbausteineTree() { var allAiPromptbausteine = DAOFactory.GenericDAO.GetAll(); MapperFactory.AiPromptbausteinDC_AiPromptbaustein.CreateDcList(allAiPromptbausteine); @@ -29,16 +30,50 @@ namespace BeWo.Service.Plugins return predefined.GetFullPromptbausteineTree(); } - public IEnumerable CreateAiPromptbausteine(IEnumerable aiPromptbausteinDcs) + //public IEnumerable CreateAiPromptbausteine(IEnumerable aiPromptbausteinDcs) + //{ + // var aiPromptbausteine = MapperFactory.AiPromptbausteinTree.MapToNewEntities(aiPromptbausteinDcs); + + // DAOFactory.GenericDAO.Insert(aiPromptbausteine); + + // return MapperFactory.AiPromptbausteinTree.MapToNewDCs(aiPromptbausteine); + //} + + //public Dictionary UpdateAiPromptbausteine(IEnumerable aiPromptbausteinDCs) + //{ + // throw new System.NotImplementedException(); + //} + + //public void DeleteAiPromptbausteine(Dictionary oid2version) + //{ + // throw new System.NotImplementedException(); + //} + + public IEnumerable GetAiPromptbausteine() { - var aiPromptbausteine = MapperFactory.AiPromptbausteinTree.MapToNewEntities(aiPromptbausteinDcs); + var allAiPromptbausteine = DAOFactory.GenericDAO.GetAll(); + MapperFactory.AiPromptbausteinDC_AiPromptbaustein.CreateDcList(allAiPromptbausteine); + + //var dc = new AiPromptbausteinTreeDC(); + + //dc.Oid = 1; + //dc.IsParent = false; + //dc.Version = 1; + //dc.Text = "Beispiel"; + + throw new NotImplementedException(); + } + + public IEnumerable CreateAiPromptbausteine(IEnumerable aiPromptbausteinDcs) + { + var aiPromptbausteine = MapperFactory.AiPromptbausteinDC_AiPromptbaustein.MapToNewEntities(aiPromptbausteinDcs); DAOFactory.GenericDAO.Insert(aiPromptbausteine); - return MapperFactory.AiPromptbausteinTree.MapToNewDCs(aiPromptbausteine); + return MapperFactory.AiPromptbausteinDC_AiPromptbaustein.MapToNewDCs(aiPromptbausteine); } - public Dictionary UpdateAiPromptbausteine(IEnumerable aiPromptbausteinDCs) + public Dictionary UpdateAiPromptbausteine(IEnumerable aiPromptbausteinDCs) { throw new System.NotImplementedException(); } diff --git a/Service/ServiceContracts/Enhanced/IAiEnhancedService.cs b/Service/ServiceContracts/Enhanced/IAiEnhancedService.cs index 9ed1ba846..418842770 100644 --- a/Service/ServiceContracts/Enhanced/IAiEnhancedService.cs +++ b/Service/ServiceContracts/Enhanced/IAiEnhancedService.cs @@ -70,18 +70,38 @@ namespace BeWo.Service.ServiceContracts.Enhanced [FaultContract(typeof(BeWoFault))] [OperationContract] [RequireWcfAuthorization(UserRightType.AiModulePromptbausteineView)] - IEnumerable GetAiPromptbausteine(); + IEnumerable GetAiPromptbausteineTree(); + + //[FaultContract(typeof(BeWoFault))] + //[OperationContract] + //[RequireWcfAuthorization(UserRightType.AiModulePromptbausteineAdd)] + //IEnumerable CreateAiPromptbausteineTree(IEnumerable aiPromptbausteinDC); + + //[FaultContract(typeof(BeWoFault))] + //[OperationContract] + //[RequireWcfAuthorization(UserRightType.AiModulePromptbausteineEdit)] + //Dictionary UpdateAiPromptbausteineTree(IEnumerable aiPromptbausteinDCs); + + //[FaultContract(typeof(BeWoFault))] + //[OperationContract] + //[RequireWcfAuthorization(UserRightType.AiModulePromptbausteineRemove)] + //void DeleteAiPromptbausteineTree(Dictionary oid2version); + + [FaultContract(typeof(BeWoFault))] + [OperationContract] + [RequireWcfAuthorization(UserRightType.AiModulePromptbausteineView)] + IEnumerable GetAiPromptbausteine(); [FaultContract(typeof(BeWoFault))] [OperationContract] [RequireWcfAuthorization(UserRightType.AiModulePromptbausteineAdd)] - IEnumerable CreateAiPromptbausteine(IEnumerable aiPromptbausteinDC); - + IEnumerable CreateAiPromptbausteine(IEnumerable aiPromptbausteinDC); + [FaultContract(typeof(BeWoFault))] [OperationContract] [RequireWcfAuthorization(UserRightType.AiModulePromptbausteineEdit)] - Dictionary UpdateAiPromptbausteine(IEnumerable aiPromptbausteinDCs); - + Dictionary UpdateAiPromptbausteine(IEnumerable aiPromptbausteinDCs); + [FaultContract(typeof(BeWoFault))] [OperationContract] [RequireWcfAuthorization(UserRightType.AiModulePromptbausteineRemove)] diff --git a/Service/ServiceImplementations/Enhanced/AiEnhancedServiceImp.cs b/Service/ServiceImplementations/Enhanced/AiEnhancedServiceImp.cs index 0611e11d7..de6e4456d 100644 --- a/Service/ServiceImplementations/Enhanced/AiEnhancedServiceImp.cs +++ b/Service/ServiceImplementations/Enhanced/AiEnhancedServiceImp.cs @@ -4,6 +4,7 @@ using BeWo.Data.Security; using BeWo.Service.Plugins; using BeWo.Service.ServiceContracts.Enhanced; using BS.Shared; +using BS.Shared.DataContracts; using BS.Shared.DataContracts.Feature.AI; using BS.Shared.DataContracts.Feature.AI.Functions.ServiceRecords; using System.Collections.Generic; @@ -52,18 +53,30 @@ namespace BeWo.Service.ServiceImplementations.Enhanced #endregion #region Promptbausteine - public IEnumerable GetAiPromptbausteine() + public IEnumerable GetAiPromptbausteineTree() + => GetAiPromptbausteineService().GetAiPromptbausteineTree(); + + //public IEnumerable CreateAiPromptbausteineTree(IEnumerable aiPromptbausteinDC) + // => GetAiPromptbausteineService().CreateAiPromptbausteine(aiPromptbausteinDC); + + //public Dictionary UpdateAiPromptbausteineTree(IEnumerable aiPromptbausteinDCs) + // => GetAiPromptbausteineService().UpdateAiPromptbausteine(aiPromptbausteinDCs); + + //public void DeleteAiPromptbausteineTree(Dictionary oid2version) + // => GetAiPromptbausteineService().DeleteAiPromptbausteine(oid2version); + + public IEnumerable GetAiPromptbausteine() => GetAiPromptbausteineService().GetAiPromptbausteine(); - public IEnumerable CreateAiPromptbausteine(IEnumerable aiPromptbausteinDC) + public IEnumerable CreateAiPromptbausteine(IEnumerable aiPromptbausteinDC) => GetAiPromptbausteineService().CreateAiPromptbausteine(aiPromptbausteinDC); - public Dictionary UpdateAiPromptbausteine(IEnumerable aiPromptbausteinDCs) + public Dictionary UpdateAiPromptbausteine(IEnumerable aiPromptbausteinDCs) => GetAiPromptbausteineService().UpdateAiPromptbausteine(aiPromptbausteinDCs); public void DeleteAiPromptbausteine(Dictionary oid2version) => GetAiPromptbausteineService().DeleteAiPromptbausteine(oid2version); - + private AiPromptbausteineService GetAiPromptbausteineService() { return new AiPromptbausteineService(); diff --git a/Shared/DataContracts/Feature/AI/AiPromptbausteinDC.cs b/Shared/DataContracts/Feature/AI/AiPromptbausteinDC.cs deleted file mode 100644 index 222fd9cab..000000000 --- a/Shared/DataContracts/Feature/AI/AiPromptbausteinDC.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System.Runtime.Serialization; - -using BS.Shared.DataContracts.Compact; - -namespace BS.Shared.DataContracts.Feature.AI -{ - [DataContract] - public partial class AiPromptbausteinDC : BeWoDataContract - { - [DataMember] public string Displayname { get; set; } - [DataMember] public string Content { get; set; } - [DataMember] public ActivationTypeId ActivationType { get; set; } - [DataMember] public AiPromptbausteinType PromptbausteinType { get; set; } - [DataMember] public string Metadata { get; set; } - [DataMember] public AiActionType AiActionType { get; set; } - [DataMember] public CompactEmployeeDC Creator { get; set; } - [DataMember] public bool IsOnlyForCreator { get; set; } - [DataMember] public long ParentOid { get; set; } - [DataMember] public bool ShowUserPrompt { get; set; } - [DataMember] public bool ShowUserPromptByTenant { get; set; } - [DataMember] public int Position { get; set; } - [DataMember] public bool IsExpanded { get; set; } - } -} diff --git a/Shared/Shared.csproj b/Shared/Shared.csproj index 1814b7294..026976987 100644 --- a/Shared/Shared.csproj +++ b/Shared/Shared.csproj @@ -187,7 +187,6 @@ -