32 lines
765 B
C#
32 lines
765 B
C#
namespace BotSharp.Plugin.SparkDesk.Providers;
|
|
|
|
public class ProviderHelper
|
|
{
|
|
|
|
public static List<RoleDialogModel> GetChatSamples(List<string> lines)
|
|
{
|
|
var samples = new List<RoleDialogModel>();
|
|
|
|
for (int i = 0; i < lines.Count; i++)
|
|
{
|
|
var line = lines[i];
|
|
if (string.IsNullOrEmpty(line.Trim()))
|
|
{
|
|
continue;
|
|
}
|
|
var role = line.Substring(0, line.IndexOf(' ') - 1).Trim();
|
|
var content = line.Substring(line.IndexOf(' ') + 1).Trim();
|
|
|
|
// comments
|
|
if (role == "##")
|
|
{
|
|
continue;
|
|
}
|
|
|
|
samples.Add(new RoleDialogModel(role, content));
|
|
}
|
|
|
|
return samples;
|
|
}
|
|
}
|