mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-05-03 09:39:47 +00:00
16 lines
518 B
C#
16 lines
518 B
C#
|
namespace AIStudio.Tools.Services;
|
||
|
|
||
|
public sealed partial class RustService
|
||
|
{
|
||
|
public async Task<string> GetPDFText(string filePath)
|
||
|
{
|
||
|
var response = await this.http.GetAsync($"/retrieval/fs/read/pdf?file_path={filePath}");
|
||
|
if (!response.IsSuccessStatusCode)
|
||
|
{
|
||
|
this.logger!.LogError($"Failed to read the PDF file due to an network error: '{response.StatusCode}'");
|
||
|
return string.Empty;
|
||
|
}
|
||
|
|
||
|
return await response.Content.ReadAsStringAsync();
|
||
|
}
|
||
|
}
|