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
950231ac
Unverified
Commit
950231ac
authored
Jun 01, 2024
by
Timothy Jaeryang Baek
Committed by
GitHub
Jun 01, 2024
Browse files
Merge pull request #2699 from cheahjs/feat/error-message-separate
refac: error message separate from content
parents
37302519
78b279ca
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
37 deletions
+36
-37
src/lib/components/chat/Chat.svelte
src/lib/components/chat/Chat.svelte
+14
-16
src/lib/components/chat/Messages/ResponseMessage.svelte
src/lib/components/chat/Messages/ResponseMessage.svelte
+22
-21
No files found.
src/lib/components/chat/Chat.svelte
View file @
950231ac
...
...
@@ -680,9 +680,10 @@
responseMessage.done = true;
if (responseMessage.content == '') {
responseMessage.error = true;
responseMessage.content =
'Oops! No text generated from Ollama, Please try again.';
responseMessage.error = {
code: 400,
content: `Oops! No text generated from Ollama, Please try again.`
};
}
responseMessage.context = data.context ?? null;
...
...
@@ -754,24 +755,21 @@
console.log(error);
if ('detail' in error) {
toast.error(error.detail);
responseMessage.content
=
error.detail;
responseMessage.
error = {
content
:
error.detail
}
;
} else {
toast.error(error.error);
responseMessage.content
=
error.error;
responseMessage.
error = {
content
:
error.error
}
;
}
} else {
toast.error(
$i18n.t(`Uh-oh! There was an issue connecting to {{provider}}.`, { provider: 'Ollama' })
);
responseMessage.content = $i18n.t(`Uh-oh! There was an issue connecting to {{provider}}.`, {
responseMessage.error = {
content: $i18n.t(`Uh-oh! There was an issue connecting to {{provider}}.`, {
provider: 'Ollama'
});
})
};
}
responseMessage.error = true;
responseMessage.content = $i18n.t(`Uh-oh! There was an issue connecting to {{provider}}.`, {
provider: 'Ollama'
});
responseMessage.done = true;
messages = messages;
}
...
...
@@ -1035,13 +1033,13 @@
errorMessage = innerError.message;
}
responseMessage.error = true;
responseMessage.content =
$i18n.t(`Uh-oh! There was an issue connecting to {{provider}}.`, {
responseMessage.error = {
content: $i18n.t(`Uh-oh! There was an issue connecting to {{provider}}.`, {
provider: model.name ?? model.id
}) +
'
\
n
' +
errorMessage;
};
responseMessage.done = true;
messages = messages;
...
...
src/lib/components/chat/Messages/ResponseMessage.svelte
View file @
950231ac
...
...
@@ -451,7 +451,27 @@
</div>
{:else}
<div class="w-full">
{#if message?.error === true}
{#if message.content === '' && !message.error}
<Skeleton />
{:else if !message.error}
{#each tokens as token, tokenIdx}
{#if token.type === 'code'}
<CodeBlock
id={`${message.id}-${tokenIdx}`}
lang={token?.lang ?? ''}
code={revertSanitizedResponseContent(token?.text ?? '')}
/>
{:else}
{@html marked.parse(token.raw, {
...defaults,
gfm: true,
breaks: true,
renderer
})}
{/if}
{/each}
{/if}
{#if message.error}
<div
class="flex mt-2 mb-4 space-x-2 border px-4 py-3 border-red-800 bg-red-800/30 font-medium rounded-lg"
>
...
...
@@ -471,28 +491,9 @@
</svg>
<div class=" self-center">
{message.content}
{
message?.error?.content ??
message.content}
</div>
</div>
{:else if message.content === ''}
<Skeleton />
{:else}
{#each tokens as token, tokenIdx}
{#if token.type === 'code'}
<CodeBlock
id={`${message.id}-${tokenIdx}`}
lang={token?.lang ?? ''}
code={revertSanitizedResponseContent(token?.text ?? '')}
/>
{:else}
{@html marked.parse(token.raw, {
...defaults,
gfm: true,
breaks: true,
renderer
})}
{/if}
{/each}
{/if}
{#if message.citations}
...
...
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