Simplify stream ID handling in file data retrieval

This commit is contained in:
Thorsten Sommer 2025-06-30 20:43:54 +02:00
parent bb37e4070a
commit a17f39d28e
Signed by: tsommer
GPG Key ID: 371BBA77A02C0108
2 changed files with 3 additions and 3 deletions

View File

@ -38,8 +38,7 @@ public partial class ReadFileContent : MSGComponentBase
return; return;
} }
var streamId = Guid.NewGuid().ToString(); var fileContent = await this.RustService.ReadArbitraryFileData(selectedFile.SelectedFilePath, int.MaxValue);
var fileContent = await this.RustService.ReadArbitraryFileData(selectedFile.SelectedFilePath, streamId, int.MaxValue);
await this.FileContentChanged.InvokeAsync(fileContent); await this.FileContentChanged.InvokeAsync(fileContent);
} }
} }

View File

@ -5,8 +5,9 @@ namespace AIStudio.Tools.Services;
public sealed partial class RustService public sealed partial class RustService
{ {
public async Task<string> ReadArbitraryFileData(string path, string streamId, int maxChunks) public async Task<string> ReadArbitraryFileData(string path, int maxChunks)
{ {
var streamId = Guid.NewGuid().ToString();
var requestUri = $"/retrieval/fs/extract?path={Uri.EscapeDataString(path)}&stream_id={streamId}"; var requestUri = $"/retrieval/fs/extract?path={Uri.EscapeDataString(path)}&stream_id={streamId}";
var request = new HttpRequestMessage(HttpMethod.Get, requestUri); var request = new HttpRequestMessage(HttpMethod.Get, requestUri);
var response = await this.http.SendAsync(request, HttpCompletionOption.ResponseHeadersRead); var response = await this.http.SendAsync(request, HttpCompletionOption.ResponseHeadersRead);