Add support for file types to interaction service#10233
Add support for file types to interaction service#10233
Conversation
|
Do the CLI too (or does that just work) |
|
No it doesn't. I'll update the CLI in a follow up PR. |
3b2231b to
a44a7d0
Compare
There was a problem hiding this comment.
Pull Request Overview
Adds support for file‐type inputs in the interaction service, from the Protobuf definition through server handling, data model, and UI component.
- Extended the Protobuf schema and generated C# mappings to include
value_bytesand aFileinput type. - Updated
DashboardServiceDataandDashboardServiceto propagate file contents end‐to‐end. - Enhanced the Blazor input dialog and view model to handle file selection, progress, and display.
- Added a new end‐to‐end test for the file‐input interaction in
DashboardServiceTests.
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Aspire.Hosting.Tests/Dashboard/DashboardServiceTests.cs | New test exercising file‐input prompt round‐trip. |
| src/Aspire.Hosting/Dashboard/proto/dashboard_service.proto | Protobuf: added value_bytes and INPUT_TYPE_FILE. |
| src/Aspire.Hosting/Dashboard/DashboardServiceData.cs | Server: store incoming ValueBytes on InteractionInput. |
| src/Aspire.Hosting/Dashboard/DashboardService.cs | Server: serialize/deserialize ValueBytes in gRPC. |
| src/Aspire.Hosting/ApplicationModel/IInteractionService.cs | Model: added ValueBytes and SetValueBytes. |
| src/Aspire.Dashboard/Model/InputViewModel.cs | ViewModel: expose ValueBytes, FileName, progress. |
| src/Aspire.Dashboard/Components/Dialogs/InteractionsInputDialog.razor.css | CSS: include .uploaded-file-container in layout. |
| src/Aspire.Dashboard/Components/Dialogs/InteractionsInputDialog.razor.cs | Dialog: new file‐input event handlers and validation. |
| src/Aspire.Dashboard/Components/Dialogs/InteractionsInputDialog.razor | UI: markup for buffer‐mode file input with progress. |
| playground/Stress/Stress.AppHost/InteractionCommands.cs | Example: log file input length in sample commands. |
Comments suppressed due to low confidence (2)
src/Aspire.Hosting/ApplicationModel/IInteractionService.cs:137
- This public API addition is missing XML documentation. Please add a
<summary>,<remarks>, and<code>example for the newValueBytesproperty to meet our triple‐slash comment requirements.
public byte[]? ValueBytes { get => _valueBytes; init => _valueBytes = value; }
src/Aspire.Dashboard/Components/Dialogs/InteractionsInputDialog.razor.cs:139
- The new file‐input progress and completion handlers lack unit or component tests. Consider adding tests (e.g., using bUnit or a similar framework) to cover progress updates and final file buffer handling.
private async Task OnFileInputProgress(InputViewModel inputModel, FluentInputFileEventArgs args)
src/Aspire.Dashboard/Components/Dialogs/InteractionsInputDialog.razor
Outdated
Show resolved
Hide resolved
I think we should support larger files. Or at least add a setting to opt into larger file size limits |
|
I don't want a setting. How big? 3MB 5MB 10MB 100MB? What is the use case? Communication between app host and dashboard/CLI uses RPC. That means the whole file will sit in memory and there are limits on how large the file can and should be. No file size limit would require adding a bespoke way of sending the file to the app host using streaming. |
|
@captainsafia This PR also adds support for files in CLI. |
|
This is cool. I think a good proof point of this might be adding support for uploading files in the blob container in Azure storage ... and selecting a sql script to run against a sql server/sql database. |
| internal static class InteractionConfig | ||
| { | ||
| public const int MaxFileSizeMegabytes = 2; | ||
| public const int MaxFileSizeBytes = MaxFileSizeMegabytes * 1024 * 1024; |
There was a problem hiding this comment.
I think the ultimate constraint here is what we are willing to carry around in memory since the data handling here is not streamed, its copying values around. I think 2MB is quite low, I would think 100MB might be a better choice but I don't think you could go much higher without changing to a streaming approach.
There was a problem hiding this comment.
The Kestrel max body size default is about 30 MB. I'd rather not mess around with exceeding Kestrel defaults if it's not nessessary.
I'll increase the max size to 25 MB.
|
I don’t love this approach. I think there are 2 scenarios:
The user should get a stream, not byte[]. In the first scenario is an optimization. |
|
Streaming would be way more complicated.
|
|
@davidfowl What do you want to do here? |
|
I’d much prefer this to be using steams and I’m worried about supporting the protocol for both non streaming and streaming. We could fake it on the consumer side by making the API stream based and can change the underlying protocol in 9.5 to actually support it. |
Description
Add support for file input with InteractionService. The max file size is currently 2MB. If we want to support larger files then we'll need to increase the max allowed message size in gRPC.
Select file:

Uploaded file:

TODO: CLI needs to be updated to support new input type.Checklist
<remarks />and<code />elements on your triple slash comments?doc-ideatemplatebreaking-changetemplatediagnostictemplate