feat: Add embeddings and loras autocompletion

This commit is contained in:
newtextdoc1111
2025-07-28 05:21:57 +09:00
parent 9cdc18e566
commit 67b7b334b8
8 changed files with 314 additions and 45 deletions
+24
View File
@@ -109,6 +109,30 @@ export function formatCountHumanReadable(num) {
return (num / si[i].value).toFixed(1).replace(rx, "$1") + si[i].symbol;
}
/**
* Escapes HTML special characters in a string.
* @param {string} str The input string.
* @returns {string} The escaped string.
*/
export function escapeHtml(str) {
if (typeof str !== 'string') {
return str;
}
const escapeMap = {
'&': '&',
'<': '&lt;',
'>': '&gt;',
'"': '&quot;',
"'": '&#x27;',
'`': '&#x60;',
'/': '&#x2F;'
};
return str.replace(/[&<>"'`/]/g, match =>
escapeMap[match]);
}
/**
* Escapes parentheses in a string for use in prompts.
* Replaces '(' with '\(' and ')' with '\)'.