2026-06-24 10:47:29 +02:00
|
|
|
|
using AICore.Context.Summary;
|
|
|
|
|
|
using AICore.Context.SummaryParser;
|
|
|
|
|
|
using BS.Shared;
|
|
|
|
|
|
using BS.Shared.DataContracts.Feature.AI;
|
|
|
|
|
|
using BS.Shared.Exceptions;
|
2026-05-26 12:30:29 +02:00
|
|
|
|
using System;
|
2025-11-28 14:54:24 +01:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.IO;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
2025-12-04 15:06:39 +01:00
|
|
|
|
namespace AICore.Prompt.SystemPrompts
|
2025-11-28 14:54:24 +01:00
|
|
|
|
{
|
2026-05-27 15:34:53 +02:00
|
|
|
|
internal class BaseSystemPromptBuilder
|
2025-11-28 14:54:24 +01:00
|
|
|
|
{
|
2026-05-26 12:30:29 +02:00
|
|
|
|
public readonly static Dictionary<AiActionType, string> Translations = new Dictionary<AiActionType, string>
|
|
|
|
|
|
{
|
|
|
|
|
|
{AiActionType.ServiceRecord, "Zeiterfassung" },
|
|
|
|
|
|
{AiActionType.ServiceRecordConversation, "Zeiterfassung" },
|
|
|
|
|
|
{AiActionType.ServiceRecordDocumentation, "Zeiterfassung" },
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2026-02-20 12:51:18 +01:00
|
|
|
|
public string Path { get; set; }
|
2025-11-28 14:54:24 +01:00
|
|
|
|
|
2026-02-20 12:51:18 +01:00
|
|
|
|
public BaseSystemPromptBuilder(string path)
|
2025-11-28 14:54:24 +01:00
|
|
|
|
{
|
2026-02-20 12:51:18 +01:00
|
|
|
|
Path = path;
|
2025-11-28 14:54:24 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-24 10:47:29 +02:00
|
|
|
|
protected string createSystemPrompt(Dictionary<string, string> replace_dict)
|
|
|
|
|
|
{
|
|
|
|
|
|
var sb = new StringBuilder();
|
|
|
|
|
|
|
|
|
|
|
|
sb.AppendLine(getCustomSystemPrompt());
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var kvp in replace_dict)
|
|
|
|
|
|
{
|
|
|
|
|
|
var key = kvp.Key;
|
|
|
|
|
|
var value = kvp.Value;
|
|
|
|
|
|
|
|
|
|
|
|
sb.Replace(key, value);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return sb.ToString();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected BaseContextSummaryParser getParser(AiDataContextType aiDataContextType)
|
|
|
|
|
|
{
|
|
|
|
|
|
switch (aiDataContextType)
|
|
|
|
|
|
{
|
|
|
|
|
|
case AiDataContextType.json:
|
|
|
|
|
|
return new JsonContextSummaryParser();
|
|
|
|
|
|
case AiDataContextType.csv:
|
|
|
|
|
|
return new CsvContextSummaryParser();
|
|
|
|
|
|
case AiDataContextType.tsv:
|
|
|
|
|
|
return new CsvContextSummaryParser("\t");
|
|
|
|
|
|
case AiDataContextType.csv2:
|
|
|
|
|
|
return new CsvContextSummaryParser(";", true);
|
|
|
|
|
|
case AiDataContextType.tsv2:
|
|
|
|
|
|
return new CsvContextSummaryParser("\t", true);
|
|
|
|
|
|
default:
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
throw BeWoNotImplementedException.CreateFromEnum(aiDataContextType);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private string getCustomSystemPrompt()
|
2025-11-28 14:54:24 +01:00
|
|
|
|
{
|
2026-02-20 12:51:18 +01:00
|
|
|
|
var path = Path;
|
2025-11-28 14:54:24 +01:00
|
|
|
|
return File.ReadAllText(path);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|