using AIStudio.Tools.Rust; namespace AIStudio.Tools.Media; /// /// The outcome of a request for a persistent transcript, cf. PersistentMediaTranscript. /// /// /// The transcript itself is not part of it: whoever needs the text reads the file at /// TranscriptPath, so a transcript reaches the AI by the same path no matter whether it was just /// made or stored long ago. That read always goes through the runtime, which filters prompt /// injections: PersistentMediaTranscript.ReadTranscriptAsync reads a transcript as a whole, and a /// data source reads it in pieces for its index. /// /// How the request ended. /// The path of the transcript; empty when the place could not be determined. /// What identifies the transcript at its location; empty when the place could not be determined. /// Whether an existing transcript was used instead of a new transcription. /// A localized explanation for every status but READY and CANCELLED. /// Why the media pipeline failed, for TRANSCRIPTION_FAILED, when it is known. internal sealed record PersistentMediaTranscriptResult(PersistentMediaTranscriptStatus Status, string TranscriptPath, string Key, bool Reused, string UserMessage, MediaJobErrorCode? ErrorCode = null) { public static PersistentMediaTranscriptResult Ready(MediaTranscriptSlot slot, bool reused) => new(PersistentMediaTranscriptStatus.READY, slot.Path, slot.Key, reused, string.Empty); public static PersistentMediaTranscriptResult Cancelled() => new(PersistentMediaTranscriptStatus.CANCELLED, string.Empty, string.Empty, false, string.Empty); public static PersistentMediaTranscriptResult Unavailable(PersistentMediaTranscriptStatus status, MediaTranscriptSlot? slot, string userMessage, MediaJobErrorCode? errorCode = null) => new(status, slot?.Path ?? string.Empty, slot?.Key ?? string.Empty, false, userMessage, errorCode); }