41 lines
943 B
C#
41 lines
943 B
C#
using AICore.Context.Summary;
|
|
using AICore.Context.Summary.Function;
|
|
using AICore.Context.Summary.Navigation;
|
|
using BS.Shared;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Text.Json;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace AICore.Context.SummaryParser
|
|
{
|
|
internal class JsonContextSummaryParser : BaseContextSummaryParser
|
|
{
|
|
public override string Parse(AiActionType actionType, BaseContextSummary context)
|
|
{
|
|
var options = new JsonSerializerOptions { IncludeFields = true };
|
|
|
|
var json = "{}";
|
|
|
|
if(context is ServiceRecordDocumantationFCS fcs)
|
|
{
|
|
json = JsonSerializer.Serialize(fcs, options);
|
|
}
|
|
else if(context is ServiceRecordNavigationCS ncs)
|
|
{
|
|
json = JsonSerializer.Serialize(ncs, options);
|
|
}
|
|
else
|
|
{
|
|
json = JsonSerializer.Serialize(context, options);
|
|
}
|
|
|
|
System.IO.File.WriteAllText("D:\\temp.txt", json);
|
|
|
|
return json;
|
|
}
|
|
}
|
|
}
|