harden runner fullcontext

This commit is contained in:
team2
2026-02-16 22:54:52 +01:00
parent 34e3d8139e
commit da17fbc501
3 changed files with 6 additions and 5 deletions

View File

@@ -30,7 +30,7 @@ final readonly class AgentRunner
{ {
} }
public function run(string $prompt, string $userId): Generator public function run(string $prompt, string $userId, ?bool $includeFullContext = false): Generator
{ {
$prompt = trim($prompt); $prompt = trim($prompt);
@@ -47,7 +47,7 @@ final readonly class AgentRunner
// --------------------------------------------------------- // ---------------------------------------------------------
// 1) Context strategy // 1) Context strategy
// --------------------------------------------------------- // ---------------------------------------------------------
$includeFullContext = false; //$includeFullContext = false;
// --------------------------------------------------------- // ---------------------------------------------------------
// 2) Extract URL content (if present) // 2) Extract URL content (if present)

View File

@@ -32,7 +32,7 @@ final readonly class PromptBuilder
string $userId, string $userId,
string $urlContent, string $urlContent,
array $knowledgeChunks, array $knowledgeChunks,
bool $fullContext = false, ?bool $fullContext = false,
): string ): string
{ {
$now = (new DateTimeImmutable())->format('Y-m-d H:i:s'); $now = (new DateTimeImmutable())->format('Y-m-d H:i:s');
@@ -47,7 +47,8 @@ final readonly class PromptBuilder
throw new \RuntimeException('No active system prompt configured.'); throw new \RuntimeException('No active system prompt configured.');
} }
$systemBlock = "SYSTEM:\n" . $activePrompt->getContent(); $activeSystemPrompt = str_replace('{%now%}', $now, $activePrompt->getContent());
$systemBlock = "SYSTEM:\n" . $activeSystemPrompt;
// ------------------------------------------------------------ // ------------------------------------------------------------
// 2) CONVERSATION CONTEXT (AUTHORITATIVE) // 2) CONVERSATION CONTEXT (AUTHORITATIVE)

View File

@@ -27,7 +27,7 @@
</div> </div>
<div class="mb-3"> <div class="mb-3">
<label class="form-label">Prompt Inhalt</label> <label class="form-label">Prompt Inhalt | Variablen: {% verbatim %}{% now %}{% endverbatim %} = Datum/Zeit</label>
<textarea name="content" <textarea name="content"
rows="16" rows="16"
class="form-control bg-dark text-info border-secondary" class="form-control bg-dark text-info border-secondary"