Skip to content
This repository was archived by the owner on Jul 16, 2025. It is now read-only.

Commit 9a8bc3a

Browse files
committed
refactor: follow up on example structure
1 parent 7cb6f6d commit 9a8bc3a

29 files changed

+74
-87
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ docker compose exec app bin/console app:blog:embed -vv
7979
Now you should be able to run the test command and get some results:
8080

8181
```shell
82-
docker compose exec app bin/console app:chroma:test
82+
docker compose exec app bin/console app:blog:query
8383
```
8484

8585
**Don't forget to set up the project in your favorite IDE or editor.**
@@ -89,4 +89,4 @@ docker compose exec app bin/console app:chroma:test
8989
* The chatbot application is a simple and small Symfony 7.2 application.
9090
* The UI is coupled to a [Twig LiveComponent](https://symfony.com/bundles/ux-live-component/current/index.html), that integrates different `Chat` implementations on top of the user's session.
9191
* You can reset the chat context by hitting the `Reset` button in the top right corner.
92-
* You find three different usage scenarios in the upper navbar.
92+
* You find three different usage scenarios in the upper navbar.

assets/icons/entypo/chat.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

assets/icons/mdi/symfony.svg

Lines changed: 1 addition & 0 deletions
Loading

assets/icons/mingcute/ai-fill.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

assets/styles/app.css

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
body {
22
min-height: 100vh;
3-
&.rag, .rag .card-img-top {
3+
&.blog, .blog .card-img-top {
44
background: rgb(220,139,110);
55
background: linear-gradient(0deg, rgba(220,139,110,1) 0%, rgba(244,233,115,1) 100%);
66
}
@@ -53,7 +53,7 @@ body {
5353
border-radius: 10px 10px 0 10px;
5454
color: #292929;
5555

56-
.rag & {
56+
.blog & {
5757
background: #f4e973;
5858
}
5959

@@ -70,7 +70,7 @@ body {
7070
.bot-message {
7171
border-radius: 10px 10px 10px 0;
7272

73-
.rag & {
73+
.blog & {
7474
background: #dc8b6e;
7575

7676
a {
@@ -103,12 +103,12 @@ body {
103103
height: 50px;
104104
border: 2px solid white;
105105

106-
.rag &.bot {
106+
.blog &.bot {
107107
outline: 1px solid #ffdacc;
108108
background: #ffdacc;
109109
}
110110

111-
.rag &.user {
111+
.blog &.user {
112112
outline: 1px solid #fffad1;
113113
background: #fffad1;
114114
}
@@ -141,7 +141,7 @@ body {
141141

142142
#welcome {
143143
h4 {
144-
.rag & {
144+
.blog & {
145145
color: #f97b62;
146146
}
147147

@@ -152,7 +152,7 @@ body {
152152
}
153153

154154
#chat-reset, #chat-submit {
155-
.rag &:hover {
155+
.blog &:hover {
156156
background: #f97b62;
157157
border-color: #f97b62;
158158
}

config/packages/llm_chain.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ llm_chain:
1616
openai:
1717
api_key: '%env(OPENAI_API_KEY)%'
1818
chain:
19-
rag:
19+
blog:
2020
# platform: 'llm_chain.platform.anthropic'
2121
model:
2222
name: 'GPT'

config/routes.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@ index:
44
defaults:
55
template: 'index.html.twig'
66

7-
rag:
8-
path: '/rag'
7+
blog:
8+
path: '/blog'
99
controller: 'Symfony\Bundle\FrameworkBundle\Controller\TemplateController'
1010
defaults:
11-
template: 'chat/rag.html.twig'
11+
template: 'blog/chat.html.twig'
1212

1313
youtube:
1414
path: '/youtube'
1515
controller: 'Symfony\Bundle\FrameworkBundle\Controller\TemplateController'
1616
defaults:
17-
template: 'chat/youtube.html.twig'
17+
template: 'youtube/chat.html.twig'
1818

1919
wikipedia:
2020
path: '/wikipedia'
2121
controller: 'Symfony\Bundle\FrameworkBundle\Controller\TemplateController'
2222
defaults:
23-
template: 'chat/wikipedia.html.twig'
23+
template: 'wikipedia/chat.html.twig'

demo.png

11.8 KB
Loading

src/Blog/Chat/Blog.php renamed to src/Blog/Chat.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

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

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

14-
final class Blog
14+
final class Chat
1515
{
16-
private const SESSION_KEY = 'rag-chat';
16+
private const SESSION_KEY = 'blog-chat';
1717

1818
public function __construct(
1919
private readonly RequestStack $requestStack,
20-
#[Autowire(service: 'llm_chain.chain.rag')]
20+
#[Autowire(service: 'llm_chain.chain.blog')]
2121
private readonly ChainInterface $chain,
2222
) {
2323
}

src/Blog/Command/BlogEmbedCommand.php renamed to src/Blog/Command/EmbedCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
use Symfony\Component\Console\Style\SymfonyStyle;
1313

1414
#[AsCommand('app:blog:embed', description: 'Create embeddings for Symfony blog and push to ChromaDB.')]
15-
final class BlogEmbedCommand extends Command
15+
final class EmbedCommand extends Command
1616
{
1717
public function __construct(
1818
private readonly Embedder $embedder,

0 commit comments

Comments
 (0)