Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
open-webui
Commits
0318fda9
Commit
0318fda9
authored
Feb 16, 2024
by
Timothy J. Baek
Browse files
fix: disable empty edited response content
parent
402dc3b9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
13 deletions
+19
-13
src/lib/components/chat/Messages/ResponseMessage.svelte
src/lib/components/chat/Messages/ResponseMessage.svelte
+19
-13
No files found.
src/lib/components/chat/Messages/ResponseMessage.svelte
View file @
0318fda9
...
@@ -239,6 +239,10 @@
...
@@ -239,6 +239,10 @@
};
};
const editMessageConfirmHandler = async () => {
const editMessageConfirmHandler = async () => {
if (editedContent === '') {
editedContent = ' ';
}
confirmEditResponseMessage(message.id, editedContent);
confirmEditResponseMessage(message.id, editedContent);
edit = false;
edit = false;
...
@@ -284,7 +288,7 @@
...
@@ -284,7 +288,7 @@
<Skeleton />
<Skeleton />
{:else}
{:else}
<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 dark:prose-invert prose-headings:my-0 prose-p:my-0 prose-p:-mb-
6
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"
>
>
<div>
<div>
{#if edit === true}
{#if edit === true}
...
@@ -361,11 +365,13 @@
...
@@ -361,11 +365,13 @@
{/if}
{/if}
{#if message.done}
{#if message.done}
<div class=" flex justify-start space-x-1 -mt-2 overflow-x-auto buttons">
<div
class=" flex justify-start space-x-1 overflow-x-auto buttons text-gray-700 dark:text-gray-500"
>
{#if siblings.length > 1}
{#if siblings.length > 1}
<div class="flex self-center min-w-fit">
<div class="flex self-center min-w-fit">
<button
<button
class="self-center"
class="self-center
dark:hover:text-white hover:text-black transition
"
on:click={() => {
on:click={() => {
showPreviousMessage(message);
showPreviousMessage(message);
}}
}}
...
@@ -384,12 +390,12 @@
...
@@ -384,12 +390,12 @@
</svg>
</svg>
</button>
</button>
<div class="text-xs font-bold self-center min-w-fit">
<div class="text-xs font-bold self-center min-w-fit
dark:text-gray-100
">
{siblings.indexOf(message.id) + 1} / {siblings.length}
{siblings.indexOf(message.id) + 1} / {siblings.length}
</div>
</div>
<button
<button
class="self-center"
class="self-center
dark:hover:text-white hover:text-black transition
"
on:click={() => {
on:click={() => {
showNextMessage(message);
showNextMessage(message);
}}
}}
...
@@ -413,7 +419,7 @@
...
@@ -413,7 +419,7 @@
<button
<button
class="{isLastMessage
class="{isLastMessage
? 'visible'
? 'visible'
: 'invisible group-hover:visible'} p-1 rounded dark:hover:text-white transition"
: 'invisible group-hover:visible'} p-1 rounded dark:hover:text-white
hover:text-black
transition"
on:click={() => {
on:click={() => {
editMessageHandler();
editMessageHandler();
}}
}}
...
@@ -437,7 +443,7 @@
...
@@ -437,7 +443,7 @@
<button
<button
class="{isLastMessage
class="{isLastMessage
? 'visible'
? 'visible'
: 'invisible group-hover:visible'} p-1 rounded dark:hover:text-white transition copy-response-button"
: 'invisible group-hover:visible'} p-1 rounded dark:hover:text-white
hover:text-black
transition copy-response-button"
on:click={() => {
on:click={() => {
copyToClipboard(message.content);
copyToClipboard(message.content);
}}
}}
...
@@ -463,7 +469,7 @@
...
@@ -463,7 +469,7 @@
? 'visible'
? 'visible'
: 'invisible group-hover:visible'} p-1 rounded {message.rating === 1
: 'invisible group-hover:visible'} p-1 rounded {message.rating === 1
? 'bg-gray-100 dark:bg-gray-800'
? 'bg-gray-100 dark:bg-gray-800'
: ''} transition"
: ''}
dark:hover:text-white hover:text-black
transition"
on:click={() => {
on:click={() => {
rateMessage(message.id, 1);
rateMessage(message.id, 1);
}}
}}
...
@@ -487,7 +493,7 @@
...
@@ -487,7 +493,7 @@
? 'visible'
? 'visible'
: 'invisible group-hover:visible'} p-1 rounded {message.rating === -1
: 'invisible group-hover:visible'} p-1 rounded {message.rating === -1
? 'bg-gray-100 dark:bg-gray-800'
? 'bg-gray-100 dark:bg-gray-800'
: ''} transition"
: ''}
dark:hover:text-white hover:text-black
transition"
on:click={() => {
on:click={() => {
rateMessage(message.id, -1);
rateMessage(message.id, -1);
}}
}}
...
@@ -511,7 +517,7 @@
...
@@ -511,7 +517,7 @@
id="speak-button-{message.id}"
id="speak-button-{message.id}"
class="{isLastMessage
class="{isLastMessage
? 'visible'
? 'visible'
: 'invisible group-hover:visible'} p-1 rounded dark:hover:text-white transition"
: 'invisible group-hover:visible'} p-1 rounded dark:hover:text-white
hover:text-black
transition"
on:click={() => {
on:click={() => {
if (!loadingSpeech) {
if (!loadingSpeech) {
toggleSpeakMessage(message);
toggleSpeakMessage(message);
...
@@ -585,7 +591,7 @@
...
@@ -585,7 +591,7 @@
<button
<button
class=" {isLastMessage
class=" {isLastMessage
? 'visible'
? 'visible'
: 'invisible group-hover:visible'} p-1 rounded dark:hover:text-white transition whitespace-pre-wrap"
: 'invisible group-hover:visible'} p-1 rounded dark:hover:text-white
hover:text-black
transition whitespace-pre-wrap"
on:click={() => {
on:click={() => {
console.log(message);
console.log(message);
}}
}}
...
@@ -613,7 +619,7 @@
...
@@ -613,7 +619,7 @@
type="button"
type="button"
class="{isLastMessage
class="{isLastMessage
? 'visible'
? 'visible'
: 'invisible group-hover:visible'} p-1 rounded dark:hover:text-white transition regenerate-response-button"
: 'invisible group-hover:visible'} p-1 rounded dark:hover:text-white
hover:text-black
transition regenerate-response-button"
on:click={() => {
on:click={() => {
continueGeneration();
continueGeneration();
}}
}}
...
@@ -643,7 +649,7 @@
...
@@ -643,7 +649,7 @@
type="button"
type="button"
class="{isLastMessage
class="{isLastMessage
? 'visible'
? 'visible'
: 'invisible group-hover:visible'} p-1 rounded dark:hover:text-white transition regenerate-response-button"
: 'invisible group-hover:visible'} p-1 rounded dark:hover:text-white
hover:text-black
transition regenerate-response-button"
on:click={regenerateResponse}
on:click={regenerateResponse}
>
>
<svg
<svg
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment