23 lines
520 B
C#
23 lines
520 B
C#
using System.IO;
|
|
using System.Text.Json;
|
|
using AxCopilot.SDK;
|
|
|
|
namespace AxCopilot.Handlers;
|
|
|
|
public static class JsonSkillLoader
|
|
{
|
|
public static IActionHandler? Load(string filePath)
|
|
{
|
|
string json = File.ReadAllText(filePath);
|
|
JsonSkillDefinition jsonSkillDefinition = JsonSerializer.Deserialize<JsonSkillDefinition>(json, new JsonSerializerOptions
|
|
{
|
|
PropertyNameCaseInsensitive = true
|
|
});
|
|
if (jsonSkillDefinition == null)
|
|
{
|
|
return null;
|
|
}
|
|
return new JsonSkillHandler(jsonSkillDefinition);
|
|
}
|
|
}
|