Skip to content

Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.

feat: 修复下载文件内容错误问题

v_wnxinfeng2e395864b998
diff --git a/frontend/src/components/doc-content.vue b/frontend/src/components/doc-content.vue
index 283091a04..6a96c3417 100644
--- a/frontend/src/components/doc-content.vue
+++ b/frontend/src/components/doc-content.vue
@@ -104,15 +104,19 @@ const downloadFile = () => {
downKnowledgeDetails(props.details.id)
.then((result) => {
if (result) {
+ if (url.value) {
+ URL.revokeObjectURL(url.value);
+ }
url.value = URL.createObjectURL(result);
- down.value.click();
- // const link = document.createElement("a");
- // link.style.display = "none";
- // link.setAttribute("href", url);
- // link.setAttribute("download", props.details.title);
- // link.click();
- // document.body.removeChild(link);
- window.URL.revokeObjectURL(url);
+ const link = document.createElement("a");
+ link.style.display = "none";
+ link.setAttribute("href", url.value);
+ link.setAttribute("download", props.details.title);
+ link.click();
+ nextTick(() => {
+ document.body.removeChild(link);
+ URL.revokeObjectURL(url.value);
+ })
}
})
.catch((err) => {