Skip to content
This repository was archived by the owner on Jan 19, 2026. It is now read-only.

Commit e2b3de3

Browse files
committed
Update CodeTruncatorService.php
1 parent c6a76b9 commit e2b3de3

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/Services/CodeTruncatorService.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@
33
namespace Tmarois\LaravelCodeTruncator\Services;
44

55
use Illuminate\Support\Facades\File;
6+
use Illuminate\Support\Str;
67

78
class CodeTruncatorService
89
{
9-
// protected int $maxTokens = 128000;
10-
1110
public function truncate(array $paths): array
1211
{
1312
$allCode = '';
@@ -26,7 +25,10 @@ public function truncate(array $paths): array
2625
$content = File::get($file->getRealPath());
2726
$summary = $this->summarize($content);
2827

29-
$allCode .= "\n\n/** FILE: {$file->getRelativePathname()} **/\n\n" . $summary;
28+
$absolutePath = $file->getRealPath();
29+
$relativePath = Str::after($absolutePath, base_path() . DIRECTORY_SEPARATOR);
30+
31+
$allCode .= "\n\n/** FILE: {$relativePath} **/\n\n" . $summary;
3032

3133
$tokens = $this->countTokens($summary);
3234
$tokensUsed += $tokens;

0 commit comments

Comments
 (0)