C# Re-implementation (#5)
Re-implementation of C# interceptors SDK with clearer focus on server-side / gateway interceptors. Fixes a lot of issues with the existing implementation. Still more boilerplate than I'm happy with, but this is better than what was there. Will refine further in later PRs.
This commit is contained in:
parent
5bd7ab4d2a
commit
d01a626b76
1 changed files with 7887 additions and 12886 deletions
|
|
@ -0,0 +1,36 @@
|
|||
namespace AvatarMoodInterceptorSample;
|
||||
|
||||
public enum Mood
|
||||
{
|
||||
Neutral,
|
||||
Happy,
|
||||
Curious,
|
||||
Focused,
|
||||
Confused,
|
||||
Frustrated,
|
||||
}
|
||||
|
||||
public sealed class AvatarState
|
||||
{
|
||||
private readonly object _lock = new();
|
||||
private readonly List<Mood> _history = [];
|
||||
|
||||
public Mood Current { get; private set; } = Mood.Neutral;
|
||||
public float Confidence { get; private set; }
|
||||
public string? ClassifierModel { get; private set; }
|
||||
public IReadOnlyList<Mood> History
|
||||
{
|
||||
get { lock (_lock) { return _history.ToArray(); } }
|
||||
}
|
||||
|
||||
public void Update(Mood mood, float confidence, string? classifierModel)
|
||||
{
|
||||
lock (_lock)
|
||||
{
|
||||
Current = mood;
|
||||
Confidence = confidence;
|
||||
ClassifierModel = classifierModel;
|
||||
_history.Add(mood);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue