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
c8f7bb99
"git@developer.sourcefind.cn:modelzoo/resnet50_tensorflow.git" did not exist on "27bccda74d03bc1e9b5c4abfe5248c395c5bfafe"
Commit
c8f7bb99
authored
Apr 04, 2024
by
Danny Liu
Browse files
code style: npm run format
parent
b8790200
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
13 deletions
+19
-13
src/lib/utils/index.ts
src/lib/utils/index.ts
+19
-13
No files found.
src/lib/utils/index.ts
View file @
c8f7bb99
...
@@ -97,25 +97,31 @@ export const getGravatarURL = (email) => {
...
@@ -97,25 +97,31 @@ export const getGravatarURL = (email) => {
};
};
export
const
generateInitialsImage
=
(
name
)
=>
{
export
const
generateInitialsImage
=
(
name
)
=>
{
const
canvas
=
document
.
createElement
(
'
canvas
'
);
const
canvas
=
document
.
createElement
(
'
canvas
'
);
const
ctx
=
canvas
.
getContext
(
'
2d
'
);
const
ctx
=
canvas
.
getContext
(
'
2d
'
);
canvas
.
width
=
100
;
canvas
.
width
=
100
;
canvas
.
height
=
100
;
canvas
.
height
=
100
;
ctx
.
fillStyle
=
'
#F39C12
'
;
ctx
.
fillStyle
=
'
#F39C12
'
;
ctx
.
fillRect
(
0
,
0
,
canvas
.
width
,
canvas
.
height
);
ctx
.
fillRect
(
0
,
0
,
canvas
.
width
,
canvas
.
height
);
ctx
.
fillStyle
=
'
#FFFFFF
'
;
ctx
.
fillStyle
=
'
#FFFFFF
'
;
ctx
.
font
=
'
40px Helvetica
'
;
ctx
.
font
=
'
40px Helvetica
'
;
ctx
.
textAlign
=
'
center
'
;
ctx
.
textAlign
=
'
center
'
;
ctx
.
textBaseline
=
'
middle
'
;
ctx
.
textBaseline
=
'
middle
'
;
const
sanitizedName
=
name
.
trim
();
const
sanitizedName
=
name
.
trim
();
const
initials
=
sanitizedName
.
length
>
0
?
sanitizedName
[
0
]
+
(
sanitizedName
.
split
(
'
'
).
length
>
1
?
sanitizedName
[
sanitizedName
.
lastIndexOf
(
'
'
)
+
1
]
:
''
)
:
''
;
const
initials
=
sanitizedName
.
length
>
0
?
sanitizedName
[
0
]
+
(
sanitizedName
.
split
(
'
'
).
length
>
1
?
sanitizedName
[
sanitizedName
.
lastIndexOf
(
'
'
)
+
1
]
:
''
)
:
''
;
ctx
.
fillText
(
initials
.
toUpperCase
(),
canvas
.
width
/
2
,
canvas
.
height
/
2
);
ctx
.
fillText
(
initials
.
toUpperCase
(),
canvas
.
width
/
2
,
canvas
.
height
/
2
);
return
canvas
.
toDataURL
();
return
canvas
.
toDataURL
();
};
};
export
const
copyToClipboard
=
(
text
)
=>
{
export
const
copyToClipboard
=
(
text
)
=>
{
...
...
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