mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-07-28 02:02:57 +00:00
Formatting
This commit is contained in:
parent
60e72b7015
commit
466f7874d4
@ -9,12 +9,11 @@ public sealed partial class RustService
|
|||||||
public async Task<string> ReadArbitraryFileData(string path, int maxChunks)
|
public async Task<string> ReadArbitraryFileData(string path, int maxChunks)
|
||||||
{
|
{
|
||||||
var requestUri = $"/retrieval/fs/extract?path={Uri.EscapeDataString(path)}";
|
var requestUri = $"/retrieval/fs/extract?path={Uri.EscapeDataString(path)}";
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
|
if (!response.IsSuccessStatusCode)
|
||||||
if (!response.IsSuccessStatusCode) { return string.Empty; }
|
return string.Empty;
|
||||||
|
|
||||||
await using var stream = await response.Content.ReadAsStreamAsync();
|
await using var stream = await response.Content.ReadAsStreamAsync();
|
||||||
using var reader = new StreamReader(stream);
|
using var reader = new StreamReader(stream);
|
||||||
@ -37,14 +36,17 @@ public sealed partial class RustService
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var sseEvent = JsonSerializer.Deserialize<SseEvent>(jsonContent);
|
var sseEvent = JsonSerializer.Deserialize<SseEvent>(jsonContent);
|
||||||
if (sseEvent != null)
|
if (sseEvent is not null)
|
||||||
{
|
{
|
||||||
var content = await SseHandler.ProcessEventAsync(sseEvent, false);
|
var content = await SseHandler.ProcessEventAsync(sseEvent, false);
|
||||||
resultBuilder.Append(content);
|
resultBuilder.Append(content);
|
||||||
chunkCount++;
|
chunkCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (JsonException) { resultBuilder.Append(string.Empty); }
|
catch (JsonException)
|
||||||
|
{
|
||||||
|
resultBuilder.Append(string.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user