Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

♻️ refactor: Convert glossary from JSON to Markdown table format (#11237)

Arvin Xu46a58a83a152
diff --git a/.i18nrc.js b/.i18nrc.js
index b7761473a55..0e77a6bbe3f 100644
--- a/.i18nrc.js
+++ b/.i18nrc.js
@@ -1,4 +1,6 @@
const { defineConfig } = require('@lobehub/i18n-cli');
+const fs = require('fs');
+const path = require('path');
module.exports = defineConfig({
entry: 'locales/en-US',
@@ -31,8 +33,8 @@ module.exports = defineConfig({
},
markdown: {
reference:
- '你需要保持 mdx 的组件格式,输出文本不需要在最外层包裹任何代码块语法。以下是一些词汇的固定翻译:\n' +
- JSON.stringify(require('./glossary.json'), null, 2),
+ '你需要保持 mdx 的组件格式,输出文本不需要在最外层包裹任何代码块语法。\n' +
+ fs.readFileSync(path.join(__dirname, 'docs/glossary.md'), 'utf-8'),
entry: ['./README.zh-CN.md', './contributing/**/*.zh-CN.md', './docs/**/*.zh-CN.mdx'],
entryLocale: 'zh-CN',
outputLocales: ['en-US'],
diff --git a/docs/glossary.md b/docs/glossary.md
new file mode 100644
index 00000000000..f588b0a46fd
--- /dev/null
+++ b/docs/glossary.md
@@ -0,0 +1,11 @@
+# Glossary
+
+以下是一些词汇的固定翻译:
+
+| develop key | zh-CN(中文) | en-US(English) |
+|-------------| ----------- | -------------- |
+| agent | 助理 | Agent |
+| agentGroup | 群组 | Group |
+| page | 文稿 | Page |
+| topic | 话题 | Topic |
+| thread | 子话题 | Thread |
diff --git a/glossary.json b/glossary.json
deleted file mode 100644
index 4848f66c8ae..00000000000
--- a/glossary.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "助理": {
- "en-US": "Agent"
- },
- "文稿": {
- "en-US": "Page"
- }
-}
diff --git a/locales/zh-CN/topic.json b/locales/zh-CN/topic.json
index e47e50acfdc..c0329ea8f09 100644
--- a/locales/zh-CN/topic.json
+++ b/locales/zh-CN/topic.json
@@ -1,11 +1,11 @@
{
"actions.addNewTopic": "开启新话题",
"actions.autoRename": "智能重命名",
- "actions.confirmRemoveAll": "您即将删除所有主题,此操作无法撤销。",
- "actions.confirmRemoveTopic": "您即将删除此主题,此操作无法撤销。",
- "actions.confirmRemoveUnstarred": "您即将删除未加星标的主题,此操作无法撤销。",
+ "actions.confirmRemoveAll": "您即将删除所有话题,此操作无法撤销。",
+ "actions.confirmRemoveTopic": "您即将删除此话题,此操作无法撤销。",
+ "actions.confirmRemoveUnstarred": "您即将删除未加星标的话题,此操作无法撤销。",
"actions.duplicate": "复制",
- "actions.export": "导出主题",
+ "actions.export": "导出话题",
"actions.import": "导入对话",
"actions.openInNewWindow": "打开独立窗口",
"actions.removeAll": "删除全部话题",
@@ -24,7 +24,7 @@
"groupTitle.byTime.week": "本周",
"groupTitle.byTime.yesterday": "昨天",
"guide.desc": "点击发送左侧按钮可将当前会话保存为历史话题,并开启新一轮会话",
- "guide.title": "主题列表",
+ "guide.title": "话题列表",
"importError": "导入遇到了问题",
"importInvalidFormat": "文件格式不正确。请确认这是有效的 JSON 文件",
"importLoading": "正在导入对话…",
diff --git a/src/server/routers/lambda/notebook.ts b/src/server/routers/lambda/notebook.ts
index 4c5ee0ecee1..124c533996f 100644
--- a/src/server/routers/lambda/notebook.ts
+++ b/src/server/routers/lambda/notebook.ts
@@ -24,6 +24,8 @@ export const notebookRouter = router({
content: z.string(),
description: z.string(),
metadata: z.record(z.string(), z.any()).optional(),
+ source: z.string().optional().default('notebook'),
+ sourceType: z.enum(['file', 'web', 'api', 'topic']).optional().default('api'),
title: z.string(),
topicId: z.string(),
type: z
@@ -39,8 +41,8 @@ export const notebookRouter = router({
description: input.description,
fileType: input.type,
metadata: input.metadata,
- source: 'notebook',
- sourceType: 'api',
+ source: input.source,
+ sourceType: input.sourceType,
title: input.title,
totalCharCount: input.content.length,
totalLineCount: input.content.split('\n').length,
diff --git a/src/services/notebook.ts b/src/services/notebook.ts
index 38137163398..c2d8835ff91 100644
--- a/src/services/notebook.ts
+++ b/src/services/notebook.ts
@@ -8,6 +8,8 @@ interface CreateDocumentParams {
content: string;
description: string;
metadata?: Record<string, any>;
+ source?: string;
+ sourceType?: 'file' | 'web' | 'api' | 'topic';
title: string;
topicId: string;
type?: ExtendedDocumentType;
diff --git a/src/store/tool/slices/builtin/executors/lobe-web-browsing.ts b/src/store/tool/slices/builtin/executors/lobe-web-browsing.ts
index 7af508052e3..4d605332686 100644
--- a/src/store/tool/slices/builtin/executors/lobe-web-browsing.ts
+++ b/src/store/tool/slices/builtin/executors/lobe-web-browsing.ts
@@ -130,6 +130,8 @@ class WebBrowsingExecutor extends BaseExecutor<typeof WebBrowsingApiName> {
const document = await notebookService.createDocument({
content: pageData.content,
description: pageData.description || `Crawled from ${pageData.url}`,
+ source: pageData.url,
+ sourceType: 'web',
title: pageData.title || pageData.url,
topicId: ctx.topicId!,
type: 'article',