fixed inference bugs

add DONE during inference, correct handling on C# side
This commit is contained in:
Alex Bezdieniezhnykh
2025-02-01 02:09:11 +02:00
parent e7afa96a0b
commit 739759628a
23 changed files with 324 additions and 95 deletions
+9
View File
@@ -0,0 +1,9 @@
namespace Azaion.CommonSecurity.DTO;
public class ApiConfig
{
public string Url { get; set; } = null!;
public int RetryCount {get;set;}
public double TimeoutSeconds { get; set; }
public string ResourcesFolder { get; set; } = "";
}
@@ -18,7 +18,9 @@ public class RemoteCommand(CommandType commandType, string? filename = null, byt
public enum CommandType
{
None = 0,
Inference = 1,
Load = 2,
GetUser = 3
GetUser = 10,
Load = 20,
Inference = 30,
StopInference = 40,
Exit = 100
}
@@ -0,0 +1,6 @@
namespace Azaion.CommonSecurity.DTO;
public class SecureAppConfig
{
public ApiConfig ApiConfig { get; set; } = null!;
}
+15
View File
@@ -1,3 +1,4 @@
using System.Security.Claims;
using MessagePack;
namespace Azaion.CommonSecurity.DTO;
@@ -8,4 +9,18 @@ public class User
[Key("i")]public string Id { get; set; }
[Key("e")]public string Email { get; set; }
[Key("r")]public RoleEnum Role { get; set; }
//For deserializing
public User(){}
public User(IEnumerable<Claim> claims)
{
var claimDict = claims.ToDictionary(x => x.Type, x => x.Value);
Id = claimDict[SecurityConstants.CLAIM_NAME_ID];
Email = claimDict[SecurityConstants.CLAIM_EMAIL];
if (!Enum.TryParse(claimDict[SecurityConstants.CLAIM_ROLE], out RoleEnum role))
role = RoleEnum.None;
Role = role;
}
}