BeWoApp Version in Shared ausgelagert
-> Wird auf dem Server benötigt
This commit is contained in:
@@ -57,7 +57,7 @@ namespace BeWo
|
||||
public static LoginControl LoginControl;
|
||||
public static MainControl MainControl;
|
||||
|
||||
public static string ShortVersion = "3.32";
|
||||
public static string ShortVersion = BeWoAppInfo.BeWoAppVersion.BaseVersion.ToString();
|
||||
public static string Version => BeWoAppInfo.BeWoAppVersion.ToString();
|
||||
public static int RenderTier = 0;
|
||||
|
||||
|
||||
@@ -13,12 +13,13 @@ using System.Runtime.Remoting.Messaging;
|
||||
using log4net;
|
||||
using BS.Shared.Core;
|
||||
using BeWo.ServerUtils.Core;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace AICore.Facade
|
||||
{
|
||||
public class AiPromptsApiClient
|
||||
{
|
||||
private protected readonly HttpClientFacade _GetClientFacade;
|
||||
private protected readonly JsonHttpClientFacade _ClientFacade;
|
||||
private protected readonly IApiErrorExtractor _ErrorExtractor;
|
||||
|
||||
private ILog _logger;
|
||||
@@ -29,14 +30,14 @@ namespace AICore.Facade
|
||||
|
||||
_logger = LoggerUtils.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
_GetClientFacade = new HttpClientFacade(base_url, null, false);
|
||||
_ClientFacade = new JsonHttpClientFacade(base_url, null, false);
|
||||
_ErrorExtractor = new DefaultErrorExtractor();
|
||||
}
|
||||
|
||||
public IEnumerable<AiPromptbausteinPromptDC> GetAiPrompts(AiActionType aiActionType)
|
||||
public IEnumerable<AiPromptbausteinPromptDC> GetAiPrompts(AiActionType aiActionType, BeWoAppVersion version)
|
||||
{
|
||||
var prompts = new List<AiPromptbausteinPromptDC>();
|
||||
|
||||
|
||||
var response_format = new[]
|
||||
{
|
||||
new
|
||||
@@ -54,9 +55,16 @@ namespace AICore.Facade
|
||||
|
||||
var method = "api/prompts/4368658435";
|
||||
|
||||
_logger.Info($"GetAiPrompts: Hole aktuelle ownSoft Prompts von '{_GetClientFacade.Base_Url}/{method}'");
|
||||
_ClientFacade.JsonObject = new
|
||||
{
|
||||
client_verion = version
|
||||
};
|
||||
|
||||
var response = _GetClientFacade.GetAnonymousTypeAsync(method, response_format, _ErrorExtractor).GetAwaiter().GetResult();
|
||||
_logger.Info($"GetAiPrompts: Hole aktuelle ownSoft Prompts von '{_ClientFacade.Base_Url}/{method}'");
|
||||
|
||||
var response = _ClientFacade.GetAnonymousTypeAsync(method, response_format, _ErrorExtractor).GetAwaiter().GetResult();
|
||||
|
||||
string json = JsonSerializer.Serialize(_ClientFacade.JsonObject);
|
||||
|
||||
if (!response.Success)
|
||||
{
|
||||
@@ -65,7 +73,7 @@ namespace AICore.Facade
|
||||
return null;
|
||||
}
|
||||
|
||||
var data = response.Data.Select(x => new AiPromptbausteinPromptDC()
|
||||
var data = response.Data.Select(x => new AiPromptbausteinPromptDC()
|
||||
{
|
||||
PromptId = x.promptid,
|
||||
Title = x.title,
|
||||
@@ -88,7 +96,7 @@ namespace AICore.Facade
|
||||
|
||||
private AiActionType GetAiActionType(string aiactiontype, AiActionType aiActionType)
|
||||
{
|
||||
if(Enum.TryParse<AiActionType>(aiactiontype, out var result))
|
||||
if (Enum.TryParse<AiActionType>(aiactiontype, out var result))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -317,7 +317,7 @@ namespace BeWo.Service.Plugins
|
||||
{
|
||||
var url = MergedConfig.GetSetting(WebConfigSetting.AiPromptsUrl);
|
||||
var client = new AiPromptsApiClient(url);
|
||||
var response = client.GetAiPrompts(aiActionType);
|
||||
var response = client.GetAiPrompts(aiActionType, BeWoAppInfo.BeWoAppVersion);
|
||||
return response?.ToList() ?? new List<AiPromptbausteinPromptDC>();
|
||||
}
|
||||
catch(Exception ex)
|
||||
|
||||
@@ -3,6 +3,8 @@ using BeWo.Data.Entities;
|
||||
using BeWo.Service.Attributes;
|
||||
using BeWo.Service.Core;
|
||||
using BeWo.Service.ServiceContracts.Enhanced;
|
||||
using BS.Shared;
|
||||
using BS.Shared.Core;
|
||||
using BS.Shared.DataContracts;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -44,8 +46,9 @@ namespace BeWo.Service.ServiceImplementations.Enhanced
|
||||
var result = new ServerStatusDC
|
||||
{
|
||||
ServerTime = DateTime.Now.ToString("o"),
|
||||
Version = Assembly.GetExecutingAssembly()
|
||||
AssemblyVersion = Assembly.GetExecutingAssembly()
|
||||
.GetName().Version?.ToString() ?? "unbekannt",
|
||||
ServerVersion = BeWoAppInfo.BeWoAppVersion,
|
||||
Services = new List<ServiceStatusDC>()
|
||||
};
|
||||
|
||||
|
||||
@@ -1,19 +1,18 @@
|
||||
using BeWo.Core;
|
||||
using BS.Shared;
|
||||
using DevExpress.Web.Internal.XmlProcessor;
|
||||
using BS.Shared;
|
||||
using BS.Shared.Core;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BeWo
|
||||
namespace BS.Shared
|
||||
{
|
||||
public static class BeWoAppInfo
|
||||
{
|
||||
static BeWoAppInfo()
|
||||
{
|
||||
var baseVersion = new Version(BeWoApp.ShortVersion);
|
||||
var baseVersion = new Version("3.32");
|
||||
var stage = BeWoClientReleaseStage.Sandbox;
|
||||
var stageVersion = new Version("5.2.1");
|
||||
var feature = BeWoClientFeature.AI;
|
||||
@@ -5,7 +5,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BeWo.Core
|
||||
namespace BS.Shared.Core
|
||||
{
|
||||
public class BeWoAppVersion
|
||||
{
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using BS.Shared.Core;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
@@ -14,7 +15,10 @@ namespace BS.Shared.DataContracts
|
||||
public string ServerTime { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public string Version { get; set; }
|
||||
public BeWoAppVersion ServerVersion { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public string AssemblyVersion { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public ServiceStatusDC DatabaseOk { get; set; }
|
||||
|
||||
@@ -141,10 +141,12 @@
|
||||
<ItemGroup>
|
||||
<Compile Include="AppSender\ApiSender.cs" />
|
||||
<Compile Include="AppSender\GkvSender.cs" />
|
||||
<Compile Include="BeWoAppInfo.cs" />
|
||||
<Compile Include="BeWoEntityEnums.cs" />
|
||||
<Compile Include="Core\AiUtils.cs" />
|
||||
<Compile Include="Core\ApiResponseUtils.cs" />
|
||||
<Compile Include="Core\AppError.cs" />
|
||||
<Compile Include="Core\BeWoAppVersion.cs" />
|
||||
<Compile Include="Core\BeWoFault.cs" />
|
||||
<Compile Include="Core\ComplexWohnheimbuchungsRelationHelper.cs" />
|
||||
<Compile Include="Core\AbstractIDSpecificDefaultClass.cs" />
|
||||
|
||||
Reference in New Issue
Block a user