161 lines
5.3 KiB
C#
161 lines
5.3 KiB
C#
namespace VideoStudy.Shared;
|
|
|
|
/// <summary>
|
|
/// Request model for video analysis
|
|
/// </summary>
|
|
public class AnalysisRequest
|
|
{
|
|
public string VideoUrl { get; set; } = string.Empty;
|
|
public string Language { get; set; } = "en"; // Input language (subtitles)
|
|
public string? OutputLanguage { get; set; } // Output language (tutorial). null = same as Language
|
|
public string Mode { get; set; } = "fast"; // fast or advanced
|
|
public string? TranscriptText { get; set; } // Optional: if client already transcribed it
|
|
public double DurationSeconds { get; set; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Response model containing analysis results
|
|
/// </summary>
|
|
public class AnalysisResponse
|
|
{
|
|
public string VideoTitle { get; set; } = string.Empty;
|
|
public string DocumentTitle { get; set; } = string.Empty; // New
|
|
public string Summary { get; set; } = string.Empty; // Renamed from ExecutiveSummary
|
|
public string Category { get; set; } = "OTHER"; // New
|
|
public string Transcript { get; set; } = string.Empty;
|
|
public List<KeyMoment> KeyMoments { get; set; } = [];
|
|
public string Analysis { get; set; } = string.Empty;
|
|
public List<TutorialSection> TutorialSections { get; set; } = [];
|
|
public List<string> DebugSteps { get; set; } = [];
|
|
public string? RawLlmResponse { get; set; }
|
|
public byte[]? PdfData { get; set; }
|
|
public string Status { get; set; } = "success";
|
|
public string? ErrorMessage { get; set; }
|
|
}
|
|
|
|
public class TutorialSection
|
|
{
|
|
public string Title { get; set; } = string.Empty;
|
|
public string Content { get; set; } = string.Empty;
|
|
public string? ImageTimestamp { get; set; } // "HH:MM:SS"
|
|
public int? ImageTimeSeconds { get; set; }
|
|
public byte[]? ImageData { get; set; } // For internal use during PDF generation
|
|
}
|
|
|
|
/// <summary>
|
|
/// Represents a key moment in the video
|
|
/// </summary>
|
|
public class KeyMoment
|
|
{
|
|
public string Timestamp { get; set; } = string.Empty;
|
|
public string Description { get; set; } = string.Empty;
|
|
public int StartSeconds { get; set; }
|
|
public string Explanation { get; set; } = string.Empty;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Progress update for long-running operations
|
|
/// </summary>
|
|
public class ProgressUpdate
|
|
{
|
|
public double PercentComplete { get; set; }
|
|
public string Message { get; set; } = string.Empty;
|
|
public string Stage { get; set; } = string.Empty;
|
|
}
|
|
|
|
public class VideoInfo
|
|
{
|
|
public string Title { get; set; } = string.Empty;
|
|
public string Description { get; set; } = string.Empty; // Added
|
|
public TimeSpan Duration { get; set; }
|
|
public string Url { get; set; } = string.Empty;
|
|
public string ThumbnailUrl { get; set; } = string.Empty;
|
|
public string Author { get; set; } = string.Empty;
|
|
}
|
|
|
|
public class Transcription
|
|
{
|
|
public string FullText { get; set; } = string.Empty;
|
|
public List<TranscriptionSegment> Segments { get; set; } = [];
|
|
public string Language { get; set; } = "en";
|
|
}
|
|
|
|
public class TranscriptionSegment
|
|
{
|
|
public string Timestamp { get; set; } = string.Empty;
|
|
public string Text { get; set; } = string.Empty;
|
|
public double StartSeconds { get; set; }
|
|
public double EndSeconds { get; set; }
|
|
}
|
|
|
|
public class ProcessingResult
|
|
{
|
|
public Transcription Transcription { get; set; } = new();
|
|
public List<KeyMoment> KeyMoments { get; set; } = [];
|
|
public List<string> ScreenshotPaths { get; set; } = [];
|
|
}
|
|
|
|
public class DownloadProgress
|
|
{
|
|
public double PercentComplete { get; set; }
|
|
public string Status { get; set; } = string.Empty;
|
|
}
|
|
|
|
public interface IPdfSaver
|
|
{
|
|
Task<string?> SavePdfAsync(byte[] pdfData, string suggestedFileName);
|
|
}
|
|
|
|
/// <summary>
|
|
/// A single event in the analysis stream.
|
|
/// </summary>
|
|
public class AnalysisEvent
|
|
{
|
|
/// <summary>
|
|
/// A user-facing message describing the current step.
|
|
/// </summary>
|
|
public string Message { get; set; } = string.Empty;
|
|
|
|
/// <summary>
|
|
/// Progress from 0 to 100.
|
|
/// </summary>
|
|
public int ProgressPercentage { get; set; }
|
|
|
|
/// <summary>
|
|
/// The final result of the analysis. Only present in the last event.
|
|
/// </summary>
|
|
public AnalysisResult? Result { get; set; }
|
|
|
|
/// <summary>
|
|
/// Set to true if this event represents a critical error that stopped the process.
|
|
/// </summary>
|
|
public bool IsError { get; set; } = false;
|
|
}
|
|
|
|
/// <summary>
|
|
/// The final, consolidated result of a successful analysis.
|
|
/// </summary>
|
|
public class AnalysisResult
|
|
{
|
|
public string VideoTitle { get; set; } = string.Empty;
|
|
public string DocumentTitle { get; set; } = string.Empty;
|
|
public string Summary { get; set; } = string.Empty; // Renamed from ExecutiveSummary
|
|
public string Category { get; set; } = "OTHER";
|
|
public string Transcript { get; set; } = string.Empty;
|
|
public List<TutorialSection> TutorialSections { get; set; } = [];
|
|
public byte[]? PdfData { get; set; }
|
|
public string? RawLlmResponse { get; set; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Representa uma sessão de estudo gravada no banco de dados local.
|
|
/// </summary>
|
|
public class VideoStudySession
|
|
{
|
|
public int Id { get; set; }
|
|
public string YouTubeId { get; set; } = string.Empty;
|
|
public string Title { get; set; } = string.Empty;
|
|
public string FilePath { get; set; } = string.Empty;
|
|
public string FolderName { get; set; } = "Geral";
|
|
public DateTime CreatedAt { get; set; } = DateTime.Now;
|
|
} |