mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-17 22:18:00 +00:00
Allow assistants to run in the background (#828)
Build and Release / Determine run mode (push) Waiting to run
Build and Release / Read metadata (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-pc-windows-msvc.exe, win-arm64, windows-latest, aarch64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-unknown-linux-gnu, linux-arm64, ubuntu-22.04-arm, aarch64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-apple-darwin, osx-x64, macos-latest, x86_64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-pc-windows-msvc.exe, win-x64, windows-latest, x86_64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-unknown-linux-gnu, linux-x64, ubuntu-22.04, x86_64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Prepare & create release (push) Blocked by required conditions
Build and Release / Publish release (push) Blocked by required conditions
Build and Release / Determine run mode (push) Waiting to run
Build and Release / Read metadata (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-pc-windows-msvc.exe, win-arm64, windows-latest, aarch64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-unknown-linux-gnu, linux-arm64, ubuntu-22.04-arm, aarch64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-apple-darwin, osx-x64, macos-latest, x86_64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-pc-windows-msvc.exe, win-x64, windows-latest, x86_64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-unknown-linux-gnu, linux-x64, ubuntu-22.04, x86_64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Prepare & create release (push) Blocked by required conditions
Build and Release / Publish release (push) Blocked by required conditions
This commit is contained in:
1 parent
fc53278c60
commit
508c7f9701
52 files changed
+2464
-168
No files matched your search
@@ -0,0 +1,78 @@
|
||||
using System.Text;
|
||||
|
||||
namespace AIStudio.Tools.AssistantSessions;
|
||||
|
||||
/// <summary>
|
||||
/// Collects typed assistant session state values for a snapshot.
|
||||
/// </summary>
|
||||
public sealed class AssistantSessionStateWriter
|
||||
{
|
||||
/// <summary>
|
||||
/// Stores captured fields by their stable dictionary names.
|
||||
/// </summary>
|
||||
private readonly Dictionary<string, IAssistantSessionSnapshotField> fields = new(StringComparer.Ordinal);
|
||||
|
||||
/// <summary>
|
||||
/// Stores a typed state value.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The value type.</typeparam>
|
||||
/// <param name="key">The typed state key.</param>
|
||||
/// <param name="value">The captured value.</param>
|
||||
public void Set<T>(AssistantSessionStateKey<T> key, T value)
|
||||
{
|
||||
this.fields[key.Name] = new AssistantSessionSnapshotField<T>(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stores a list copy.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The list item type.</typeparam>
|
||||
/// <param name="key">The typed state key.</param>
|
||||
/// <param name="values">The values to copy.</param>
|
||||
public void SetList<T>(AssistantSessionStateKey<List<T>> key, IEnumerable<T> values)
|
||||
{
|
||||
this.Set(key, values.ToList());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stores a hash set copy.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The set item type.</typeparam>
|
||||
/// <param name="key">The typed state key.</param>
|
||||
/// <param name="values">The values to copy.</param>
|
||||
public void SetHashSet<T>(AssistantSessionStateKey<HashSet<T>> key, IEnumerable<T> values)
|
||||
{
|
||||
this.Set(key, values.ToHashSet());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stores a dictionary copy.
|
||||
/// </summary>
|
||||
/// <typeparam name="TKey">The dictionary key type.</typeparam>
|
||||
/// <typeparam name="TValue">The dictionary value type.</typeparam>
|
||||
/// <param name="key">The typed state key.</param>
|
||||
/// <param name="values">The values to copy.</param>
|
||||
public void SetDictionary<TKey, TValue>(AssistantSessionStateKey<Dictionary<TKey, TValue>> key, IDictionary<TKey, TValue> values) where TKey : notnull
|
||||
{
|
||||
this.Set(key, new Dictionary<TKey, TValue>(values));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stores the current text from a string builder.
|
||||
/// </summary>
|
||||
/// <param name="key">The typed state key.</param>
|
||||
/// <param name="value">The string builder to read.</param>
|
||||
public void SetStringBuilder(AssistantSessionStateKey<string> key, StringBuilder value)
|
||||
{
|
||||
this.Set(key, value.ToString());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the captured fields as a dictionary.
|
||||
/// </summary>
|
||||
/// <returns>A copied dictionary containing the captured fields.</returns>
|
||||
public Dictionary<string, IAssistantSessionSnapshotField> ToDictionary()
|
||||
{
|
||||
return new(this.fields, StringComparer.Ordinal);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user