mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-12-05 09:24:36 +00:00
Kept the inputs of assistants when you leave them (#1209)
Co-authored-by: Thorsten Sommer <SommerEngineering@users.noreply.github.com>
This commit is contained in:
1 parent
1fbc1f4796
commit
7e2f83b19b
83 files changed
+1924
-347
No files matched your search
@@ -13,9 +13,11 @@ public sealed record AssistantSessionSnapshotField<T> : IAssistantSessionSnapsho
|
||||
/// Initializes a new typed snapshot field.
|
||||
/// </summary>
|
||||
/// <param name="value">The captured value.</param>
|
||||
public AssistantSessionSnapshotField(T value)
|
||||
/// <param name="countsAsChange">Whether another value of this field means that the assistant changed, see CountsAsChange.</param>
|
||||
public AssistantSessionSnapshotField(T value, bool countsAsChange = true)
|
||||
{
|
||||
this.Value = value;
|
||||
this.CountsAsChange = countsAsChange;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -26,6 +28,9 @@ public sealed record AssistantSessionSnapshotField<T> : IAssistantSessionSnapsho
|
||||
/// <inheritdoc />
|
||||
public Type ValueType => typeof(T);
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool CountsAsChange { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool TryRead<TValue>(out TValue? value)
|
||||
{
|
||||
@@ -56,6 +61,10 @@ public sealed record AssistantSessionSnapshotField<T> : IAssistantSessionSnapsho
|
||||
if (value is null || otherValue is null)
|
||||
return false;
|
||||
|
||||
// A value which a snapshot holds as a copy of its own, e.g., the state of an assistant plugin, compares its content itself:
|
||||
if (value is IAssistantSessionValue sessionValue)
|
||||
return sessionValue.HasSameValueAs(otherValue);
|
||||
|
||||
// Nobody can change a string or a copied value type behind our back:
|
||||
if (value is string || value.GetType().IsValueType)
|
||||
return value.Equals(otherValue);
|
||||
|
||||
Reference in new issue
Block a user