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
c52cc46d
"docs/vscode:/vscode.git/clone" did not exist on "eea33e1a2cc7b24ef5a2eecebe1963757dc70207"
Commit
c52cc46d
authored
Apr 04, 2024
by
Danny Liu
Browse files
feat: initial avatar set to first letter of firstname, first letter of lastname
parent
a2bd9b86
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
src/lib/utils/index.ts
src/lib/utils/index.ts
+4
-4
No files found.
src/lib/utils/index.ts
View file @
c52cc46d
...
@@ -109,10 +109,10 @@ export const generateInitialsImage = (name) => {
...
@@ -109,10 +109,10 @@ export const generateInitialsImage = (name) => {
ctx
.
font
=
'
40px Helvetica
'
;
ctx
.
font
=
'
40px Helvetica
'
;
ctx
.
textAlign
=
'
center
'
;
ctx
.
textAlign
=
'
center
'
;
ctx
.
textBaseline
=
'
middle
'
;
ctx
.
textBaseline
=
'
middle
'
;
const
i
nitial
s
=
name
const
firstNameI
nitial
=
name
[
0
];
.
split
(
'
'
)
const
lastNameInitial
=
name
.
lastIndexOf
(
'
'
)
>
-
1
?
name
[
name
.
lastIndexOf
(
'
'
)
+
1
]
:
''
;
.
map
((
word
)
=>
word
[
0
]
)
const
initials
=
`
${
firstNameInitial
}${
lastNameInitial
}
`
.
toUpperCase
(
)
.
join
(
''
);
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
();
...
...
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