mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-04 17:07:22 +00:00
Added PowerPoint templates to the Slide Assistant (#1055)
Co-authored-by: Thorsten Sommer <SommerEngineering@users.noreply.github.com>
This commit is contained in:
1 parent
8c5cfa78b6
commit
6eb23ebbcb
136 files changed
+16535
-522
No files matched your search
@@ -2,9 +2,6 @@ using AIStudio.Tools.Services;
|
||||
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
// This component has a parameter called Directory, which would shadow the file system's Directory class:
|
||||
using IODirectory = System.IO.Directory;
|
||||
|
||||
namespace AIStudio.Components;
|
||||
|
||||
public partial class SelectDirectory : MSGComponentBase
|
||||
@@ -90,35 +87,18 @@ public partial class SelectDirectory : MSGComponentBase
|
||||
/// <summary>
|
||||
/// Takes the first dropped path which leads to a folder.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// A dropped file is rejected instead of being taken as its parent folder. Everything a folder
|
||||
/// contains is processed, so guessing the parent of a mistakenly dropped file could pull in far
|
||||
/// more data than the user meant to hand over.
|
||||
/// </remarks>
|
||||
/// <param name="paths">The dropped paths.</param>
|
||||
private async Task PathsDropped(List<string> paths)
|
||||
{
|
||||
foreach (var path in paths)
|
||||
var path = DroppedFolder.FirstUsable(paths);
|
||||
if (path is null)
|
||||
{
|
||||
if (!IODirectory.Exists(path))
|
||||
continue;
|
||||
|
||||
this.Logger.LogInformation("The user dropped the directory '{DroppedDirectory}'.", path);
|
||||
this.InternalDirectoryChanged(path);
|
||||
this.Logger.LogWarning("None of the {Count} dropped path(s) could be used as a directory.", paths.Count);
|
||||
await this.MessageBus.SendWarning(new(Icons.Material.Filled.Warning, DroppedFolder.WarningFor(paths)));
|
||||
return;
|
||||
}
|
||||
|
||||
this.Logger.LogWarning("None of the {Count} dropped path(s) could be used as a directory.", paths.Count);
|
||||
await this.MessageBus.SendWarning(new(Icons.Material.Filled.Warning, this.GetDropWarning(paths)));
|
||||
}
|
||||
|
||||
private string GetDropWarning(List<string> paths)
|
||||
{
|
||||
// Naming the actual mistake beats a generic "that did not work". Dropping a file onto a
|
||||
// folder picker is the likeliest of them:
|
||||
if (paths.Any(File.Exists))
|
||||
return T("Please drop a folder, not a file.");
|
||||
|
||||
return T("The dropped folder could not be accessed. Please choose it with the folder chooser instead.");
|
||||
this.Logger.LogInformation("The user dropped the directory '{DroppedDirectory}'.", path);
|
||||
this.InternalDirectoryChanged(path);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user