From 5dda9e38da1ce43409fa4de4cd2a1784e385cfc7 Mon Sep 17 00:00:00 2001 From: Christian Date: Tue, 10 Feb 2026 18:47:48 +0100 Subject: [PATCH] AiVoice Status wird gespeichert --- BeWo/AI/View/AiTranskriptionView.xaml | 2 +- BeWo/AI/View/AiTranskriptionView.xaml.cs | 19 +++++++++-------- Data/Access/SearchDAO.cs | 8 ++++++-- Data/Data.csproj | 2 ++ Data/Entities/AiVoiceData.cs | 22 ++++++++++++++++++++ Data/Mappings/AiVoiceData.hbm.xml | 26 ++++++++++++++++++++++++ Model/Changes_2026-02-10_AiVoiceData.txt | 21 +++++++++++++++++++ Model/Changes_alle_fuer_neue_db.txt | 16 +++++++-------- Service/Service.csproj | 1 - Service/ai/AiVoiceData.cs | 20 ------------------ Service/ai/TranscriptionService.cs | 22 ++++++++++++++++++-- Shared/BeWoEntityEnums.cs | 3 ++- 12 files changed, 119 insertions(+), 43 deletions(-) create mode 100644 Data/Entities/AiVoiceData.cs create mode 100644 Data/Mappings/AiVoiceData.hbm.xml create mode 100644 Model/Changes_2026-02-10_AiVoiceData.txt delete mode 100644 Service/ai/AiVoiceData.cs diff --git a/BeWo/AI/View/AiTranskriptionView.xaml b/BeWo/AI/View/AiTranskriptionView.xaml index c78684b1f..bf2aea87c 100644 --- a/BeWo/AI/View/AiTranskriptionView.xaml +++ b/BeWo/AI/View/AiTranskriptionView.xaml @@ -48,7 +48,7 @@ Width="32" Height="32" Margin="0,0,10,0"/> - + { CheckTranskriptionStatus(); - if (cancel) + if (!timerActive) { ((DispatcherTimer)s1).Stop(); @@ -132,8 +135,8 @@ namespace BeWo.AI.View private void ButtonStartStop_Click(object sender, RoutedEventArgs e) { - - if (ButtonText.Text.Contains("Aufnahme")) + + if (!timerActive) { StartAufnahme(); } diff --git a/Data/Access/SearchDAO.cs b/Data/Access/SearchDAO.cs index 5a3c4aadd..7359aa958 100644 --- a/Data/Access/SearchDAO.cs +++ b/Data/Access/SearchDAO.cs @@ -810,8 +810,12 @@ namespace BeWo.Data.Access var c = CreateCriteria() .Add(Restrictions.Eq(ServiceRecord.PropertyName_CostBearer2SupportConceptOid, costbearer2SupportConcept)); - - var max = ende.Date.AddDays(1); + var max = ende.Date; + if (ende.Date < DateTime.MaxValue.AddDays(-1)) + { + max = max.AddDays(1); + } + c.Add(Restrictions.Ge(ServiceRecord.PropertyName_Start, start.Date)) .Add(Restrictions.Lt(ServiceRecord.PropertyName_Start, max.Date)); diff --git a/Data/Data.csproj b/Data/Data.csproj index 68f25c758..e28c47e39 100644 --- a/Data/Data.csproj +++ b/Data/Data.csproj @@ -234,6 +234,7 @@ + @@ -861,6 +862,7 @@ Designer + Designer diff --git a/Data/Entities/AiVoiceData.cs b/Data/Entities/AiVoiceData.cs new file mode 100644 index 000000000..c5ef2c450 --- /dev/null +++ b/Data/Entities/AiVoiceData.cs @@ -0,0 +1,22 @@ +using BS.Shared; +using System; + +namespace BeWo.Data.Entities +{ + public class AiVoiceData : BeWoEntityBase + { + public AiVoiceData() + { + this._Tid = TableID.AiVoiceData; + } + + public virtual String Result { get; set; } + public virtual String Status { get; set; } + public virtual String StatusMessage { get; set; } + public virtual String Error { get; set; } + public virtual String TranskriptionText { get; set; } + public virtual String Token { get; set; } + public virtual String UploadUrl { get; set; } + public virtual String ResultUrl { get; set; } + } +} diff --git a/Data/Mappings/AiVoiceData.hbm.xml b/Data/Mappings/AiVoiceData.hbm.xml new file mode 100644 index 000000000..e32bd1a49 --- /dev/null +++ b/Data/Mappings/AiVoiceData.hbm.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Model/Changes_2026-02-10_AiVoiceData.txt b/Model/Changes_2026-02-10_AiVoiceData.txt new file mode 100644 index 000000000..e0ae864fe --- /dev/null +++ b/Model/Changes_2026-02-10_AiVoiceData.txt @@ -0,0 +1,21 @@ +CREATE TABLE IF NOT EXISTS `AiVoiceData` ( + `Oid` bigint NOT NULL AUTO_INCREMENT, + `Tid` int NOT NULL, + `Notice` varchar(1024) DEFAULT NULL, + `InsTs` datetime DEFAULT NULL, + `InsUser` varchar(256) DEFAULT NULL, + `Version` bigint DEFAULT NULL, + `UdpUser` varchar(256) DEFAULT NULL, + `UpdTs` datetime DEFAULT NULL, + `IsActive` tinyint DEFAULT NULL, + `SystemEntryID` int DEFAULT NULL, + `Result` varchar(1024) DEFAULT NULL, + `Status` varchar(1024) DEFAULT NULL, + `StatusMessage` varchar(1024) DEFAULT NULL, + `Error` varchar(1024) DEFAULT NULL, + `Token` varchar(1024) DEFAULT NULL, + `UploadUrl` varchar(1024) DEFAULT NULL, + `ResultUrl` varchar(1024) DEFAULT NULL, + `TranskriptionText` MEDIUMTEXT DEFAULT NULL, + PRIMARY KEY (`Oid`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; \ No newline at end of file diff --git a/Model/Changes_alle_fuer_neue_db.txt b/Model/Changes_alle_fuer_neue_db.txt index ef444f378..4cc3fd8a3 100644 --- a/Model/Changes_alle_fuer_neue_db.txt +++ b/Model/Changes_alle_fuer_neue_db.txt @@ -1795,14 +1795,14 @@ CREATE TABLE IF NOT EXISTS `AiVoiceData` ( `UpdTs` datetime DEFAULT NULL, `IsActive` tinyint DEFAULT NULL, `SystemEntryID` int DEFAULT NULL, - - - `ChangeType` tinyint NULL DEFAULT NULL, - `OvertimeOid` bigint NULL DEFAULT NULL, - `OvertimeEmployeeOid` bigint DEFAULT NULL, - `OvertimeDatum` datetime DEFAULT NULL, - `OvertimeBetrag` decimal(18,10) DEFAULT NULL, - `OvertimeAuszahlungsartOid` bigint DEFAULT NULL, + `Result` varchar(1024) DEFAULT NULL, + `Status` varchar(1024) DEFAULT NULL, + `StatusMessage` varchar(1024) DEFAULT NULL, + `Error` varchar(1024) DEFAULT NULL, + `Token` varchar(1024) DEFAULT NULL, + `UploadUrl` varchar(1024) DEFAULT NULL, + `ResultUrl` varchar(1024) DEFAULT NULL, + `TranskriptionText` MEDIUMTEXT DEFAULT NULL, PRIMARY KEY (`Oid`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; diff --git a/Service/Service.csproj b/Service/Service.csproj index 6091ff18d..122d8bb42 100644 --- a/Service/Service.csproj +++ b/Service/Service.csproj @@ -222,7 +222,6 @@ - diff --git a/Service/ai/AiVoiceData.cs b/Service/ai/AiVoiceData.cs deleted file mode 100644 index 23fe23c2f..000000000 --- a/Service/ai/AiVoiceData.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace BeWo.Service.AI -{ - public class AiVoiceData - { - public String Result { get; set; } - public String Status { get; set; } - public String StatusMessage { get; set; } - public String Error { get; set; } - public String TranskriptionText { get; set; } - public String Token { get; set; } - public String UploadUrl { get; set; } - public String ResultUrl { get; set; } - } -} diff --git a/Service/ai/TranscriptionService.cs b/Service/ai/TranscriptionService.cs index 7a322e89e..02f5c0205 100644 --- a/Service/ai/TranscriptionService.cs +++ b/Service/ai/TranscriptionService.cs @@ -1,4 +1,6 @@ -using BeWo.Data.Security; +using BeWo.Data.Access; +using BeWo.Data.Entities; +using BeWo.Data.Security; using BeWo.Service.OwnChat; using BS.Shared.DataContracts; using Newtonsoft.Json; @@ -17,9 +19,18 @@ namespace BeWo.Service.AI { public AiVoiceData StartTranskription(String tenant, String sprache = "de") { + AiVoiceData avd = null; + try { + + //avd = new AiVoiceData(); + //avd.StatusMessage = "1"; + //DAOFactory.GenericDAO.Update(avd); + + //return avd; + avd = GetTranskriptionToken(tenant, sprache); if (!String.IsNullOrEmpty(avd.Token)) @@ -48,6 +59,12 @@ namespace BeWo.Service.AI try { + //if (!String.IsNullOrEmpty(avd.StatusMessage) && Int32.TryParse(avd.StatusMessage, out var test)) + //{ + // test++; + // avd.StatusMessage = String.Format("{0}", test); + //} + if (!String.IsNullOrEmpty(avd.ResultUrl)) { if (CheckValidUrl(avd.ResultUrl)) @@ -83,10 +100,12 @@ namespace BeWo.Service.AI else if (json.result == "0" && json.state == "30") { avd.StatusMessage = "Transkription erfolgreich abgeschlossen"; + DAOFactory.GenericDAO.Update(avd); } else { avd.StatusMessage = String.Format("Es ist leider ein Fehler aufgetreten: Result = {0}, Status = {1}", json.result, json.state); + DAOFactory.GenericDAO.Update(avd); } } } @@ -113,7 +132,6 @@ namespace BeWo.Service.AI private AiVoiceData GetTranskriptionToken(String tenant, String sprache) { - try { var serverUrl = OwnChatHelper.ErmittleServerURL("4", tenant); diff --git a/Shared/BeWoEntityEnums.cs b/Shared/BeWoEntityEnums.cs index ab6ac73d3..0a0b979e9 100644 --- a/Shared/BeWoEntityEnums.cs +++ b/Shared/BeWoEntityEnums.cs @@ -192,7 +192,8 @@ namespace BS.Shared AiConfig = 182, StoredFile = 183, Person2Team = 184, - OvertimeHistory = 185 + OvertimeHistory = 185, + AiVoiceData = 186 } public enum SystemEntryID