File creation agent skills (#5280)

* Powerpoint File Creation (#5278)

* wip

* download card

* UI for downloading

* move to fs system with endpoint to pull files

* refactor UI

* final-pass

* remove save-file-browser skill and refactor

* remove fileDownload event

* reset

* reset file

* reset timeout

* persist toggle

* Txt creation (#5279)

* wip

* download card

* UI for downloading

* move to fs system with endpoint to pull files

* refactor UI

* final-pass

* remove save-file-browser skill and refactor

* remove fileDownload event

* reset

* reset file

* reset timeout

* wip

* persist toggle

* add arbitrary text creation file

* Add PDF document generation with markdown formatting (#5283)

add support for branding in bottom right corner
refactor core utils and frontend rendering

* Xlsx document creation (#5284)

add Excel doc & sheet creation

* Basic docx creation (#5285)

* Basic docx creation

* add test theme support + styling and title pages

* simplify skill selection

* handle TG attachments

* send documents over tg

* lazy import

* pin deps

* fix lock

* i18n for file creation (#5286)

i18n for file-creation
connect #5280

* theme overhaul

* Add PPTX subagent for better results

* forgot files

* Add PPTX subagent for better results (#5287)

* Add PPTX subagent for better results

* forgot files

* make sub-agent use proper tool calling if it can and better UI hints
This commit is contained in:
Timothy Carambat
2026-03-30 15:13:39 -07:00
committed by GitHub
parent 0bfd27c6df
commit 7aaea7f514
70 changed files with 7349 additions and 932 deletions

View File

@@ -0,0 +1,70 @@
const createFilesLib = require("../lib.js");
/**
* Applies AnythingLLM branding to a PDF document.
* Adds a logo watermark or fallback text to the bottom-right of each page.
* @param {PDFDocument} pdfDoc - The pdf-lib PDFDocument instance
* @param {Object} pdfLib - The pdf-lib module exports (rgb, StandardFonts)
* @returns {Promise<void>}
*/
async function applyBranding(pdfDoc, { rgb, StandardFonts }) {
const font = await pdfDoc.embedFont(StandardFonts.HelveticaOblique);
const pages = pdfDoc.getPages();
const logoPng = createFilesLib.getLogo({
forDarkBackground: false,
format: "buffer",
});
const logoImage = logoPng ? await pdfDoc.embedPng(logoPng) : null;
const logoWidth = 80;
const logoHeight = logoImage
? (logoImage.height / logoImage.width) * logoWidth
: 0;
const marginRight = 20;
const marginBottom = 20;
for (const page of pages) {
const { width } = page.getSize();
if (logoImage) {
const createdWithText = "created with";
const fontSize = 7;
const textWidth = font.widthOfTextAtSize(createdWithText, fontSize);
const logoX = width - marginRight - logoWidth;
page.drawText(createdWithText, {
x: logoX + (logoWidth - textWidth) / 2,
y: marginBottom + logoHeight + 2,
size: fontSize,
font,
color: rgb(0.6, 0.6, 0.6),
opacity: 0.6,
});
page.drawImage(logoImage, {
x: logoX,
y: marginBottom,
width: logoWidth,
height: logoHeight,
opacity: 0.6,
});
} else {
const fallbackText = "Created with AnythingLLM";
const fontSize = 9;
const textWidth = font.widthOfTextAtSize(fallbackText, fontSize);
page.drawText(fallbackText, {
x: width - marginRight - textWidth,
y: marginBottom,
size: fontSize,
font,
color: rgb(0.6, 0.6, 0.6),
});
}
}
}
module.exports = {
applyBranding,
};