Files
BeWoPlaner/Server/Components/AICore/Prompt/SystemPrompts/AiGenericSystemPromptBuilder.cs
Rene Evertz 89154c0223 Generischer AiSystemPromptBuilder
-> Mehr über SystmePrompt File steuerbar
2026-06-24 10:47:29 +02:00

58 lines
1.6 KiB
C#

using AICore.Context.Summary;
using AICore.Context.SummaryParser;
using BS.Shared.DataContracts.Feature.AI;
using BS.Shared.Exceptions;
using BS.Shared;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.Remoting.Messaging;
namespace AICore.Prompt.SystemPrompts
{
internal class AiGenericSystemPromptBuilder : BaseSystemPromptBuilder
{
public AiGenericSystemPromptBuilder(string prompt_path) : base(prompt_path)
{
}
public string CreateSystemPrompt(AiActionType actionType, AiViewContextDC view_context, BaseContextSummary context, AiDataContextType aiDataContextType)
{
var replace_dict = new Dictionary<string, string>()
{
{"{AktuelleZeit}", DateTime.Now.ToString() },
{"{AktuellesModule}", Translations[actionType]},
{"{FilterEinstellungen}", getFilterString(view_context.Filter)},
{"{DatenBlock}", getContextBlock(actionType, context, aiDataContextType)}
};
return createSystemPrompt(replace_dict);
}
private string getFilterString(object filter)
{
if (filter is null)
return "Es ist kein Filter gesetzt.";
return $"Es ist folgender Filter gesetzt: {filter}";
}
private string getContextBlock(AiActionType actionType, BaseContextSummary context, AiDataContextType aiDataContextType)
{
if (context is null)
{
return "Dir wurden keine Daten bereitgestellt.";
}
var parser = getParser(aiDataContextType);
var parsed = parser.Parse(actionType, context);
return $"Du erhälst folgende Daten: {Environment.NewLine}"
+ parsed;
}
}
}