forked from open-webui/open-webui
feat: use local profile image by default
This commit is contained in:
parent
3ce8f3e8fb
commit
0c322063b5
4 changed files with 72 additions and 31 deletions
23
src/lib/apis/utils/index.ts
Normal file
23
src/lib/apis/utils/index.ts
Normal file
|
@ -0,0 +1,23 @@
|
|||
import { WEBUI_API_BASE_URL } from '$lib/constants';
|
||||
|
||||
export const getGravatarUrl = async (email: string) => {
|
||||
let error = null;
|
||||
|
||||
const res = await fetch(`${WEBUI_API_BASE_URL}/utils/gravatar?email=${email}`, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
})
|
||||
.then(async (res) => {
|
||||
if (!res.ok) throw await res.json();
|
||||
return res.json();
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
error = err;
|
||||
return null;
|
||||
});
|
||||
|
||||
return res;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue