Agent-Persona auf File-Basis umgestellt (IDENTITY.md, SOUL.md, USER.md)
- Persona/Instructions DB-Felder aus AgentRecord, DB-Queries, API und Frontend entfernt
- SystemPromptBuilder liest jetzt IDENTITY.md + SOUL.md aus data/agents/{agentId}/
- Globale USER.md aus data/ wird in jeden System-Prompt injiziert
- MemoryService.DataDir als public Property exponiert
- Denker: IDENTITY.md + SOUL.md erstellt
- Meleki: Migrations-Vorlagen unter migration/meleki/ angelegt
- USER.md global unter publish/data/ erstellt
This commit is contained in:
1 parent
a73a67f810
commit
3fba628bd2
11 files changed
+102
-26
No files matched your search
@@ -6,16 +6,38 @@ namespace Gott.Services;
|
||||
|
||||
public static class SystemPromptBuilder
|
||||
{
|
||||
public static string Build(AgentRecord agent, SessionRecord session, IEnumerable<MessageRecord> markedMessages = null, MemoryService memoryService = null, string agentMemoryDir = null)
|
||||
public static string Build(AgentRecord agent, SessionRecord session, IEnumerable<MessageRecord> markedMessages = null, MemoryService memoryService = null, string agentMemoryDir = null, string dataDir = null)
|
||||
{
|
||||
var parts = new List<string>();
|
||||
parts.Add($"Du bist {agent.Name}.");
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(agent.Persona))
|
||||
parts.Add($"## Persona\n{agent.Persona}");
|
||||
// IDENTITY.md - Wer bin ich
|
||||
if (memoryService != null && !string.IsNullOrWhiteSpace(agent.AgentId))
|
||||
{
|
||||
var identity = memoryService.ReadMemoryFile(agent.AgentId, "IDENTITY.md");
|
||||
if (!string.IsNullOrEmpty(identity))
|
||||
parts.Add(identity);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(agent.Instructions))
|
||||
parts.Add($"## Instructions\n{agent.Instructions}");
|
||||
// SOUL.md - Persönlichkeit + Regeln
|
||||
if (memoryService != null && !string.IsNullOrWhiteSpace(agent.AgentId))
|
||||
{
|
||||
var soul = memoryService.ReadMemoryFile(agent.AgentId, "SOUL.md");
|
||||
if (!string.IsNullOrEmpty(soul))
|
||||
parts.Add(soul);
|
||||
}
|
||||
|
||||
// USER.md - Global (aus data-Ordner)
|
||||
if (!string.IsNullOrWhiteSpace(dataDir))
|
||||
{
|
||||
var userFile = System.IO.Path.Combine(dataDir, "USER.md");
|
||||
if (System.IO.File.Exists(userFile))
|
||||
{
|
||||
var userContent = System.IO.File.ReadAllText(userFile);
|
||||
if (!string.IsNullOrWhiteSpace(userContent))
|
||||
parts.Add(userContent);
|
||||
}
|
||||
}
|
||||
|
||||
bool toolAny = string.Equals(agent.ToolChoice, "any", System.StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
|
||||
Reference in new issue
Block a user