add new configs

This commit is contained in:
team 1
2026-04-15 08:46:26 +02:00
parent 8cac77ed31
commit 1815a42035
18 changed files with 508 additions and 309 deletions

View File

@@ -4,6 +4,8 @@ declare(strict_types=1);
namespace App\Context;
use App\Config\ContextServiceConfig;
/**
* ContextService
*
@@ -27,22 +29,11 @@ final class ContextService
{
private string $historyDir;
/**
* Number of lines included in regular context.
* Intended for normal conversational continuity.
*/
private int $maxRegularLines = 20;
/**
* Number of lines included in full context.
* Intended for exceptional or diagnostic scenarios.
*/
private int $maxFullLines = 500;
public function __construct(
string $historyDir,
string $projectDir,
) {
)
{
/**
* Normalize history directory:
* - Allow relative paths in env (e.g. "var/agent-history")
@@ -66,7 +57,7 @@ final class ContextService
* Returns the conversation context for a given user.
*
* @param string $userId Stable client identifier
* @param bool $full Whether to load extended history
* @param bool $full Whether to load extended history
*/
public function buildUserContext(string $userId, bool $full = true): string
{
@@ -81,7 +72,7 @@ final class ContextService
return '';
}
$maxLines = $full ? $this->maxFullLines : $this->maxRegularLines;
$maxLines = $full ? ContextServiceConfig::MAX_FULL_LINES : ContextServiceConfig::MAX_VISIBLE_REGULAR_LINES;
$selected = array_slice($lines, -$maxLines);
return implode("\n", $selected);