From 14fa4fdaa0b72b6853ee07bd7db0b1289402f7b5 Mon Sep 17 00:00:00 2001 From: RockYang Date: Mon, 31 Mar 2025 09:57:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=8A=E4=BC=A0=E6=9C=AC?= =?UTF-8?q?=E5=9C=B0=E6=96=87=E4=BB=B6=EF=BC=8C=E5=9C=A8=E5=AF=B9=E8=AF=9D?= =?UTF-8?q?=E6=A1=86=E8=BE=93=E5=85=A5=E4=BC=9A=E4=B8=A4=E6=AC=A1=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E7=9A=84=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/components/ChatPrompt.vue | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/web/src/components/ChatPrompt.vue b/web/src/components/ChatPrompt.vue index f934349d..b9aeaa5d 100644 --- a/web/src/components/ChatPrompt.vue +++ b/web/src/components/ChatPrompt.vue @@ -149,10 +149,12 @@ const processFiles = () => { return; } + // 提取图片|文件链接 const linkRegex = /(https?:\/\/\S+)/g; const links = props.data.content.match(linkRegex); const urlPrefix = `${window.location.protocol}//${window.location.host}`; if (links) { + // 把本地链接转换为相对路径 const _links = links.map((link) => { if (link.startsWith(urlPrefix)) { return link.replace(urlPrefix, ""); @@ -165,14 +167,15 @@ const processFiles = () => { .then((res) => { files.value = res.data.items; - for (let link of links) { - if (isExternalImg(link, files.value)) { - files.value.push({ url: link, ext: ".png" }); - } - } + // for (let link of links) { + // if (isExternalImg(link, files.value)) { + // files.value.push({ url: link, ext: ".png" }); + // } + // } }) .catch(() => {}); + // 替换图片|文件链接 for (let link of links) { content.value = content.value.replace(link, ""); }