|
1 | | -{% import "_message.html.twig" as message %} |
| 1 | +{% import "_message.html.twig" as msg %} |
2 | 2 |
|
3 | 3 | <div class="card mx-auto shadow-lg" {{ attributes.defaults(stimulus_controller('audio')) }}> |
4 | 4 | <div class="card-header p-2"> |
|
8 | 8 | </div> |
9 | 9 | <div id="chat-body" class="card-body p-4 overflow-auto"> |
10 | 10 | {% for message in this.messages %} |
11 | | - {% include '_message.html.twig' with { message, latest: loop.last } %} |
| 11 | + {% if 'user' == message.role.value %} |
| 12 | + {% include '_message.html.twig' with { message, latest: loop.last } %} |
| 13 | + {% else %} |
| 14 | + <div class="d-flex align-items-baseline mb-4"> |
| 15 | + <div class="bot avatar rounded-3 shadow-sm"> |
| 16 | + {{ ux_icon('fluent:bot-24-filled', { height: '45px', width: '45px' }) }} |
| 17 | + </div> |
| 18 | + <div class="ps-2"> |
| 19 | + <audio class="pt-3" controls {{ loop.last ? 'autoplay' }} src="{{ message.metadata.get('audio') }}"></audio> |
| 20 | + </div> |
| 21 | + </div> |
| 22 | + {% endif %} |
12 | 23 | {% else %} |
13 | 24 | <div id="welcome" class="text-center mt-5 py-5 bg-white rounded-5 shadow-sm w-75 mx-auto"> |
14 | 25 | {{ ux_icon('iconoir:microphone-solid', { height: '200px', width: '200px' }) }} |
|
17 | 28 | </div> |
18 | 29 | {% endfor %} |
19 | 30 | <div id="loading-message" class="d-none"> |
20 | | - {{ message.user([{text:'Converting your speech to text ...'}], true) }} |
21 | | - {{ message.bot('The Bot is looking for an answer ...', true) }} |
| 31 | + {{ msg.user([{text:'Converting your speech to text ...'}], true) }} |
| 32 | + {{ msg.bot('The Bot is looking for an answer ...', true) }} |
22 | 33 | </div> |
23 | 34 | </div> |
24 | 35 | <div class="card-footer p-2 text-center"> |
|
0 commit comments