Skip to content

Commit c0fcd55

Browse files
authored
refactor: moving classes to a more component like structure (#9)
* moving classes to a more component like structure - add Wikipedia and YouTube namespace and moved applicable classes. this way the code is clustered by implementation making it easier to copy paste it to your own application. * rename rag to blog - rename add to blog to clarify the implementation
1 parent 2817e66 commit c0fcd55

File tree

7 files changed

+13
-13
lines changed

7 files changed

+13
-13
lines changed

src/Chat/Rag.php src/Blog/Chat/Blog.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
namespace App\Chat;
5+
namespace App\Blog\Chat;
66

77
use PhpLlm\LlmChain\ChainInterface;
88
use PhpLlm\LlmChain\Model\Message\Message;
@@ -11,7 +11,7 @@
1111
use Symfony\Component\DependencyInjection\Attribute\Autowire;
1212
use Symfony\Component\HttpFoundation\RequestStack;
1313

14-
final class Rag
14+
final class Blog
1515
{
1616
private const SESSION_KEY = 'rag-chat';
1717

src/Command/BlogEmbedCommand.php src/Blog/Command/BlogEmbedCommand.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
namespace App\Command;
5+
namespace App\Blog\Command;
66

77
use App\Blog\Embedder;
88
use Symfony\Component\Console\Attribute\AsCommand;

src/Twig/RagComponent.php src/Blog/Twig/BlogComponent.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@
22

33
declare(strict_types=1);
44

5-
namespace App\Twig;
5+
namespace App\Blog\Twig;
66

7-
use App\Chat\Rag;
7+
use App\Blog\Chat\Blog;
88
use PhpLlm\LlmChain\Model\Message\MessageBag;
99
use Symfony\UX\LiveComponent\Attribute\AsLiveComponent;
1010
use Symfony\UX\LiveComponent\Attribute\LiveAction;
1111
use Symfony\UX\LiveComponent\Attribute\LiveArg;
1212
use Symfony\UX\LiveComponent\DefaultActionTrait;
1313

1414
#[AsLiveComponent('rag')]
15-
final class RagComponent
15+
final class BlogComponent
1616
{
1717
use DefaultActionTrait;
1818

1919
public function __construct(
20-
private readonly Rag $chat,
20+
private readonly Blog $chat,
2121
) {
2222
}
2323

src/Chat/Wikipedia.php src/Wikipedia/Chat/Wikipedia.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
namespace App\Chat;
5+
namespace App\Wikipedia\Chat;
66

77
use PhpLlm\LlmChain\ChainInterface;
88
use PhpLlm\LlmChain\Model\Message\Message;

src/Twig/WikipediaComponent.php src/Wikipedia/Twig/WikipediaComponent.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
declare(strict_types=1);
44

5-
namespace App\Twig;
5+
namespace App\Wikipedia\Twig;
66

7-
use App\Chat\Wikipedia;
7+
use App\Wikipedia\Chat\Wikipedia;
88
use PhpLlm\LlmChain\Model\Message\MessageBag;
99
use Symfony\UX\LiveComponent\Attribute\AsLiveComponent;
1010
use Symfony\UX\LiveComponent\Attribute\LiveAction;

src/Chat/YouTube.php src/YouTube/Chat/YouTube.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
namespace App\Chat;
5+
namespace App\YouTube\Chat;
66

77
use App\YouTube\TranscriptFetcher;
88
use PhpLlm\LlmChain\ChainInterface;

src/Twig/YouTubeComponent.php src/YouTube/Twig/YouTubeComponent.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
declare(strict_types=1);
44

5-
namespace App\Twig;
5+
namespace App\YouTube\Twig;
66

7-
use App\Chat\YouTube;
7+
use App\YouTube\Chat\YouTube;
88
use PhpLlm\LlmChain\Model\Message\MessageBag;
99
use Psr\Log\LoggerInterface;
1010
use Symfony\UX\LiveComponent\Attribute\AsLiveComponent;

0 commit comments

Comments
 (0)