included the file attachment component into dynamic assistant

This commit is contained in:
Nils Kruthoff 2026-07-20 16:41:53 +02:00
parent 444f7b7ca2
commit 6f06590768
No known key found for this signature in database
GPG Key ID: A5C0151B4DDB172C
2 changed files with 27 additions and 1 deletions

View File

@ -145,6 +145,27 @@ else
}
break;
case AssistantComponentType.FILE_ATTACHMENTS:
if (component is AssistantFileAttachment fileAttachment)
{
var fileState = this.assistantState.FileAttachments[fileAttachment.Name];
<div class="@fileAttachment.Class mb-3" style="@GetOptionalStyle(fileAttachment.Style)">
@if (!string.IsNullOrWhiteSpace(fileAttachment.Heading))
{
<MudText Typo="Typo.h6" Class="mb-2">@fileAttachment.Heading</MudText>
}
<div class="px-4">
<AttachDocuments Name="@fileAttachment.Name"
Layer="@DropLayers.ASSISTANTS"
@bind-DocumentPaths="@fileState.DocumentPaths"
CatchAllDocuments="@fileAttachment.CatchAllDocuments"
UseSmallForm="@fileAttachment.UseSmallForm"
Provider="@this.ProviderSettings"/>
</div>
</div>
}
break;
case AssistantComponentType.DROPDOWN:
if (component is AssistantDropdown assistantDropdown)
{

View File

@ -380,6 +380,11 @@ public partial class AssistantDynamic : AssistantBaseCore<NoSettingsPanel>
private static string GetOptionalStyle(string? style) => string.IsNullOrWhiteSpace(style) ? string.Empty : style;
private List<FileAttachment> CollectFileAttachments() =>
this.assistantState.FileAttachments.Values
.SelectMany(static state => state.DocumentPaths)
.ToList();
private bool IsButtonActionRunning(string buttonName) => this.executingButtonActions.Contains(buttonName);
private bool IsSwitchActionRunning(string switchName) => this.executingSwitchActions.Contains(switchName);
@ -568,7 +573,7 @@ public partial class AssistantDynamic : AssistantBaseCore<NoSettingsPanel>
}
this.CreateChatThread();
var time = this.AddUserRequest(await this.CollectUserPromptAsync());
var time = this.AddUserRequest(await this.CollectUserPromptAsync(), false, this.CollectFileAttachments());
await this.AddAIResponseAsync(time);
}