|
1 |
| -<div class="h-full flex flex-col"> |
2 |
| - <div class="px-6 pt-6 flex justify-between items-center"> |
3 |
| - <div class="flex items-center space-x-2"> |
| 1 | +<main class="flex flex-col"> |
| 2 | + |
| 3 | + <!-- HEADER --> |
| 4 | + <header class="px-4 lg:px-6 h-[60px] flex justify-between items-center lg:items-end"> |
| 5 | + <div class="flex items-center gap-1"> |
4 | 6 | <span>Powered by</span>
|
5 |
| - <x-icons.vector class="w-8 h-8" /> |
6 |
| - <span>Upstash Vector</span> |
| 7 | + <x-icons.vector class="size-5" /> |
| 8 | + <a href="https://upstash.com" target="_blank">Upstash Vector</span> |
7 | 9 | </div>
|
8 | 10 | <div class="flex items-center space-x-2">
|
9 | 11 | <a aria-label="GitHub" href="https://github.com/upstash/chat-with-laravel-docs/" target="_blank" class="opacity-50 hover:opacity-100 p-2">
|
10 |
| - <x-icons.github class="w-6 h-6" /> |
| 12 | + <x-icons.github class="size-6" /> |
11 | 13 | </a>
|
12 | 14 | </div>
|
13 |
| - </div> |
14 |
| - <div class="flex flex-col lg:flex-row p-6 flex-1 h-full max-h-full gap-4"> |
15 |
| - <section class="flex-1 flex flex-col border dark:border-slate-700 rounded-lg bg-white dark:bg-slate-800 shadow-lg dark:shadow-none h-full"> |
| 15 | + </header> |
| 16 | + |
| 17 | + <!-- MAIN --> |
| 18 | + <div class="lg:h-[calc(100vh-60px)] px-4 lg:p-6 grow grid grid-cols-1 lg:grid-cols-2 gap-4 lg:gap-6"> |
| 19 | + |
| 20 | + <!-- CHAT --> |
| 21 | + <section class="lg:h-full overflow-hidden grid grid-rows-[auto_1fr_auto] border dark:border-slate-700 rounded-lg bg-white dark:bg-slate-800 shadow-md dark:shadow-none"> |
16 | 22 | <div class="border-b dark:border-slate-700 p-6">
|
17 | 23 | <h1 class="font-semibold">Chat</h1>
|
18 | 24 | <p class="text-sm opacity-50">Ask a question to the Laravel 12.x documentation</p>
|
19 | 25 | </div>
|
20 |
| - <div class="p-6 flex-1 overflow-scroll space-y-6"> |
| 26 | + |
| 27 | + <div class="p-6 space-y-6 overflow-y-scroll min-h-[200px] max-h-[400px] lg:min-h-full lg:max-h-auto"> |
21 | 28 | @foreach ($chat as $message)
|
22 | 29 | @if ($message['role'] === 'user')
|
23 | 30 | <div class="flex justify-end ml-4">
|
|
33 | 40 | <div class="rounded-lg bg-gray-100 dark:bg-slate-600 px-3 py-2 text-sm markdown">{!! $message['content'] !!}</div>
|
34 | 41 | @if (isset($message['sources']) && count($message['sources']) > 0)
|
35 | 42 | <div class="pt-4">
|
36 |
| - <h3 class="pb-2 text-xs">Sources</h3> |
| 43 | + <h3 class="pb-2 text-xs">Sources</h3> |
37 | 44 | <ul class="flex flex-col space-y-3">
|
38 | 45 | @foreach ($message['sources'] as $source)
|
39 | 46 | <li><a class="text-xs rounded-lg bg-gray-100 dark:bg-slate-600 px-2 py-2" href="{{ $source }}">{{ $source }}</a></li>
|
40 | 47 | @endforeach
|
41 | 48 | </ul>
|
42 |
| - </div> |
| 49 | + </div> |
43 | 50 | @endif
|
44 | 51 | </div>
|
45 | 52 | </div>
|
|
54 | 61 | </div>
|
55 | 62 | @endif
|
56 | 63 | </div>
|
| 64 | + |
57 | 65 | <div class="p-6 border-t dark:border-slate-700">
|
58 |
| - <form wire:submit="askQuestion"> |
59 |
| - <input wire:loading.attr="disabled" autofocus wire:model="question" type="text" placeholder="Write a question here and we will try to figure how the best way to answer that." class="border bg-white dark:bg-slate-700 dark:border-slate-600 rounded-lg w-full py-2 px-3 focus:ring focus:ring-orange-500 focus:outline-none"> |
60 |
| - <div class="flex justify-end pt-4"> |
61 |
| - <button wire:loading.attr="disabled" class="border bg-gray-50 hover:bg-gray-100 dark:border-slate-600 dark:bg-slate-700 dark:hover:bg-slate-600 focus:ring focus:ring-orange-500 focus:outline-none rounded-lg px-4 py-1.5">Send Question</button> |
62 |
| - </div> |
| 66 | + <form wire:submit="askQuestion" class="flex items-center gap-4"> |
| 67 | + <input wire:loading.attr="disabled" autofocus wire:model="question" type="text" placeholder="Write a question here and we will try to figure how the best way to answer that." |
| 68 | + class="border bg-white dark:bg-slate-700 dark:border-slate-600 rounded-lg w-full py-2 px-3 focus:ring focus:ring-orange-500 focus:outline-none"> |
| 69 | + <button wire:loading.attr="disabled" |
| 70 | + class="py-2 px-3 border bg-gray-50 hover:bg-gray-100 dark:border-slate-600 dark:bg-slate-700 dark:hover:bg-slate-600 focus:ring focus:ring-orange-500 focus:outline-none rounded-lg"> |
| 71 | + Send</button> |
63 | 72 | </form>
|
64 | 73 | </div>
|
65 | 74 | </section>
|
66 |
| - <section class="flex-1 flex flex-col border dark:border-slate-700 rounded-lg bg-white dark:bg-slate-800 shadow-lg h-full"> |
67 |
| - <div class="border-b dark:border-slate-700 p-6 flex justify-between items-center"> |
68 |
| - <div> |
| 75 | + |
| 76 | + <!-- DEBUG --> |
| 77 | + <section class="lg:h-full overflow-hidden flex flex-col border dark:border-slate-700 rounded-lg bg-white dark:bg-slate-800 shadow-md"> |
| 78 | + <div class="relative border-b dark:border-slate-700 p-6"> |
69 | 79 | <h1 class="font-semibold">Debug Context</h1>
|
70 | 80 | <p class="text-sm opacity-50">See what parts of the documentation were fetched from our vector database</p>
|
71 |
| - </div> |
72 |
| - <div class="flex items-center"> |
73 |
| - <input type="checkbox" wire:model="useReranker" class="rounded-lg border-gray-300 dark:border-slate-600 accent-orange-600"> |
74 |
| - <label class="ml-2 text-sm dark:text-slate-400">Use Reranker</label> |
75 |
| - </div> |
| 81 | + <label class="absolute right-6 top-6 flex items-center gap-1 text-sm dark:text-slate-400"> |
| 82 | + <input type="checkbox" wire:model="useReranker" class="border-gray-300 dark:border-slate-600 accent-orange-600"> |
| 83 | + Use Reranker |
| 84 | + </label> |
76 | 85 | </div>
|
77 |
| - <div class="overflow-y-scroll flex-1 flex flex-col space-y-6 divide-y dark:divide-slate-700"> |
| 86 | + |
| 87 | + <div class="overflow-y-scroll grow flex flex-col divide-y dark:divide-slate-700"> |
78 | 88 | @foreach ($context as $item)
|
79 | 89 | <div class="p-6">
|
80 | 90 | <x-markdown class="markdown" :highlight-code="false">{!! $item['text'] !!}</x-markdown>
|
81 | 91 | <div class="pt-6">
|
82 |
| - <h3 class="font-semibold pb-2 text-sm">Sources</h3> |
| 92 | + <h3 class="font-semibold pb-2 text-xs opacity-50 uppercase">Sources</h3> |
83 | 93 | <ul>
|
84 | 94 | @foreach ($item['sources'] as $source)
|
85 |
| - <li><a class="text-xs rounded-lg bg-gray-50 dark:bg-slate-600 px-2 py-1" href="{{ $source }}">{{ $source }}</a></li> |
| 95 | + <li><a class="rounded-lg dark:bg-slate-600 underline" href="{{ $source }}">{{ $source }}</a></li> |
86 | 96 | @endforeach
|
87 | 97 | </div>
|
88 | 98 | </div>
|
89 | 99 | @endforeach
|
90 | 100 | </div>
|
91 | 101 | </section>
|
92 | 102 | </div>
|
93 |
| -</div> |
| 103 | +</main> |
0 commit comments