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
5262156c
Commit
5262156c
authored
Dec 13, 2023
by
Timothy J. Baek
Browse files
feat: error handling for when ollama is not running
parent
93cffa89
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
18 deletions
+32
-18
src/routes/(app)/+page.svelte
src/routes/(app)/+page.svelte
+16
-9
src/routes/(app)/c/[id]/+page.svelte
src/routes/(app)/c/[id]/+page.svelte
+16
-9
No files found.
src/routes/(app)/+page.svelte
View file @
5262156c
...
...
@@ -189,17 +189,12 @@
},
format: $settings.requestFormat ?? undefined
})
}).catch((err) => {
console.log(err);
return null;
});
if (!res.ok) {
const error = await res.json();
console.log(error);
if ('detail' in error) {
toast.error(error.detail);
} else {
toast.error(error.error);
}
} else {
if (res && res.ok) {
const reader = res.body
.pipeThrough(new TextDecoderStream())
.pipeThrough(splitStream('\n'))
...
...
@@ -275,6 +270,18 @@
history: history
});
}
} else {
if (res !== null) {
const error = await res.json();
console.log(error);
if ('detail' in error) {
toast.error(error.detail);
} else {
toast.error(error.error);
}
} else {
toast.error(`Uh-oh! There was an issue connecting to Ollama.`);
}
}
stopResponseFlag = false;
...
...
src/routes/(app)/c/[id]/+page.svelte
View file @
5262156c
...
...
@@ -216,17 +216,12 @@
},
format: $settings.requestFormat ?? undefined
})
}).catch((err) => {
console.log(err);
return null;
});
if (!res.ok) {
const error = await res.json();
console.log(error);
if ('detail' in error) {
toast.error(error.detail);
} else {
toast.error(error.error);
}
} else {
if (res && res.ok) {
const reader = res.body
.pipeThrough(new TextDecoderStream())
.pipeThrough(splitStream('\n'))
...
...
@@ -302,6 +297,18 @@
history: history
});
}
} else {
if (res !== null) {
const error = await res.json();
console.log(error);
if ('detail' in error) {
toast.error(error.detail);
} else {
toast.error(error.error);
}
} else {
toast.error(`Uh-oh! There was an issue connecting to Ollama.`);
}
}
stopResponseFlag = false;
...
...
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