Skip to content

World's first open-source enterprise world model.

Add an export button for the whole knowledge base to its settings (#1230)

Schro-codefc0331ec191a
diff --git a/web/src/i18n/en.ts b/web/src/i18n/en.ts
index 8d1b8509..ebd6c260 100644
--- a/web/src/i18n/en.ts
+++ b/web/src/i18n/en.ts
@@ -2365,6 +2365,9 @@ export const en = {
requeue: "Run again",
requeued: (n: number) =>
n === 1 ? "1 job back in the queue" : `${n} jobs back in the queue`,
+ exportKb: "Export knowledge base (RDF)",
+ exportKbNote: "Download every fact and its provenance as a Turtle file.",
+ exportKbAction: "Export",
/* 语料语言。措辞要把"这不是界面语言"讲清楚,否则一定有人当成界面开关 */
cardIdentity: "Name and description",
cardIdentityNote:
diff --git a/web/src/i18n/zh.ts b/web/src/i18n/zh.ts
index 960239d1..701a155e 100644
--- a/web/src/i18n/zh.ts
+++ b/web/src/i18n/zh.ts
@@ -2070,6 +2070,9 @@ export const zh: Strings = {
failedJobs: (n: number) => `${n} 个失败的任务`,
requeue: "再跑一遍",
requeued: (n: number) => `${n} 个任务回到队列`,
+ exportKb: "导出整个知识库(RDF)",
+ exportKbNote: "把所有事实及其出处下载为 Turtle 文件。",
+ exportKbAction: "导出",
cardIdentity: "名字与描述",
cardIdentityNote: "最长 64 个字符。切换器和这个库每一页的顶上用的都是它。",
cardVisibilityNote:
diff --git a/web/src/pages/KbSettings.tsx b/web/src/pages/KbSettings.tsx
index e35584cc..b8478e20 100644
--- a/web/src/pages/KbSettings.tsx
+++ b/web/src/pages/KbSettings.tsx
@@ -7,6 +7,7 @@ import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import { useParams, useNavigate } from "@tanstack/react-router";
import {
History as HistoryIcon,
+ Download,
Lock,
Plus,
Search,
@@ -434,6 +435,19 @@ export function KbSettings() {
}
/>
)}
+
+ <SettingsCard
+ title={S.kbset.exportKb}
+ hint={S.kbset.exportKbNote}
+ action={
+ <Button variant="secondary" size="sm"
+ onClick={() => window.open(`/api/v1/kbs/${kbId}/export?format=turtle`)}
+ >
+ <Download size={14} />
+ {S.kbset.exportKbAction}
+ </Button>
+ }
+ />
</div>
)}