mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-04 20:07:20 +00:00
Added transcription of audio and video files to local data sources (#1081)
Co-authored-by: Paul Koudelka <106623909+PaulKoudelka@users.noreply.github.com>
This commit is contained in:
1 parent
8642ce2d81
commit
752f7d828a
82 files changed
+3231
-302
No files matched your search
@@ -0,0 +1,23 @@
|
||||
namespace AIStudio.Tools.Validation;
|
||||
|
||||
/// <summary>
|
||||
/// What a data source sends to a provider which is not self-hosted.
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum CloudProcessing
|
||||
{
|
||||
/// <summary>
|
||||
/// Nothing leaves the computer or the organization.
|
||||
/// </summary>
|
||||
NONE = 0,
|
||||
|
||||
/// <summary>
|
||||
/// The content goes to an embedding provider in the cloud.
|
||||
/// </summary>
|
||||
EMBEDDING = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Audio and video files go to a transcription provider in the cloud.
|
||||
/// </summary>
|
||||
TRANSCRIPTION = 2,
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
namespace AIStudio.Tools.Validation;
|
||||
|
||||
public static class CloudProcessingExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Whether what the user acknowledged covers what the data source sends to the cloud now.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// An acknowledgment holds only for the providers it was given for. When the data source starts
|
||||
/// to send its recordings to a transcription provider in the cloud, say since a new pattern
|
||||
/// selects them, the user has to acknowledge that once more.
|
||||
/// </remarks>
|
||||
/// <param name="acknowledged">What the user acknowledged.</param>
|
||||
/// <param name="current">What the data source sends to the cloud with its current settings.</param>
|
||||
/// <returns>True when nothing is sent that the user did not acknowledge.</returns>
|
||||
public static bool Covers(this CloudProcessing acknowledged, CloudProcessing current) => (current & ~acknowledged) is CloudProcessing.NONE;
|
||||
}
|
||||
@@ -31,6 +31,8 @@ public sealed class DataSourceValidation
|
||||
|
||||
public Func<bool> GetSelectedCloudEmbedding { get; init; } = () => false;
|
||||
|
||||
public Func<bool> GetSelectedCloudTranscription { get; init; } = () => false;
|
||||
|
||||
public Func<EmbeddingProvider?> GetSelectedEmbeddingProvider { get; init; } = () => null;
|
||||
|
||||
public Func<ConfidenceLevel> GetConfidenceLevel { get; init; } = () => ConfidenceLevel.NONE;
|
||||
@@ -158,8 +160,8 @@ public sealed class DataSourceValidation
|
||||
if(!File.Exists(filePath))
|
||||
return TB("The file does not exist. Please select a valid file.");
|
||||
|
||||
if(!FileTypes.IsAllowedPath(filePath, FileTypes.DOCUMENT))
|
||||
return TB("The selected file is not a supported document or readable text file.");
|
||||
if(!FileTypes.IsAllowedPath(filePath, FileTypes.DOCUMENT, FileTypes.AUDIO, FileTypes.VIDEO))
|
||||
return TB("The selected file is not a supported document, readable text file, audio file, or video file.");
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -250,6 +252,9 @@ public sealed class DataSourceValidation
|
||||
|
||||
public string? ValidateUserAcknowledgedCloudEmbedding(bool value)
|
||||
{
|
||||
if(this.GetSelectedCloudTranscription() && !value)
|
||||
return TB("Please acknowledge that you are aware of the cloud transcription implications.");
|
||||
|
||||
if(this.GetSelectedCloudEmbedding() && !value)
|
||||
return TB("Please acknowledge that you are aware of the cloud embedding implications.");
|
||||
|
||||
|
||||
Reference in new issue
Block a user