mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-12-05 01:46:54 +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
@@ -1,4 +1,5 @@
|
||||
using AIStudio.Chat;
|
||||
using AIStudio.Tools.Imports;
|
||||
|
||||
namespace AIStudio.Tools.Media;
|
||||
|
||||
@@ -8,22 +9,22 @@ namespace AIStudio.Tools.Media;
|
||||
public interface IMediaTranscriptStorage
|
||||
{
|
||||
/// <summary>
|
||||
/// Determines whether this storage handles the specified media-import owner.
|
||||
/// Determines whether this storage handles the specified import owner.
|
||||
/// </summary>
|
||||
/// <param name="owner">The feature-specific media-import owner.</param>
|
||||
/// <param name="owner">The feature-specific import owner.</param>
|
||||
/// <returns><see langword="true"/> when the transcript can be stored.</returns>
|
||||
bool CanStore(MediaImportOwner owner);
|
||||
bool CanStore(ImportOwner owner);
|
||||
|
||||
/// <summary>
|
||||
/// Persists a completed transcript and returns the attachment exposed to the calling workflow.
|
||||
/// </summary>
|
||||
/// <param name="target">The stable media-import target.</param>
|
||||
/// <param name="target">The stable import target.</param>
|
||||
/// <param name="originalMediaPath">The original media path.</param>
|
||||
/// <param name="transcript">The completed transcript text.</param>
|
||||
/// <param name="token">The cancellation token.</param>
|
||||
/// <returns>The attachment representing the persisted transcript.</returns>
|
||||
Task<FileAttachment> StoreAsync(
|
||||
MediaImportTarget target,
|
||||
ImportTarget target,
|
||||
string originalMediaPath,
|
||||
string transcript,
|
||||
CancellationToken token);
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
using AIStudio.Chat;
|
||||
using AIStudio.Tools.Imports;
|
||||
|
||||
namespace AIStudio.Tools.Media;
|
||||
|
||||
/// <summary>Pending media results waiting for one concrete UI target.</summary>
|
||||
public sealed record MediaImportDelivery
|
||||
{
|
||||
public required MediaImportTarget Target { get; init; }
|
||||
public required ImportTarget Target { get; init; }
|
||||
|
||||
public IReadOnlyList<FileAttachment> Attachments { get; init; } = [];
|
||||
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
using AIStudio.Tools.Imports;
|
||||
|
||||
namespace AIStudio.Tools.Media;
|
||||
|
||||
/// <summary>Terminal batch outcome retained until its owner is displayed.</summary>
|
||||
public sealed record MediaImportOutcome
|
||||
{
|
||||
public required MediaImportOwner Owner { get; init; }
|
||||
public required ImportOwner Owner { get; init; }
|
||||
|
||||
public required MediaImportStatus Status { get; init; }
|
||||
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
using AIStudio.Tools.AssistantSessions;
|
||||
|
||||
namespace AIStudio.Tools.Media;
|
||||
|
||||
/// <summary>Identifies the chat or assistant that owns a media import.</summary>
|
||||
public readonly record struct MediaImportOwner(MediaImportOwnerKind Kind, string Id)
|
||||
{
|
||||
public static MediaImportOwner ForChat(Guid chatId) => new(MediaImportOwnerKind.CHAT, chatId.ToString("N"));
|
||||
|
||||
public static MediaImportOwner ForAssistant(AssistantSessionKey key) => new(MediaImportOwnerKind.ASSISTANT, key.ToString());
|
||||
|
||||
/// <summary>
|
||||
/// Creates a persistent media-import owner for a visual briefing.
|
||||
/// </summary>
|
||||
/// <param name="briefingId">The stable briefing identifier.</param>
|
||||
/// <returns>The media-import owner.</returns>
|
||||
public static MediaImportOwner ForVisualBriefing(Guid briefingId) => new(MediaImportOwnerKind.VISUAL_BRIEFING, briefingId.ToString("D"));
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
namespace AIStudio.Tools.Media;
|
||||
|
||||
/// <summary>Supported persistent media-operation owners.</summary>
|
||||
public enum MediaImportOwnerKind
|
||||
{
|
||||
CHAT,
|
||||
ASSISTANT,
|
||||
|
||||
/// <summary>
|
||||
/// Identifies persistent media transcripts owned by a visual briefing.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// A visual briefing cannot use <see cref="ASSISTANT"/>: that kind is keyed by an assistant
|
||||
/// session, which ends when the user navigates away or closes the app. A briefing is a stored
|
||||
/// document that outlives both, and its transcripts are stored next to it. The owner is
|
||||
/// therefore keyed by the briefing ID, see <see cref="MediaImportOwner.ForVisualBriefing"/>.
|
||||
/// This is what lets AI Studio re-associate transcripts with the right briefing after a
|
||||
/// restart, and what lets the UI show a running import on the briefing it belongs to.
|
||||
/// </remarks>
|
||||
VISUAL_BRIEFING,
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
namespace AIStudio.Tools.Media;
|
||||
|
||||
/// <summary>Capabilities of a media-import owner kind.</summary>
|
||||
public static class MediaImportOwnerKindExtensions
|
||||
{
|
||||
/// <param name="kind">The owner kind to look up.</param>
|
||||
extension(MediaImportOwnerKind kind)
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets whether the owner stores its own source list and transcripts.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Owners that persist their own sources take the attached media over immediately and keep it
|
||||
/// next to the stored document, see <see cref="MediaImportOwnerKind.VISUAL_BRIEFING"/>. The
|
||||
/// attachment control must therefore neither wait for the transcription to finish before showing
|
||||
/// the file, nor deliver the completed transcripts back into its own list afterwards, because
|
||||
/// the owner already holds them. All other owners rely on that delivery instead.
|
||||
/// </remarks>
|
||||
/// <value><c>true</c> when the owner persists its own sources.</value>
|
||||
public bool PersistsOwnSources => kind is MediaImportOwnerKind.VISUAL_BRIEFING;
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,13 @@
|
||||
using AIStudio.Tools.Imports;
|
||||
|
||||
namespace AIStudio.Tools.Media;
|
||||
|
||||
/// <summary>Copied owner-specific state suitable for rendering after navigation.</summary>
|
||||
public sealed record MediaImportSnapshot
|
||||
{
|
||||
public required MediaImportOwner Owner { get; init; }
|
||||
public required ImportOwner Owner { get; init; }
|
||||
|
||||
public required MediaImportTarget Target { get; init; }
|
||||
public required ImportTarget Target { get; init; }
|
||||
|
||||
public required MediaTranscriptionPhase Phase { get; init; }
|
||||
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
namespace AIStudio.Tools.Media;
|
||||
|
||||
/// <summary>Identifies the concrete attachment or file-content field inside an owner.</summary>
|
||||
public readonly record struct MediaImportTarget(MediaImportOwner Owner, string TargetId);
|
||||
Reference in new issue
Block a user