diff --git a/app/MindWork AI Studio/Assistants/DocumentAnalysis/DocumentAnalysisAssistant.razor b/app/MindWork AI Studio/Assistants/DocumentAnalysis/DocumentAnalysisAssistant.razor index 53fd2a1a..e90e4d76 100644 --- a/app/MindWork AI Studio/Assistants/DocumentAnalysis/DocumentAnalysisAssistant.razor +++ b/app/MindWork AI Studio/Assistants/DocumentAnalysis/DocumentAnalysisAssistant.razor @@ -25,7 +25,7 @@ else @foreach (var policy in this.SettingsManager.ConfigurationData.DocumentAnalysis.Policies) { - + @policy.PolicyName } @@ -42,7 +42,7 @@ else - + @T("Common settings") @@ -69,7 +69,7 @@ else @T("Preparation for enterprise distribution") - + @T("Export policy as configuration section") @@ -90,7 +90,7 @@ else @T("Documents for the analysis") - + diff --git a/app/MindWork AI Studio/Assistants/DocumentAnalysis/DocumentAnalysisAssistant.razor.cs b/app/MindWork AI Studio/Assistants/DocumentAnalysis/DocumentAnalysisAssistant.razor.cs index 7cf73955..2ac73af2 100644 --- a/app/MindWork AI Studio/Assistants/DocumentAnalysis/DocumentAnalysisAssistant.razor.cs +++ b/app/MindWork AI Studio/Assistants/DocumentAnalysis/DocumentAnalysisAssistant.razor.cs @@ -29,21 +29,21 @@ public partial class DocumentAnalysisAssistant : AssistantBaseCore 1) { sb.Append($"Your task is to analyse {this.loadedDocumentPaths.Count} documents."); sb.Append("Different Documents are divided by a horizontal rule in markdown formatting followed by the name of the document."); - sb.Append(Environment.NewLine); + sb.AppendLine(); } else { sb.Append("Your task is to analyse a single document."); - sb.Append(Environment.NewLine); + sb.AppendLine(); } - var taskDescription = $""" + var taskDescription = """ The analysis should be done using the policy analysis rules. The output should be formatted according to the policy output rules. The rule sets should be followed strictly. @@ -55,10 +55,9 @@ public partial class DocumentAnalysisAssistant : AssistantBaseCore PromptLoadDocumentsContent() { if (this.loadedDocumentPaths.Count == 0) - { return string.Empty; - } var sb = new StringBuilder(); var count = 1; foreach(var documentPath in this.loadedDocumentPaths) { sb.Append("---"); - sb.Append(Environment.NewLine); + sb.AppendLine(); sb.Append($"Document {count} file path: {documentPath}"); - sb.Append(Environment.NewLine); + sb.AppendLine(); sb.Append($"Document {count} content:"); - sb.Append(Environment.NewLine); + sb.AppendLine(); var fileContent = await this.RustService.ReadArbitraryFileData(documentPath, int.MaxValue); sb.Append($""" @@ -325,8 +322,8 @@ public partial class DocumentAnalysisAssistant : AssistantBaseCore, Task> OnChange { get; set; } = _ => Task.CompletedTask; + /// + /// Catch all documents that are hovered over the AI Studio window and not only over the drop zone. + /// + [Parameter] + public bool CatchAllDocuments { get; set; } + [Inject] private ILogger Logger { get; set; } = null!; @@ -38,7 +44,7 @@ public partial class AttachDocuments : MSGComponentBase switch (triggeredEvent) { case Event.TAURI_EVENT_RECEIVED when data is TauriEvent { EventType: TauriEventType.FILE_DROP_HOVERED }: - if(!this.isComponentHovered) + if(!this.isComponentHovered && !this.CatchAllDocuments) { this.Logger.LogDebug("Attach documents component '{Name}' is not hovered, ignoring file drop hovered event.", this.Name); return; @@ -49,7 +55,7 @@ public partial class AttachDocuments : MSGComponentBase break; case Event.TAURI_EVENT_RECEIVED when data is TauriEvent { EventType: TauriEventType.FILE_DROP_DROPPED, Payload: var paths }: - if(!this.isComponentHovered) + if(!this.isComponentHovered && !this.CatchAllDocuments) { this.Logger.LogDebug("Attach documents component '{Name}' is not hovered, ignoring file drop dropped event.", this.Name); return;