refac: HTML_FILE_ID handling

This commit is contained in:
Timothy Jaeryang Baek
2025-05-01 00:32:29 +04:00
parent e52e45d613
commit dadfa5f043
3 changed files with 20 additions and 5 deletions

View File

@@ -41,8 +41,7 @@ export const replaceTokens = (content, sourceIds, char, user) => {
},
{
regex: /{{HTML_FILE_ID_([a-f0-9-]+)}}/gi,
replacement: (_, fileId) =>
`<iframe src="${WEBUI_BASE_URL}/api/v1/files/${fileId}/content/html" width="100%" frameborder="0" onload="this.style.height=(this.contentWindow.document.body.scrollHeight+20)+'px';"></iframe>`
replacement: (_, fileId) => `<file type="html" id="${fileId}" />`
}
];