From daa2db26bc37f2ce06bdc8da88f7512bb4dc5290 Mon Sep 17 00:00:00 2001 From: Rene Evertz Date: Mon, 11 Aug 2025 12:52:19 +0200 Subject: [PATCH] =?UTF-8?q?BeWoAppVersion=20eingef=C3=BChrt.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BeWo/BeWo.csproj | 1 + BeWo/BeWoApp.xaml.cs | 11 ++--- BeWo/BeWoAppInfo.cs | 47 ++++++++++++++----- BeWo/Core/BeWoAppVersion.cs | 42 +++++++++++++++++ BeWo/Core/Commands/CommandFactory.cs | 25 ++-------- BeWo/ViewModel/AiConversationVM.cs | 2 +- .../View/AiConversationChatViewModel.cs | 2 +- BeWo/app.config | 6 +-- Host/Host.csproj.user | 2 +- Shared/BeWoEntityEnums.cs | 14 ++++++ 10 files changed, 104 insertions(+), 48 deletions(-) create mode 100644 BeWo/Core/BeWoAppVersion.cs diff --git a/BeWo/BeWo.csproj b/BeWo/BeWo.csproj index 3fa124c68..4c32cab0c 100644 --- a/BeWo/BeWo.csproj +++ b/BeWo/BeWo.csproj @@ -97,6 +97,7 @@ + diff --git a/BeWo/BeWoApp.xaml.cs b/BeWo/BeWoApp.xaml.cs index c1ae8c9b0..cb9a3079e 100644 --- a/BeWo/BeWoApp.xaml.cs +++ b/BeWo/BeWoApp.xaml.cs @@ -58,7 +58,7 @@ namespace BeWo public static string ShortVersion = "3.26"; - public static string Version = "Version 3.26 - 1.3 AI Test"; + public static string Version => BeWoAppInfo.BeWoAppVersion.ToString(); public static int RenderTier = 0; @@ -620,8 +620,6 @@ namespace BeWo //AppSettings.AllowGkvAbrechnung = true; //AppSettings.AllowGkvAbrechnung = false; //showInfoButtonInCalender = true; - IsInDeveloperMode = true; - //IsInDeveloperMode = false; //AppSettings.ModuleAiEnabled = true; //AppSettings.ModuleAiSettingsEnabled = false; AppSettings.IsSchedulerAllowed = true; @@ -665,7 +663,7 @@ namespace BeWo BS.Shared.Settings.ApplicationSettings.SupportConceptExpirationLimitInMonths = AppSettings.HilfeplanAuslaufAuswahl; - if (BeWoAppInfo.IsInDeveloperMode) + if (BeWoAppInfo.IsInAiSandboxMode) { applyDeveloperMode(); } @@ -1025,10 +1023,7 @@ namespace BeWo FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement), new FrameworkPropertyMetadata(XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag))); - if(e.Args.Contains("/bewodevmode") || e.Args.Contains("--bewodevmode")) - { - BeWoAppInfo.IsInDeveloperMode = true; - } + BeWoAppInfo.TryActiveDeveloperMode(e.Args); //if(e.Args.LastOrDefault(x => x.StartsWith("/timeout:") || x.StartsWith("--timeout:")) is string str) //{ diff --git a/BeWo/BeWoAppInfo.cs b/BeWo/BeWoAppInfo.cs index 4ee9bd078..2a4c16b06 100644 --- a/BeWo/BeWoAppInfo.cs +++ b/BeWo/BeWoAppInfo.cs @@ -1,4 +1,7 @@ -using System; +using BeWo.Core; +using BS.Shared; +using DevExpress.Web.Internal.XmlProcessor; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -8,19 +11,39 @@ namespace BeWo { public static class BeWoAppInfo { - private static bool _IsInDeveloperMode; - - public static bool IsInDeveloperMode + static BeWoAppInfo() { - get => _IsInDeveloperMode; - set - { - if (IsInDeveloperMode == value) - return; + var baseVersion = new Version(BeWoApp.ShortVersion); + var stage = BeWoClientReleaseStage.Sandbox; + var stageVersion = new Version("1.4"); + var feature = BeWoClientFeature.AI; - _IsInDeveloperMode = value; - BeWoApp.CurrentBeWo.FirePropertyChanged(nameof(IsInDeveloperMode)); - } + BeWoAppVersion = new BeWoAppVersion(baseVersion, stage, stageVersion, feature); + + #if DEBUG + IsInDeveloperMode = true; + #endif + } + + private static bool IsInDeveloperMode { get; set; } + + public static BeWoAppVersion BeWoAppVersion { get; private set; } + + public static bool IsInAiMode => BeWoAppVersion.Feature == BeWoClientFeature.AI; + public static bool IsInAiSandboxMode => IsInDeveloperMode && IsInAiMode; + + public static void TryActiveDeveloperMode(string[] args) + { + if (BeWoAppVersion.Stage != BeWoClientReleaseStage.Sandbox) + return; + + if (args.All(x => x != "/bewodevmode" && x != "--bewodevmode")) + return; + + if (IsInDeveloperMode) + throw new NotImplementedException(); + + IsInDeveloperMode = true; } } } diff --git a/BeWo/Core/BeWoAppVersion.cs b/BeWo/Core/BeWoAppVersion.cs new file mode 100644 index 000000000..dcb69ecac --- /dev/null +++ b/BeWo/Core/BeWoAppVersion.cs @@ -0,0 +1,42 @@ +using BS.Shared; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BeWo.Core +{ + public class BeWoAppVersion + { + public Version BaseVersion { get; } + public BeWoClientReleaseStage Stage { get; } + public Version StageVersion { get; } + public BeWoClientFeature Feature { get; } + + public BeWoAppVersion(Version baseVersion, BeWoClientReleaseStage stage, Version stageVersion, BeWoClientFeature feature = BeWoClientFeature.None) + { + BaseVersion = baseVersion; + Stage = stage; + StageVersion = stageVersion; + Feature = feature; + } + + public override string ToString() + { + string result = $"Version {BaseVersion}"; + + if (Stage == BeWoClientReleaseStage.Release) + return result; + + result += $" {Stage.ToString().ToLower()} {StageVersion}"; + + if (Feature != BeWoClientFeature.None) + { + result += $" ({Feature})"; + } + + return result; + } + } +} diff --git a/BeWo/Core/Commands/CommandFactory.cs b/BeWo/Core/Commands/CommandFactory.cs index 38190693d..9027882ee 100644 --- a/BeWo/Core/Commands/CommandFactory.cs +++ b/BeWo/Core/Commands/CommandFactory.cs @@ -11,23 +11,15 @@ namespace BeWo.Core.Commands { public static class CommandFactory { - public static DelegateCommand GetAiViewCommand(Action openView, UserRightType userRightType, Func additionalCheckup = null) + public static DelegateCommand GetAiViewCommand(Action openView, UserRightType userRightType, Func additionalCheckup = null, bool? useCommandManager = null) { bool canExecute() => + BeWoAppInfo.IsInAiMode && (BeWoApp.AppSettings?.ModuleAiEnabled ?? false) && BeWoApp.HasLoggedOnUserRight(userRightType) && (additionalCheckup is null || additionalCheckup()); - return GetTestClientCommand(openView, () => CheckupSafe(canExecute), null); - } - - public static DelegateCommand GetTestClientCommand(Action action, Func canExecute = null, bool? useCommandManager = null) - { - bool canExecute2() => - CheckupTestVersion() && - (canExecute is null || canExecute()); - - return new DelegateCommand(action, () => CheckupSafe(canExecute2), useCommandManager); + return new DelegateCommand(openView, () => CheckupSafe(canExecute), useCommandManager); } private static bool CheckupSafe(Func predicate) @@ -41,16 +33,5 @@ namespace BeWo.Core.Commands return false; } } - - private static bool CheckupTestVersion() - { -#if DEBUG - return true; -#endif - - var version = BeWoApp.Version.Split(' '); - var test_string = version[version.Length - 1].ToLower(); - return test_string == "test"; - } } } diff --git a/BeWo/ViewModel/AiConversationVM.cs b/BeWo/ViewModel/AiConversationVM.cs index 786329e70..2a068b311 100644 --- a/BeWo/ViewModel/AiConversationVM.cs +++ b/BeWo/ViewModel/AiConversationVM.cs @@ -107,7 +107,7 @@ namespace BeWo.ViewModel private AiConversationMessageListVM getFilter(List messages) { - if(!BeWoApp.IsInDeveloperMode && messages is List && messages.Any()) + if(!BeWoAppInfo.IsInAiSandboxMode && messages is List && messages.Any()) { messages.RemoveAll(m => m.Role == AiConversationMessageRole.System); } diff --git a/BeWo/ViewModel/View/AiConversationChatViewModel.cs b/BeWo/ViewModel/View/AiConversationChatViewModel.cs index afd0fba21..51d14df75 100644 --- a/BeWo/ViewModel/View/AiConversationChatViewModel.cs +++ b/BeWo/ViewModel/View/AiConversationChatViewModel.cs @@ -382,7 +382,7 @@ namespace BeWo.ViewModel.View var oid = selected.DataContract.Oid; - if (BeWoApp.IsInDeveloperMode) + if (BeWoAppInfo.IsInAiSandboxMode) { info += $":{oid}"; } diff --git a/BeWo/app.config b/BeWo/app.config index 859aca86a..694c950ad 100644 --- a/BeWo/app.config +++ b/BeWo/app.config @@ -14,18 +14,18 @@ - + - + - + diff --git a/Host/Host.csproj.user b/Host/Host.csproj.user index 49baaffc7..932dd8add 100644 --- a/Host/Host.csproj.user +++ b/Host/Host.csproj.user @@ -3,7 +3,7 @@ C:\Projects\Bewo\BeWo - Main\Host\Properties\PublishProfiles\FolderProfile.pubxml true - Release|Any CPU + Debug|Any CPU false diff --git a/Shared/BeWoEntityEnums.cs b/Shared/BeWoEntityEnums.cs index 54bd88f1b..275364785 100644 --- a/Shared/BeWoEntityEnums.cs +++ b/Shared/BeWoEntityEnums.cs @@ -1417,4 +1417,18 @@ namespace BS.Shared openwebui, ollama } + + public enum BeWoClientReleaseStage + { + Sandbox, + Staging, + Preview, + Release + } + + public enum BeWoClientFeature + { + None, + AI + } } \ No newline at end of file