2025-10-22 11:45:15 +02:00
|
|
|
|
using AICore.Context.Summary;
|
2025-09-12 14:58:41 +02:00
|
|
|
|
using AICore.Context.SummaryParser;
|
|
|
|
|
|
using BS.Shared;
|
|
|
|
|
|
using BS.Shared.Core;
|
|
|
|
|
|
using BS.Shared.Exceptions;
|
|
|
|
|
|
using BS.Shared.Translation;
|
|
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.IO;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
using System.Text.Json;
|
|
|
|
|
|
|
2025-12-04 15:06:39 +01:00
|
|
|
|
namespace AICore.Prompt.SystemPrompts
|
2025-09-12 14:58:41 +02:00
|
|
|
|
{
|
2025-12-04 15:06:39 +01:00
|
|
|
|
public class AiConversationSystemPromptBuilder : BaseSystemPromptBuilder
|
2025-09-12 14:58:41 +02:00
|
|
|
|
{
|
2025-12-04 15:06:39 +01:00
|
|
|
|
public AiConversationSystemPromptBuilder(string prompt_path) : base(prompt_path) {
|
2025-11-28 14:54:24 +01:00
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-12-04 15:06:39 +01:00
|
|
|
|
public string CreateSystemPrompt(AiContextType uicontext, BaseContextSummary context, AiDataContextType aiDataContextType)
|
2025-09-12 14:58:41 +02:00
|
|
|
|
{
|
|
|
|
|
|
var sb = new StringBuilder();
|
|
|
|
|
|
|
2026-02-20 12:51:18 +01:00
|
|
|
|
sb.AppendLine(getCustomSystemPrompt());
|
2026-02-03 14:27:25 +01:00
|
|
|
|
sb.AppendLine();
|
|
|
|
|
|
sb.AppendLine();
|
|
|
|
|
|
sb.AppendLine("---");
|
|
|
|
|
|
sb.AppendLine();
|
2025-09-12 14:58:41 +02:00
|
|
|
|
sb.AppendLine("### **Allgemein**");
|
|
|
|
|
|
sb.AppendLine($"- Aktuelle Zeit: {DateTime.Now}");
|
|
|
|
|
|
sb.AppendLine();
|
|
|
|
|
|
sb.AppendLine("### **Ansicht**");
|
|
|
|
|
|
sb.AppendLine($"- Ich befinde mich aktuell in der \"{EnumTranslations.Ai2Translation[uicontext]}\" meiner Anwendung.");
|
|
|
|
|
|
sb.AppendLine($"- Es ist kein Filter gesetzt.");
|
|
|
|
|
|
sb.AppendLine();
|
|
|
|
|
|
sb.AppendLine("### **Daten**");
|
|
|
|
|
|
|
|
|
|
|
|
if (context?.Context is null)
|
|
|
|
|
|
{
|
|
|
|
|
|
sb.AppendLine("Dir wurden keine Daten bereitgestellt.");
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
sb.AppendLine("Du erhälst folgende Daten:");
|
|
|
|
|
|
|
|
|
|
|
|
var parser = GetParser(aiDataContextType);
|
|
|
|
|
|
var parsed = parser.Parse(uicontext, context);
|
|
|
|
|
|
|
|
|
|
|
|
sb.AppendLine(parsed);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return sb.ToString();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private 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);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-11-27 14:25:15 +01:00
|
|
|
|
}
|