Handle non-text content in ChatTemplateDialog gracefully

This commit is contained in:
Thorsten Sommer 2025-05-24 18:35:34 +02:00
parent b2ee1ce9f2
commit 8bb515042d
Signed by untrusted user who does not match committer: tsommer
GPG Key ID: 371BBA77A02C0108

View File

@ -123,7 +123,19 @@
} }
</MudSelect> </MudSelect>
</MudTd> </MudTd>
<MudTextField AutoGrow="true" @bind-Value="context.Content.As<ContentText>()!.Text" Label="@T("Your message")" Required /> <MudTd>
@switch(context.Content)
{
case ContentText textContent:
<MudTextField AutoGrow="true" @bind-Value="@textContent.Text" Label="@T("The message")" Required="true" Placeholder="@T("Enter a message")"/>
break;
default:
<MudText Typo="Typo.body2">
@T("Only text content is supported in the editing mode yet.")
</MudText>
break;
}
</MudTd> </MudTd>
</RowEditingTemplate> </RowEditingTemplate>
<PagerContent> <PagerContent>