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
763448bc
Unverified
Commit
763448bc
authored
Dec 13, 2023
by
Timothy Jaeryang Baek
Committed by
GitHub
Dec 13, 2023
Browse files
Merge pull request #203 from therohitdas/display-error
feat: Display error returned by ollama
parents
3e5208c1
75fb94ec
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
192 additions
and
117 deletions
+192
-117
src/lib/components/chat/Messages.svelte
src/lib/components/chat/Messages.svelte
+26
-1
src/routes/(app)/+page.svelte
src/routes/(app)/+page.svelte
+83
-58
src/routes/(app)/c/[id]/+page.svelte
src/routes/(app)/c/[id]/+page.svelte
+83
-58
No files found.
src/lib/components/chat/Messages.svelte
View file @
763448bc
...
...
@@ -655,7 +655,32 @@
</div>
{:else}
<div
class=
"w-full"
>
{#if message?.error === true}
<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"
>
<svg
xmlns=
"http://www.w3.org/2000/svg"
fill=
"none"
viewBox=
"0 0 24 24"
stroke-width=
"1.5"
stroke=
"currentColor"
class=
"w-5 h-5 self-center"
>
<path
stroke-linecap=
"round"
stroke-linejoin=
"round"
d=
"M12 9v3.75m9-.75a9 9 0 11-18 0 9 9 0 0118 0zm-9 3.75h.008v.008H12v-.008z"
/>
</svg>
<div
class=
" self-center"
>
{message.content}
</div>
</div>
{:else}
{@html marked(message.content.replace('\\\\', '\\\\\\'))}
{/if}
{#if message.done}
<div
class=
" flex justify-start space-x-1 -mt-2"
>
...
...
src/routes/(app)/+page.svelte
View file @
763448bc
...
...
@@ -189,8 +189,12 @@
},
format: $settings.requestFormat ?? undefined
})
}).catch((err) => {
console.log(err);
return null;
});
if (res && res.ok) {
const reader = res.body
.pipeThrough(new TextDecoderStream())
.pipeThrough(splitStream('\n'))
...
...
@@ -266,6 +270,27 @@
history: history
});
}
} else {
if (res !== null) {
const error = await res.json();
console.log(error);
if ('detail' in error) {
toast.error(error.detail);
responseMessage.content = error.detail;
} else {
toast.error(error.error);
responseMessage.content = error.error;
}
} else {
toast.error(`Uh-oh! There was an issue connecting to Ollama.`);
responseMessage.content = `Uh-oh! There was an issue connecting to Ollama.`;
}
responseMessage.error = true;
responseMessage.content = `Uh-oh! There was an issue connecting to Ollama.`;
responseMessage.done = true;
messages = messages;
}
stopResponseFlag = false;
await tick();
...
...
src/routes/(app)/c/[id]/+page.svelte
View file @
763448bc
...
...
@@ -216,8 +216,12 @@
},
format: $settings.requestFormat ?? undefined
})
}).catch((err) => {
console.log(err);
return null;
});
if (res && res.ok) {
const reader = res.body
.pipeThrough(new TextDecoderStream())
.pipeThrough(splitStream('\n'))
...
...
@@ -293,6 +297,27 @@
history: history
});
}
} else {
if (res !== null) {
const error = await res.json();
console.log(error);
if ('detail' in error) {
toast.error(error.detail);
responseMessage.content = error.detail;
} else {
toast.error(error.error);
responseMessage.content = error.error;
}
} else {
toast.error(`Uh-oh! There was an issue connecting to Ollama.`);
responseMessage.content = `Uh-oh! There was an issue connecting to Ollama.`;
}
responseMessage.error = true;
responseMessage.content = `Uh-oh! There was an issue connecting to Ollama.`;
responseMessage.done = true;
messages = messages;
}
stopResponseFlag = false;
await tick();
...
...
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