mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-15 13:13:48 +00:00
Added file attachment support to chat templates (#614)
Build and Release / Read metadata (push) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg updater) (push) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-pc-windows-msvc.exe, win-arm64, windows-latest, aarch64-pc-windows-msvc, nsis updater) (push) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-unknown-linux-gnu, linux-arm64, ubuntu-22.04-arm, aarch64-unknown-linux-gnu, appimage deb updater) (push) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-apple-darwin, osx-x64, macos-latest, x86_64-apple-darwin, dmg updater) (push) Has been cancelled
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) (push) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-unknown-linux-gnu, linux-x64, ubuntu-22.04, x86_64-unknown-linux-gnu, appimage deb updater) (push) Has been cancelled
Build and Release / Prepare & create release (push) Has been cancelled
Build and Release / Publish release (push) Has been cancelled
Build and Release / Read metadata (push) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg updater) (push) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-pc-windows-msvc.exe, win-arm64, windows-latest, aarch64-pc-windows-msvc, nsis updater) (push) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-unknown-linux-gnu, linux-arm64, ubuntu-22.04-arm, aarch64-unknown-linux-gnu, appimage deb updater) (push) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-apple-darwin, osx-x64, macos-latest, x86_64-apple-darwin, dmg updater) (push) Has been cancelled
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) (push) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-unknown-linux-gnu, linux-x64, ubuntu-22.04, x86_64-unknown-linux-gnu, appimage deb updater) (push) Has been cancelled
Build and Release / Prepare & create release (push) Has been cancelled
Build and Release / Publish release (push) Has been cancelled
This commit is contained in:
1 parent
3b76b06d5d
commit
47975870b4
18 files changed
+221
-22
No files matched your search
@@ -0,0 +1,11 @@
|
||||
namespace AIStudio.Tools;
|
||||
|
||||
public static class DropLayers
|
||||
{
|
||||
public const int ROOT = 0;
|
||||
|
||||
public const int PAGES = 10;
|
||||
public const int ASSISTANTS = 20;
|
||||
|
||||
public const int DIALOGS = 100;
|
||||
}
|
||||
@@ -34,6 +34,10 @@ public enum Event
|
||||
// RAG events:
|
||||
RAG_AUTO_DATA_SOURCES_SELECTED,
|
||||
|
||||
// File attachment events:
|
||||
REGISTER_FILE_DROP_AREA,
|
||||
UNREGISTER_FILE_DROP_AREA,
|
||||
|
||||
// Send events:
|
||||
SEND_TO_GRAMMAR_SPELLING_ASSISTANT,
|
||||
SEND_TO_ICON_FINDER_ASSISTANT,
|
||||
|
||||
@@ -32,15 +32,16 @@ public static class FileExtensionValidation
|
||||
/// </summary>
|
||||
ATTACHING_CONTENT,
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Validates the file extension and sends appropriate MessageBus notifications when invalid.
|
||||
/// </summary>
|
||||
/// <param name="useCae">The validation use case.</param>
|
||||
/// <param name="filePath">The file path to validate.</param>
|
||||
/// <param name="validateMediaFileTypes">Whether to validate media file types against provider capabilities.</param>
|
||||
/// <param name="provider">The selected provider.</param>
|
||||
/// <returns>True if valid, false if invalid (error/warning already sent via MessageBus).</returns>
|
||||
public static async Task<bool> IsExtensionValidWithNotifyAsync(UseCase useCae, string filePath, Settings.Provider? provider = null)
|
||||
public static async Task<bool> IsExtensionValidWithNotifyAsync(UseCase useCae, string filePath, bool validateMediaFileTypes = true, Settings.Provider? provider = null)
|
||||
{
|
||||
var ext = Path.GetExtension(filePath).TrimStart('.').ToLowerInvariant();
|
||||
if(FileTypeFilter.Executables.FilterExtensions.Contains(ext))
|
||||
@@ -63,6 +64,10 @@ public static class FileExtensionValidation
|
||||
TB("Images are not supported at this place")));
|
||||
return false;
|
||||
|
||||
// In this use case, we don't validate the provider capabilities:
|
||||
case UseCase.ATTACHING_CONTENT when !validateMediaFileTypes:
|
||||
return true;
|
||||
|
||||
// In this use case, we can check the provider capabilities:
|
||||
case UseCase.ATTACHING_CONTENT when capabilities.Contains(Capability.SINGLE_IMAGE_INPUT) ||
|
||||
capabilities.Contains(Capability.MULTIPLE_IMAGE_INPUT):
|
||||
|
||||
Reference in new issue
Block a user