BeWoAppVersion eingeführt.

This commit is contained in:
2025-08-11 12:52:19 +02:00
parent c76775d82e
commit daa2db26bc
10 changed files with 104 additions and 48 deletions

View File

@@ -97,6 +97,7 @@
<Compile Include="Converter\AddressToStringConverter.cs" />
<Compile Include="Converter\ComparisonConverter.cs" />
<Compile Include="Converter\NewlineConverter.cs" />
<Compile Include="Core\BeWoAppVersion.cs" />
<Compile Include="Core\Commands\CommandFactory.cs" />
<Compile Include="ServiceProxy\GeneratedAiEnhancedService.cs" />
<Compile Include="Services\BeWoControlFactory.cs" />

View File

@@ -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)
//{

View File

@@ -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;
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -11,23 +11,15 @@ namespace BeWo.Core.Commands
{
public static class CommandFactory
{
public static DelegateCommand GetAiViewCommand(Action openView, UserRightType userRightType, Func<bool> additionalCheckup = null)
public static DelegateCommand GetAiViewCommand(Action openView, UserRightType userRightType, Func<bool> 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<bool> 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<bool> 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";
}
}
}

View File

@@ -107,7 +107,7 @@ namespace BeWo.ViewModel
private AiConversationMessageListVM getFilter(List<AiConversationMessageDC> messages)
{
if(!BeWoApp.IsInDeveloperMode && messages is List<AiConversationMessageDC> && messages.Any())
if(!BeWoAppInfo.IsInAiSandboxMode && messages is List<AiConversationMessageDC> && messages.Any())
{
messages.RemoveAll(m => m.Role == AiConversationMessageRole.System);
}

View File

@@ -382,7 +382,7 @@ namespace BeWo.ViewModel.View
var oid = selected.DataContract.Oid;
if (BeWoApp.IsInDeveloperMode)
if (BeWoAppInfo.IsInAiSandboxMode)
{
info += $":{oid}";
}

View File

@@ -14,18 +14,18 @@
<binding name="BeWoBasicEndpoint" closeTimeout="00:05:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true" messageEncoding="Text">
<readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<!--<security mode="None" />-->
<security mode="Transport" />
<security mode="None" />
<!-- mode="Transport" für https und "None" sonst-->
</binding>
<binding name="BeWoStreamingEndpoint" receiveTimeout="10:10:00" sendTimeout="10:01:00" maxBufferSize="65536" maxReceivedMessageSize="67108864" transferMode="StreamedRequest" useDefaultWebProxy="true" messageEncoding="Text">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<!--<security mode="None" />-->
<security mode="Transport" />
<security mode="None" />
<!-- mode="Transport" für https und "None" sonst-->
</binding>
<binding name="QueryServiceEndpoint" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true" messageEncoding="Text">
<readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="Transport">
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>

View File

@@ -3,7 +3,7 @@
<PropertyGroup>
<NameOfLastUsedPublishProfile>C:\Projects\Bewo\BeWo - Main\Host\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile>
<UseIISExpress>true</UseIISExpress>
<LastActiveSolutionConfig>Release|Any CPU</LastActiveSolutionConfig>
<LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
<Use64BitIISExpress>false</Use64BitIISExpress>
<IISExpressSSLPort />
<IISExpressAnonymousAuthentication />

View File

@@ -1417,4 +1417,18 @@ namespace BS.Shared
openwebui,
ollama
}
public enum BeWoClientReleaseStage
{
Sandbox,
Staging,
Preview,
Release
}
public enum BeWoClientFeature
{
None,
AI
}
}