Add ERI server assistant (#231)

This commit is contained in:
Thorsten Sommer authored and GitHub committed 2025-01-01 15:49:27 +01:00
1 parent cdf717ad5f
commit 8cbef49d89
76 files changed
+3581 -153

No files matched your search

@@ -0,0 +1,27 @@
namespace AIStudio.Assistants.ERI;
public static class ERIVersionExtensions
{
public static async Task<string> ReadSpecification(this ERIVersion version, HttpClient httpClient)
{
try
{
var url = version.SpecificationURL();
var response = await httpClient.GetAsync(url);
return await response.Content.ReadAsStringAsync();
}
catch
{
return string.Empty;
}
}
public static string SpecificationURL(this ERIVersion version)
{
var nameLower = version.ToString().ToLowerInvariant();
var filename = $"{nameLower}.json";
return $"specs/eri/{filename}";
}
public static bool WasSpecificationSelected(this ERIVersion version) => version != ERIVersion.NONE;
}