|
@@ -55,48 +55,19 @@
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<div class=" flex w-full">
|
|
<div class=" flex w-full">
|
|
- <ProfileImage
|
|
|
|
- src={message.user
|
|
|
|
- ? $modelfiles.find((modelfile) => modelfile.tagName === message.user)?.imageUrl ?? '/user.png'
|
|
|
|
- : user?.profile_image_url ?? '/user.png'}
|
|
|
|
- />
|
|
|
|
-
|
|
|
|
<div class="w-full overflow-hidden">
|
|
<div class="w-full overflow-hidden">
|
|
- <div class="user-message">
|
|
|
|
- <Name>
|
|
|
|
- {#if message.user}
|
|
|
|
- {#if $modelfiles.map((modelfile) => modelfile.tagName).includes(message.user)}
|
|
|
|
- {$modelfiles.find((modelfile) => modelfile.tagName === message.user)?.title}
|
|
|
|
- {:else}
|
|
|
|
- {$i18n.t('You')}
|
|
|
|
- <span class=" text-gray-500 text-sm font-medium">{message?.user ?? ''}</span>
|
|
|
|
- {/if}
|
|
|
|
- {:else if $settings.showUsername}
|
|
|
|
- {user.name}
|
|
|
|
- {:else}
|
|
|
|
- {$i18n.t('You')}
|
|
|
|
- {/if}
|
|
|
|
-
|
|
|
|
- {#if message.timestamp}
|
|
|
|
- <span class=" invisible group-hover:visible text-gray-400 text-xs font-medium">
|
|
|
|
- {dayjs(message.timestamp * 1000).format($i18n.t('DD/MM/YYYY HH:mm'))}
|
|
|
|
- </span>
|
|
|
|
- {/if}
|
|
|
|
- </Name>
|
|
|
|
- </div>
|
|
|
|
-
|
|
|
|
<div
|
|
<div
|
|
- class="prose chat-{message.role} w-full max-w-full dark:prose-invert prose-headings:my-0 prose-p:my-0 prose-p:-mb-4 prose-pre:my-0 prose-table:my-0 prose-blockquote:my-0 prose-img:my-0 prose-ul:-my-4 prose-ol:-my-4 prose-li:-my-3 prose-ul:-mb-6 prose-ol:-mb-6 prose-li:-mb-4 whitespace-pre-line"
|
|
|
|
|
|
+ class="prose chat-{message.role} w-full max-w-full flex flex-col justify-end dark:prose-invert prose-headings:my-0 prose-p:my-0 prose-p:-mb-4 prose-pre:my-0 prose-table:my-0 prose-blockquote:my-0 prose-img:my-0 prose-ul:-my-4 prose-ol:-my-4 prose-li:-my-3 prose-ul:-mb-6 prose-ol:-mb-6 prose-li:-mb-4 whitespace-pre-line"
|
|
>
|
|
>
|
|
{#if message.files}
|
|
{#if message.files}
|
|
- <div class="my-2.5 w-full flex overflow-x-auto gap-2 flex-wrap">
|
|
|
|
|
|
+ <div class="mt-2.5 mb-1 w-full flex justify-end overflow-x-auto gap-2 flex-wrap">
|
|
{#each message.files as file}
|
|
{#each message.files as file}
|
|
<div>
|
|
<div>
|
|
{#if file.type === 'image'}
|
|
{#if file.type === 'image'}
|
|
<img src={file.url} alt="input" class=" max-h-96 rounded-lg" draggable="false" />
|
|
<img src={file.url} alt="input" class=" max-h-96 rounded-lg" draggable="false" />
|
|
{:else if file.type === 'doc'}
|
|
{:else if file.type === 'doc'}
|
|
<button
|
|
<button
|
|
- class="h-16 w-[15rem] flex items-center space-x-3 px-2.5 dark:bg-gray-600 rounded-xl border border-gray-200 dark:border-none text-left"
|
|
|
|
|
|
+ class="h-16 w-72 flex items-center space-x-3 px-2.5 dark:bg-gray-850 rounded-xl border border-gray-200 dark:border-none text-left"
|
|
type="button"
|
|
type="button"
|
|
on:click={() => {
|
|
on:click={() => {
|
|
if (file?.url) {
|
|
if (file?.url) {
|
|
@@ -132,7 +103,7 @@
|
|
</button>
|
|
</button>
|
|
{:else if file.type === 'collection'}
|
|
{:else if file.type === 'collection'}
|
|
<button
|
|
<button
|
|
- class="h-16 w-[15rem] flex items-center space-x-3 px-2.5 dark:bg-gray-600 rounded-xl border border-gray-200 dark:border-none text-left"
|
|
|
|
|
|
+ class="h-16 w-72 flex items-center space-x-3 px-2.5 dark:bg-gray-600 rounded-xl border border-gray-200 dark:border-none text-left"
|
|
type="button"
|
|
type="button"
|
|
>
|
|
>
|
|
<div class="p-2.5 bg-red-400 text-white rounded-lg">
|
|
<div class="p-2.5 bg-red-400 text-white rounded-lg">
|
|
@@ -166,7 +137,7 @@
|
|
{/if}
|
|
{/if}
|
|
|
|
|
|
{#if edit === true}
|
|
{#if edit === true}
|
|
- <div class=" w-full">
|
|
|
|
|
|
+ <div class=" w-full bg-gray-800 rounded-3xl px-5 py-3 mb-2">
|
|
<textarea
|
|
<textarea
|
|
id="message-edit-{message.id}"
|
|
id="message-edit-{message.id}"
|
|
bind:this={messageEditTextAreaElement}
|
|
bind:this={messageEditTextAreaElement}
|
|
@@ -190,81 +161,41 @@
|
|
}}
|
|
}}
|
|
/>
|
|
/>
|
|
|
|
|
|
- <div class=" mt-2 mb-1 flex justify-center space-x-2 text-sm font-medium">
|
|
|
|
|
|
+ <div class=" mt-2 mb-1 flex justify-end space-x-1.5 text-sm font-medium">
|
|
<button
|
|
<button
|
|
- id="save-edit-message-button"
|
|
|
|
- class="px-4 py-2 bg-emerald-700 hover:bg-emerald-800 text-gray-100 transition rounded-lg"
|
|
|
|
|
|
+ id="close-edit-message-button"
|
|
|
|
+ class=" px-4 py-2 bg-gray-900 hover:bg-gray-850 text-gray-100 transition rounded-3xl"
|
|
on:click={() => {
|
|
on:click={() => {
|
|
- editMessageConfirmHandler();
|
|
|
|
|
|
+ cancelEditMessage();
|
|
}}
|
|
}}
|
|
>
|
|
>
|
|
- {$i18n.t('Save & Submit')}
|
|
|
|
|
|
+ {$i18n.t('Cancel')}
|
|
</button>
|
|
</button>
|
|
|
|
|
|
<button
|
|
<button
|
|
- id="close-edit-message-button"
|
|
|
|
- class=" px-4 py-2 hover:bg-gray-100 dark:bg-gray-800 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-100 transition outline outline-1 outline-gray-200 dark:outline-gray-600 rounded-lg"
|
|
|
|
|
|
+ id="save-edit-message-button"
|
|
|
|
+ class="px-4 py-2 bg-white hover:bg-gray-100 text-gray-800 transition rounded-3xl"
|
|
on:click={() => {
|
|
on:click={() => {
|
|
- cancelEditMessage();
|
|
|
|
|
|
+ editMessageConfirmHandler();
|
|
}}
|
|
}}
|
|
>
|
|
>
|
|
- {$i18n.t('Cancel')}
|
|
|
|
|
|
+ {$i18n.t('Send')}
|
|
</button>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{:else}
|
|
{:else}
|
|
<div class="w-full">
|
|
<div class="w-full">
|
|
- <pre id="user-message">{message.content}</pre>
|
|
|
|
-
|
|
|
|
- <div class=" flex justify-start space-x-1 text-gray-700 dark:text-gray-500">
|
|
|
|
- {#if siblings.length > 1}
|
|
|
|
- <div class="flex self-center">
|
|
|
|
- <button
|
|
|
|
- class="self-center dark:hover:text-white hover:text-black transition"
|
|
|
|
- on:click={() => {
|
|
|
|
- showPreviousMessage(message);
|
|
|
|
- }}
|
|
|
|
- >
|
|
|
|
- <svg
|
|
|
|
- xmlns="http://www.w3.org/2000/svg"
|
|
|
|
- viewBox="0 0 20 20"
|
|
|
|
- fill="currentColor"
|
|
|
|
- class="w-4 h-4"
|
|
|
|
- >
|
|
|
|
- <path
|
|
|
|
- fill-rule="evenodd"
|
|
|
|
- d="M12.79 5.23a.75.75 0 01-.02 1.06L8.832 10l3.938 3.71a.75.75 0 11-1.04 1.08l-4.5-4.25a.75.75 0 010-1.08l4.5-4.25a.75.75 0 011.06.02z"
|
|
|
|
- clip-rule="evenodd"
|
|
|
|
- />
|
|
|
|
- </svg>
|
|
|
|
- </button>
|
|
|
|
-
|
|
|
|
- <div class="text-xs font-bold self-center dark:text-gray-100">
|
|
|
|
- {siblings.indexOf(message.id) + 1} / {siblings.length}
|
|
|
|
- </div>
|
|
|
|
-
|
|
|
|
- <button
|
|
|
|
- class="self-center dark:hover:text-white hover:text-black transition"
|
|
|
|
- on:click={() => {
|
|
|
|
- showNextMessage(message);
|
|
|
|
- }}
|
|
|
|
- >
|
|
|
|
- <svg
|
|
|
|
- xmlns="http://www.w3.org/2000/svg"
|
|
|
|
- viewBox="0 0 20 20"
|
|
|
|
- fill="currentColor"
|
|
|
|
- class="w-4 h-4"
|
|
|
|
- >
|
|
|
|
- <path
|
|
|
|
- fill-rule="evenodd"
|
|
|
|
- d="M7.21 14.77a.75.75 0 01.02-1.06L11.168 10 7.23 6.29a.75.75 0 111.04-1.08l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 01-1.06-.02z"
|
|
|
|
- clip-rule="evenodd"
|
|
|
|
- />
|
|
|
|
- </svg>
|
|
|
|
- </button>
|
|
|
|
- </div>
|
|
|
|
- {/if}
|
|
|
|
|
|
+ <div class="flex justify-end mb-2">
|
|
|
|
+ <div
|
|
|
|
+ class="rounded-3xl px-5 py-2 max-w-[90%] bg-gray-850 {message.files
|
|
|
|
+ ? 'rounded-tr-lg'
|
|
|
|
+ : ''}"
|
|
|
|
+ >
|
|
|
|
+ <pre id="user-message">{message.content}</pre>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
|
|
|
|
+ <div class=" flex justify-end space-x-1 text-gray-700 dark:text-gray-500">
|
|
{#if !readOnly}
|
|
{#if !readOnly}
|
|
<Tooltip content={$i18n.t('Edit')} placement="bottom">
|
|
<Tooltip content={$i18n.t('Edit')} placement="bottom">
|
|
<button
|
|
<button
|
|
@@ -340,6 +271,53 @@
|
|
</button>
|
|
</button>
|
|
</Tooltip>
|
|
</Tooltip>
|
|
{/if}
|
|
{/if}
|
|
|
|
+ {#if siblings.length > 1}
|
|
|
|
+ <div class="flex self-center">
|
|
|
|
+ <button
|
|
|
|
+ class="self-center dark:hover:text-white hover:text-black transition"
|
|
|
|
+ on:click={() => {
|
|
|
|
+ showPreviousMessage(message);
|
|
|
|
+ }}
|
|
|
|
+ >
|
|
|
|
+ <svg
|
|
|
|
+ xmlns="http://www.w3.org/2000/svg"
|
|
|
|
+ viewBox="0 0 20 20"
|
|
|
|
+ fill="currentColor"
|
|
|
|
+ class="w-4 h-4"
|
|
|
|
+ >
|
|
|
|
+ <path
|
|
|
|
+ fill-rule="evenodd"
|
|
|
|
+ d="M12.79 5.23a.75.75 0 01-.02 1.06L8.832 10l3.938 3.71a.75.75 0 11-1.04 1.08l-4.5-4.25a.75.75 0 010-1.08l4.5-4.25a.75.75 0 011.06.02z"
|
|
|
|
+ clip-rule="evenodd"
|
|
|
|
+ />
|
|
|
|
+ </svg>
|
|
|
|
+ </button>
|
|
|
|
+
|
|
|
|
+ <div class="text-xs font-bold self-center dark:text-gray-100">
|
|
|
|
+ {siblings.indexOf(message.id) + 1} / {siblings.length}
|
|
|
|
+ </div>
|
|
|
|
+
|
|
|
|
+ <button
|
|
|
|
+ class="self-center dark:hover:text-white hover:text-black transition"
|
|
|
|
+ on:click={() => {
|
|
|
|
+ showNextMessage(message);
|
|
|
|
+ }}
|
|
|
|
+ >
|
|
|
|
+ <svg
|
|
|
|
+ xmlns="http://www.w3.org/2000/svg"
|
|
|
|
+ viewBox="0 0 20 20"
|
|
|
|
+ fill="currentColor"
|
|
|
|
+ class="w-4 h-4"
|
|
|
|
+ >
|
|
|
|
+ <path
|
|
|
|
+ fill-rule="evenodd"
|
|
|
|
+ d="M7.21 14.77a.75.75 0 01.02-1.06L11.168 10 7.23 6.29a.75.75 0 111.04-1.08l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 01-1.06-.02z"
|
|
|
|
+ clip-rule="evenodd"
|
|
|
|
+ />
|
|
|
|
+ </svg>
|
|
|
|
+ </button>
|
|
|
|
+ </div>
|
|
|
|
+ {/if}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{/if}
|
|
{/if}
|