fixe page styles

This commit is contained in:
RockYang
2024-06-05 18:08:23 +08:00
parent d52dfbfef4
commit 2207830db9
17 changed files with 95 additions and 78 deletions

View File

@@ -222,10 +222,24 @@ export function processContent(content) {
return texts.join("\n")
}
export function escapeHTML(html) {
return html.replace(/&/g, "&")
export function processPrompt(prompt) {
prompt = prompt.replace(/&/g, "&")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;");
const linkRegex = /(https?:\/\/\S+)/g;
const links = prompt.match(linkRegex);
if (links) {
for (let link of links) {
if (isImage(link)) {
const index = prompt.indexOf(link)
if (prompt.substring(index - 1, 2) !== "]") {
prompt = prompt.replace(link, "\n![](" + link + ")\n")
}
}
}
}
return prompt
}
// 判断是否为 iphone 设备