diff --git a/app/MindWork AI Studio/Assistants/DocumentAnalysis/DocumentAnalysisAssistant.razor b/app/MindWork AI Studio/Assistants/DocumentAnalysis/DocumentAnalysisAssistant.razor index 5255ec8f..53fd2a1a 100644 --- a/app/MindWork AI Studio/Assistants/DocumentAnalysis/DocumentAnalysisAssistant.razor +++ b/app/MindWork AI Studio/Assistants/DocumentAnalysis/DocumentAnalysisAssistant.razor @@ -41,24 +41,28 @@ else -
- - + @T("Common settings") + + + @T("Input and output rules") + + + @@ -68,12 +72,16 @@ else @T("Export policy as configuration section") + +
+ @T("Description") + @this.selectedPolicy?.PolicyDescription @@ -81,6 +89,11 @@ else @T("Documents for the analysis") + + + + +
\ No newline at end of file diff --git a/app/MindWork AI Studio/Assistants/DocumentAnalysis/DocumentAnalysisAssistant.razor.cs b/app/MindWork AI Studio/Assistants/DocumentAnalysis/DocumentAnalysisAssistant.razor.cs index 5df8dfac..7cf73955 100644 --- a/app/MindWork AI Studio/Assistants/DocumentAnalysis/DocumentAnalysisAssistant.razor.cs +++ b/app/MindWork AI Studio/Assistants/DocumentAnalysis/DocumentAnalysisAssistant.razor.cs @@ -27,7 +27,39 @@ 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); + } + else + { + sb.Append("Your task is to analyse a single document."); + sb.Append(Environment.NewLine); + } + + 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. + Only use information given in the documents or in the policy. + Never add any information of your own to it. + Keep your answers precise, professional and factual. + Only answer with the correctly formatted analysis result and do not add any opening or closing remarks. + Answer in the language that is used by the policy or is stated in the output rules. + """; + + sb.Append(taskDescription); + sb.Append(Environment.NewLine); + + sb.Append(this.PromptGetActivePolicy()); + sb.Append(Environment.NewLine); + return sb.ToString(); } } @@ -249,6 +281,58 @@ 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.Append($"Document {count} file path: {documentPath}"); + sb.Append(Environment.NewLine); + sb.Append($"Document {count} content:"); + sb.Append(Environment.NewLine); + + var fileContent = await this.RustService.ReadArbitraryFileData(documentPath, int.MaxValue); + sb.Append($""" + ``` + {fileContent} + ``` + """); + sb.Append(Environment.NewLine); + sb.Append(Environment.NewLine); + count += 1; + } + + return sb.ToString(); + } + private async Task Analyze() { if (this.IsNoPolicySelectedOrProtected) @@ -259,6 +343,13 @@ public partial class DocumentAnalysisAssistant : AssistantBaseCore