mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-08-11 19:52:10 +00:00
included the file attachment component into dynamic assistant
This commit is contained in:
parent
444f7b7ca2
commit
6f06590768
@ -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)
|
||||
{
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user