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
5a787ab2
Commit
5a787ab2
authored
Apr 06, 2024
by
Timothy J. Baek
Browse files
refac: pdf styling
parent
81dbc658
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
backend/apps/web/routers/utils.py
backend/apps/web/routers/utils.py
+3
-3
No files found.
backend/apps/web/routers/utils.py
View file @
5a787ab2
...
@@ -71,13 +71,13 @@ async def download_chat_as_pdf(
...
@@ -71,13 +71,13 @@ async def download_chat_as_pdf(
for
message
in
form_data
.
messages
:
for
message
in
form_data
.
messages
:
role
=
message
[
"role"
]
role
=
message
[
"role"
]
content
=
message
[
"content"
]
content
=
message
[
"content"
]
pdf
.
set_font
(
"NotoSans"
,
"B"
,
size
=
1
2
)
# Bold for the role
pdf
.
set_font
(
"NotoSans"
,
"B"
,
size
=
1
4
)
# Bold for the role
pdf
.
multi_cell
(
effective_page_width
,
10
,
f
"
{
role
.
upper
()
}
"
,
0
,
"L"
)
pdf
.
multi_cell
(
effective_page_width
,
10
,
f
"
{
role
.
upper
()
}
"
,
0
,
"L"
)
pdf
.
ln
(
1
)
# Extra space between messages
pdf
.
ln
(
1
)
# Extra space between messages
pdf
.
set_font
(
"NotoSans"
,
size
=
10
)
# Regular for content
pdf
.
set_font
(
"NotoSans"
,
size
=
10
)
# Regular for content
pdf
.
multi_cell
(
effective_page_width
,
10
,
content
,
0
,
"L"
)
pdf
.
multi_cell
(
effective_page_width
,
6
,
content
,
0
,
"L"
)
pdf
.
ln
(
1
)
# Extra space between messages
pdf
.
ln
(
1
.5
)
# Extra space between messages
# Save the pdf with name .pdf
# Save the pdf with name .pdf
pdf_bytes
=
pdf
.
output
()
pdf_bytes
=
pdf
.
output
()
...
...
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