8e616d2e by Jonille Arreglo

29047_export_pdf

1 parent 4ab6686e
......@@ -6,9 +6,25 @@ export default function ExportButton({
}) {
const responseToExport = () => {
const response_to_export = document.querySelector(".response-to-export");
if (!response_to_export) return;
return response_to_export?.innerHTML ?? "";
};
if (response_to_export) {
let response = '';
for(var i = 0; i < response_to_export.children.length; i++) {
if(!response_to_export.children[i].querySelector(".message")) continue;
let img_url = window.location.origin + "/assets/images/";
let msg = "<div style='float: left; margin-left: 10px; padding-top: 5px; margin-bottom: 5px;'>"+response_to_export.children[i].querySelector(".message").innerHTML+"</div>";
if(response_to_export.children[i].classList.contains("chatgpt")) {
let profile = "<div style='width: 36px; height: 36px; background: #4c66ef; border-radius: 5px; float: left;'><img style='width: 24px; height: 24px; margin-top: 6px; margin-left: 6px;' src='" + img_url + "bot.png'></div>";
response = response + "<div style='background: #ddf1f9; padding: 5px'>"+ profile + msg +"</div>";
} else {
let profile = "<div style='width: 36px; height: 36px; background: #6BA447; border-radius: 5px; float: left;'><img style='width: 24px; height: 24px; margin-top: 6px; margin-left: 6px;' src='" + img_url + "user.png'></div>";
response = response + "<div style='padding: 5px'>"+ profile + msg +"</div>";
}
}
return response;
}
}
const generatePDF = window.generatePDF;
const onClickExportToPDF = () => {
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!