From 38dde1a37395ae22cd0cd59df0c3e12685076e53 Mon Sep 17 00:00:00 2001 From: RockYang Date: Thu, 6 Mar 2025 14:00:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E6=A1=A3=E5=AF=B9=E8=AF=9D=E4=B8=8D?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E6=96=87=E6=A1=A3=E5=88=97=E8=A1=A8=E7=9A=84?= =?UTF-8?q?=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build/dockerfile-web-amd64 | 2 +- build/dockerfile-web-arm64 | 2 +- web/src/components/ChatPrompt.vue | 30 ++++++++++++++++++++---------- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/build/dockerfile-web-amd64 b/build/dockerfile-web-amd64 index 81d3fd05..6f4f1961 100644 --- a/build/dockerfile-web-amd64 +++ b/build/dockerfile-web-amd64 @@ -1,5 +1,5 @@ # 前端 Vue 项目构建 -FROM registry.cn-shenzhen.aliyuncs.com/geekmaster/nginx:latest +FROM registry.cn-hangzhou.aliyuncs.com/geekmaster/nginx:1.20.2 MAINTAINER yangjian diff --git a/build/dockerfile-web-arm64 b/build/dockerfile-web-arm64 index 6f4f1961..81d3fd05 100644 --- a/build/dockerfile-web-arm64 +++ b/build/dockerfile-web-arm64 @@ -1,5 +1,5 @@ # 前端 Vue 项目构建 -FROM registry.cn-hangzhou.aliyuncs.com/geekmaster/nginx:1.20.2 +FROM registry.cn-shenzhen.aliyuncs.com/geekmaster/nginx:latest MAINTAINER yangjian diff --git a/web/src/components/ChatPrompt.vue b/web/src/components/ChatPrompt.vue index 5c540c80..67e0c9ba 100644 --- a/web/src/components/ChatPrompt.vue +++ b/web/src/components/ChatPrompt.vue @@ -142,20 +142,30 @@ const processFiles = () => { const linkRegex = /(https?:\/\/\S+)/g; const links = props.data.content.match(linkRegex); + const urlPrefix = `${window.location.protocol}//${window.location.host}`; if (links) { - httpPost("/api/upload/list", {urls: links}).then(res => { - files.value = res.data.items - - for (let link of links) { - if (isExternalImg(link, files.value)) { - files.value.push({url:link, ext: ".png"}) - } + const _links = links.map((link) => { + if (link.startsWith(urlPrefix)) { + return link.replace(urlPrefix, ""); } - }).catch(() => { - }) + return link; + }); + // 合并数组并去重 + const urls = [...new Set([...links, ..._links])]; + httpPost("/api/upload/list", { urls: urls }) + .then((res) => { + files.value = res.data.items; + + 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,"") + content.value = content.value.replace(link, ""); } }