36 lines
1.4 KiB
C#
36 lines
1.4 KiB
C#
using System.Collections.Generic;
|
|
using Gott.Models;
|
|
|
|
namespace Gott.Services;
|
|
|
|
public static class SystemPromptBuilder
|
|
{
|
|
public static string Build(AgentRecord agent, SessionRecord session)
|
|
{
|
|
var parts = new List<string>();
|
|
parts.Add($"Du bist {agent.Name}.");
|
|
|
|
if (!string.IsNullOrWhiteSpace(agent.Persona))
|
|
parts.Add($"## Persona\n{agent.Persona}");
|
|
|
|
if (!string.IsNullOrWhiteSpace(agent.Instructions))
|
|
parts.Add($"## Instructions\n{agent.Instructions}");
|
|
|
|
if (!string.IsNullOrWhiteSpace(session.Workspace))
|
|
{
|
|
parts.Add(@$"## Tools
|
|
Du hast Tools zur Verfügung (read_file, write_file, edit_file, list_files, delete_file, execute). Benutze sie um Dateien zu lesen, schreiben und bearbeiten.
|
|
|
|
Der Workspace-Pfad ist: `{session.Workspace}`
|
|
Alle Dateipfade in Tool-Aufrufen müssen relativ zu diesem Workspace sein oder absolute Pfade verwenden, die mit diesem Pfad beginnen.
|
|
|
|
Wenn der User auf eine bestimmte Zeile in einer Datei verweist (z.B. `[Datei: foo.txt:11]`), zähle Leerzeilen immer mit. Verwende `cat -n` oder ein ähnliches Tool um Zeilennummern exakt zu bestimmen - NIEMALS Leerzeilen beim Zählen überspringen.");
|
|
}
|
|
|
|
if (!string.IsNullOrWhiteSpace(session.Context))
|
|
parts.Add($"## Kontext\n{session.Context}");
|
|
|
|
return string.Join("\n\n", parts);
|
|
}
|
|
}
|