@lobehub/chat 1.11.1 → 1.11.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/.nvmrc +1 -1
  2. package/CHANGELOG.md +17 -0
  3. package/Dockerfile.database +70 -22
  4. package/README.md +1 -1
  5. package/README.zh-CN.md +1 -1
  6. package/locales/ar/common.json +3 -0
  7. package/locales/ar/setting.json +5 -0
  8. package/locales/bg-BG/common.json +3 -0
  9. package/locales/bg-BG/setting.json +5 -0
  10. package/locales/de-DE/common.json +3 -0
  11. package/locales/de-DE/setting.json +5 -0
  12. package/locales/en-US/common.json +3 -0
  13. package/locales/en-US/setting.json +5 -0
  14. package/locales/es-ES/common.json +3 -0
  15. package/locales/es-ES/setting.json +5 -0
  16. package/locales/fr-FR/common.json +3 -0
  17. package/locales/fr-FR/setting.json +5 -0
  18. package/locales/it-IT/common.json +3 -0
  19. package/locales/it-IT/setting.json +5 -0
  20. package/locales/ja-JP/common.json +3 -0
  21. package/locales/ja-JP/setting.json +5 -0
  22. package/locales/ko-KR/common.json +3 -0
  23. package/locales/ko-KR/setting.json +5 -0
  24. package/locales/nl-NL/common.json +3 -0
  25. package/locales/nl-NL/setting.json +5 -0
  26. package/locales/pl-PL/common.json +3 -0
  27. package/locales/pl-PL/setting.json +5 -0
  28. package/locales/pt-BR/common.json +3 -0
  29. package/locales/pt-BR/setting.json +5 -0
  30. package/locales/ru-RU/common.json +3 -0
  31. package/locales/ru-RU/setting.json +5 -0
  32. package/locales/tr-TR/common.json +3 -0
  33. package/locales/tr-TR/setting.json +5 -0
  34. package/locales/vi-VN/common.json +3 -0
  35. package/locales/vi-VN/setting.json +5 -0
  36. package/locales/zh-CN/common.json +3 -0
  37. package/locales/zh-CN/error.json +1 -1
  38. package/locales/zh-CN/setting.json +6 -1
  39. package/locales/zh-TW/common.json +3 -0
  40. package/locales/zh-TW/setting.json +5 -0
  41. package/next.config.mjs +67 -66
  42. package/package.json +20 -8
  43. package/src/app/(main)/@nav/_layout/Desktop/TopActions.test.tsx +11 -0
  44. package/src/app/(main)/@nav/_layout/Desktop/TopActions.tsx +13 -1
  45. package/src/config/featureFlags/schema.ts +6 -0
  46. package/src/config/file.ts +6 -0
  47. package/src/config/knowledge.ts +17 -0
  48. package/src/const/settings/llm.ts +1 -0
  49. package/src/const/settings/systemAgent.ts +1 -0
  50. package/src/locales/default/common.ts +3 -0
  51. package/src/locales/default/setting.ts +5 -0
  52. package/src/store/file/initialState.ts +1 -1
  53. package/src/store/file/selectors.ts +1 -1
  54. package/src/store/file/store.ts +1 -1
  55. package/src/store/global/initialState.ts +5 -0
  56. package/src/store/global/selectors.ts +4 -0
  57. package/src/store/serverConfig/selectors.test.ts +1 -0
  58. package/src/types/user/index.ts +12 -4
  59. package/src/types/user/settings/systemAgent.ts +1 -0
  60. /package/src/store/file/slices/{images → chat}/action.test.ts +0 -0
  61. /package/src/store/file/slices/{images → chat}/action.ts +0 -0
  62. /package/src/store/file/slices/{images → chat}/index.ts +0 -0
  63. /package/src/store/file/slices/{images → chat}/initialState.ts +0 -0
  64. /package/src/store/file/slices/{images → chat}/selectors.test.ts +0 -0
  65. /package/src/store/file/slices/{images → chat}/selectors.ts +0 -0
@@ -13,6 +13,7 @@
13
13
  "autoGenerate": "Автозаполнение",
14
14
  "autoGenerateTooltip": "Автоматическое дополнение описания агента на основе подсказок",
15
15
  "autoGenerateTooltipDisabled": "Пожалуйста, введите подсказку перед использованием функции автозаполнения",
16
+ "batchDelete": "Пакетное удаление",
16
17
  "blog": "Блог о продуктах",
17
18
  "cancel": "Отмена",
18
19
  "changelog": "История изменений",
@@ -31,6 +32,7 @@
31
32
  "defaultSession": "Пользовательский агент",
32
33
  "delete": "Удалить",
33
34
  "document": "Документация",
35
+ "download": "Скачать",
34
36
  "duplicate": "Создать копию",
35
37
  "edit": "Редактировать",
36
38
  "export": "Экспорт настроек",
@@ -192,6 +194,7 @@
192
194
  },
193
195
  "tab": {
194
196
  "chat": "Чат",
197
+ "files": "Файлы",
195
198
  "market": "Обзор",
196
199
  "me": "я",
197
200
  "setting": "Настройки"
@@ -372,6 +372,11 @@
372
372
  "modelDesc": "Модель, используемая для генерации имени агента, описания, аватара и меток",
373
373
  "title": "Автоматическое создание информации об агенте"
374
374
  },
375
+ "queryRewrite": {
376
+ "label": "Модель переформулирования вопросов",
377
+ "modelDesc": "Модель, предназначенная для оптимизации вопросов пользователей",
378
+ "title": "База знаний"
379
+ },
375
380
  "title": "Системный агент",
376
381
  "topic": {
377
382
  "label": "Модель именования тем",
@@ -13,6 +13,7 @@
13
13
  "autoGenerate": "Otomatik Oluştur",
14
14
  "autoGenerateTooltip": "Auto-generate agent description based on prompts",
15
15
  "autoGenerateTooltipDisabled": "Otomatik tamamlama işlevini kullanmadan önce ipucu kelimesini girin",
16
+ "batchDelete": "Toplu Sil",
16
17
  "blog": "Ürün Blogu",
17
18
  "cancel": "İptal",
18
19
  "changelog": "Changelog",
@@ -31,6 +32,7 @@
31
32
  "defaultSession": "Varsayılan Asistan",
32
33
  "delete": "Sil",
33
34
  "document": "Belge",
35
+ "download": "İndir",
34
36
  "duplicate": "Kopya oluştur",
35
37
  "edit": "Düzenle",
36
38
  "export": "Dışa Aktar",
@@ -192,6 +194,7 @@
192
194
  },
193
195
  "tab": {
194
196
  "chat": "Chat",
197
+ "files": "Dosyalar",
195
198
  "market": "Keşfet",
196
199
  "me": "ben",
197
200
  "setting": "Ayarlar"
@@ -372,6 +372,11 @@
372
372
  "modelDesc": "Asistan adı, açıklaması, avatar ve etiket oluşturmak için belirlenen model",
373
373
  "title": "Asistan Bilgilerini Otomatik Oluştur"
374
374
  },
375
+ "queryRewrite": {
376
+ "label": "Soru Yeniden Yazım Modeli",
377
+ "modelDesc": "Kullanıcı sorularını optimize etmek için kullanılan model",
378
+ "title": "Bilgi Tabanı"
379
+ },
375
380
  "title": "Sistem Asistanı",
376
381
  "topic": {
377
382
  "label": "Konu Adlandırma Modeli",
@@ -13,6 +13,7 @@
13
13
  "autoGenerate": "Tự động tạo",
14
14
  "autoGenerateTooltip": "Tự động hoàn thành mô tả trợ lý dựa trên từ gợi ý",
15
15
  "autoGenerateTooltipDisabled": "Vui lòng nhập từ gợi ý trước khi sử dụng tính năng tự động hoàn thành",
16
+ "batchDelete": "Xóa hàng loạt",
16
17
  "blog": "Blog sản phẩm",
17
18
  "cancel": "Hủy",
18
19
  "changelog": "Nhật ký cập nhật",
@@ -31,6 +32,7 @@
31
32
  "defaultSession": "Phiên mặc định",
32
33
  "delete": "Xóa",
33
34
  "document": "Tài Liệu Sử Dụng",
35
+ "download": "Tải xuống",
34
36
  "duplicate": "Tạo bản sao",
35
37
  "edit": "Chỉnh sửa",
36
38
  "export": "Xuất cấu hình",
@@ -192,6 +194,7 @@
192
194
  },
193
195
  "tab": {
194
196
  "chat": "Trò chuyện",
197
+ "files": "Tệp",
195
198
  "market": "Thị trường",
196
199
  "me": "Tôi",
197
200
  "setting": "Cài đặt"
@@ -372,6 +372,11 @@
372
372
  "modelDesc": "Xác định mô hình được sử dụng để tạo tên, mô tả, hình đại diện, nhãn cho trợ lý",
373
373
  "title": "Tự động tạo thông tin trợ lý"
374
374
  },
375
+ "queryRewrite": {
376
+ "label": "Mô hình viết lại câu hỏi",
377
+ "modelDesc": "Mô hình được chỉ định để tối ưu hóa câu hỏi của người dùng",
378
+ "title": "Kho tri thức"
379
+ },
375
380
  "title": "Trợ lý hệ thống",
376
381
  "topic": {
377
382
  "label": "Mô hình đặt tên chủ đề",
@@ -13,6 +13,7 @@
13
13
  "autoGenerate": "自动补全",
14
14
  "autoGenerateTooltip": "基于提示词自动补全助手描述",
15
15
  "autoGenerateTooltipDisabled": "请填写提示词后使用自动补全功能",
16
+ "batchDelete": "批量删除",
16
17
  "blog": "产品博客",
17
18
  "cancel": "取消",
18
19
  "changelog": "更新日志",
@@ -31,6 +32,7 @@
31
32
  "defaultSession": "自定义助手",
32
33
  "delete": "删除",
33
34
  "document": "使用文档",
35
+ "download": "下载",
34
36
  "duplicate": "创建副本",
35
37
  "edit": "编辑",
36
38
  "export": "导出配置",
@@ -192,6 +194,7 @@
192
194
  },
193
195
  "tab": {
194
196
  "chat": "会话",
197
+ "files": "文件",
195
198
  "market": "发现",
196
199
  "me": "我",
197
200
  "setting": "设置"
@@ -60,7 +60,7 @@
60
60
  "PluginManifestNotFound": "很抱歉,服务器没有找到该插件的描述清单 (manifest.json),请检查插件描述文件地址是否正确",
61
61
  "PluginManifestInvalid": "很抱歉,该插件的描述清单校验未通过,请检查描述清单格式是否规范",
62
62
  "PluginApiNotFound": "很抱歉,插件描述清单中不存在该 API ,请检查你的请求方法与插件清单 API 是否匹配",
63
- "PluginApiParamsError": "很抱歉,该插件请求的入参校验未通过,请检查入参与 API 描述信息是否匹配",
63
+ "PluginApiParamsError": "很抱歉,该插件请求的入参校验未通过,请检查入参与 Api 描述信息是否匹配",
64
64
  "PluginSettingsInvalid": "该插件需要正确配置后才可以使用,请检查你的配置是否正确",
65
65
  "PluginServerError": "插件服务端请求返回出错,请检查根据下面的报错信息检查你的插件描述文件、插件配置或服务端实现",
66
66
  "PluginGatewayError": "很抱歉,插件网关出现错误,请检查插件网关配置是否正确",
@@ -51,7 +51,7 @@
51
51
  },
52
52
  "checker": {
53
53
  "button": "检查",
54
- "desc": "测试 API Key 与代理地址是否正确填写",
54
+ "desc": "测试 Api Key 与代理地址是否正确填写",
55
55
  "pass": "检查通过",
56
56
  "title": "连通性检查"
57
57
  },
@@ -372,6 +372,11 @@
372
372
  "modelDesc": "指定用于生成助理名称、描述、头像、标签的模型",
373
373
  "title": "自动生成助理信息"
374
374
  },
375
+ "queryRewrite": {
376
+ "label": "提问重写模型",
377
+ "modelDesc": "指定用于优化用户提问的模型",
378
+ "title": "知识库"
379
+ },
375
380
  "title": "系统助手",
376
381
  "topic": {
377
382
  "label": "话题命名模型",
@@ -13,6 +13,7 @@
13
13
  "autoGenerate": "自動生成",
14
14
  "autoGenerateTooltip": "基於提示詞自動生成助手描述",
15
15
  "autoGenerateTooltipDisabled": "請填寫提示詞後使用自動補全功能",
16
+ "batchDelete": "批次刪除",
16
17
  "blog": "產品部落格",
17
18
  "cancel": "取消",
18
19
  "changelog": "變更日誌",
@@ -31,6 +32,7 @@
31
32
  "defaultSession": "預設助手",
32
33
  "delete": "刪除",
33
34
  "document": "使用說明文件",
35
+ "download": "下載",
34
36
  "duplicate": "建立副本",
35
37
  "edit": "編輯",
36
38
  "export": "匯出設定",
@@ -192,6 +194,7 @@
192
194
  },
193
195
  "tab": {
194
196
  "chat": "對話",
197
+ "files": "檔案",
195
198
  "market": "發現",
196
199
  "me": "我",
197
200
  "setting": "設定"
@@ -372,6 +372,11 @@
372
372
  "modelDesc": "指定用於生成助理名稱、描述、頭像、標籤的模型",
373
373
  "title": "自動生成助理資訊"
374
374
  },
375
+ "queryRewrite": {
376
+ "label": "提問重寫模型",
377
+ "modelDesc": "指定用於優化用戶提問的模型",
378
+ "title": "知識庫"
379
+ },
375
380
  "title": "系統助手",
376
381
  "topic": {
377
382
  "label": "話題命名模型",
package/next.config.mjs CHANGED
@@ -12,8 +12,8 @@ const basePath = process.env.NEXT_PUBLIC_BASE_PATH;
12
12
 
13
13
  /** @type {import('next').NextConfig} */
14
14
  const nextConfig = {
15
- compress: isProd,
16
15
  basePath,
16
+ compress: isProd,
17
17
  experimental: {
18
18
  optimizePackageImports: [
19
19
  'emoji-mart',
@@ -28,120 +28,122 @@ const nextConfig = {
28
28
  webVitalsAttribution: ['CLS', 'LCP'],
29
29
  },
30
30
 
31
- output: buildWithDocker ? 'standalone' : undefined,
32
-
33
- redirects: async () => [
34
- {
35
- source: '/settings',
36
- permanent: true,
37
- destination: '/settings/common',
38
- },
39
- ],
40
- rewrites: async () => [
41
- // due to google api not work correct in some countries
42
- // we need a proxy to bypass the restriction
43
- { source: '/api/chat/google', destination: `${API_PROXY_ENDPOINT}/api/chat/google` },
44
- ],
45
- reactStrictMode: true,
46
-
47
- webpack(config) {
48
- config.experiments = {
49
- asyncWebAssembly: true,
50
- layers: true,
51
- };
52
-
53
- // to fix shikiji compile error
54
- // refs: https://github.com/antfu/shikiji/issues/23
55
- config.module.rules.push({
56
- test: /\.m?js$/,
57
- type: 'javascript/auto',
58
- resolve: {
59
- fullySpecified: false,
60
- },
61
- });
62
-
63
- // https://github.com/pinojs/pino/issues/688#issuecomment-637763276
64
- config.externals.push('pino-pretty');
65
-
66
- return config;
67
- },
68
-
69
31
  async headers() {
70
32
  return [
71
33
  {
72
- source: '/icons/(.*).(png|jpe?g|gif|svg|ico|webp)',
73
34
  headers: [
74
35
  {
75
36
  key: 'Cache-Control',
76
37
  value: 'public, max-age=31536000, immutable',
77
38
  },
78
39
  ],
40
+ source: '/icons/(.*).(png|jpe?g|gif|svg|ico|webp)',
79
41
  },
80
42
  {
81
- source: '/images/(.*).(png|jpe?g|gif|svg|ico|webp)',
82
43
  headers: [
83
44
  {
84
45
  key: 'Cache-Control',
85
46
  value: 'public, max-age=31536000, immutable',
86
47
  },
87
48
  ],
49
+ source: '/images/(.*).(png|jpe?g|gif|svg|ico|webp)',
88
50
  },
89
51
  {
90
- source: '/videos/(.*).(mp4|webm|ogg|avi|mov|wmv|flv|mkv)',
91
52
  headers: [
92
53
  {
93
54
  key: 'Cache-Control',
94
55
  value: 'public, max-age=31536000, immutable',
95
56
  },
96
57
  ],
58
+ source: '/videos/(.*).(mp4|webm|ogg|avi|mov|wmv|flv|mkv)',
97
59
  },
98
60
  {
99
- source: '/screenshots/(.*).(png|jpe?g|gif|svg|ico|webp)',
100
61
  headers: [
101
62
  {
102
63
  key: 'Cache-Control',
103
64
  value: 'public, max-age=31536000, immutable',
104
65
  },
105
66
  ],
67
+ source: '/screenshots/(.*).(png|jpe?g|gif|svg|ico|webp)',
106
68
  },
107
69
  {
108
- source: '/og/(.*).(png|jpe?g|gif|svg|ico|webp)',
109
70
  headers: [
110
71
  {
111
72
  key: 'Cache-Control',
112
73
  value: 'public, max-age=31536000, immutable',
113
74
  },
114
75
  ],
76
+ source: '/og/(.*).(png|jpe?g|gif|svg|ico|webp)',
115
77
  },
116
78
  {
117
- source: '/favicon.ico',
118
79
  headers: [
119
80
  {
120
81
  key: 'Cache-Control',
121
82
  value: 'public, max-age=31536000, immutable',
122
83
  },
123
84
  ],
85
+ source: '/favicon.ico',
124
86
  },
125
87
  {
126
- source: '/favicon-32x32.ico',
127
88
  headers: [
128
89
  {
129
90
  key: 'Cache-Control',
130
91
  value: 'public, max-age=31536000, immutable',
131
92
  },
132
93
  ],
94
+ source: '/favicon-32x32.ico',
133
95
  },
134
96
  {
135
- source: '/apple-touch-icon.png',
136
97
  headers: [
137
98
  {
138
99
  key: 'Cache-Control',
139
100
  value: 'public, max-age=31536000, immutable',
140
101
  },
141
102
  ],
103
+ source: '/apple-touch-icon.png',
142
104
  },
143
105
  ];
144
106
  },
107
+
108
+ output: buildWithDocker ? 'standalone' : undefined,
109
+ reactStrictMode: true,
110
+ redirects: async () => [
111
+ {
112
+ destination: '/settings/common',
113
+ permanent: true,
114
+ source: '/settings',
115
+ },
116
+ ],
117
+
118
+ rewrites: async () => [
119
+ // due to google api not work correct in some countries
120
+ // we need a proxy to bypass the restriction
121
+ { destination: `${API_PROXY_ENDPOINT}/api/chat/google`, source: '/api/chat/google' },
122
+ ],
123
+
124
+ webpack(config) {
125
+ config.experiments = {
126
+ asyncWebAssembly: true,
127
+ layers: true,
128
+ };
129
+
130
+ // to fix shikiji compile error
131
+ // refs: https://github.com/antfu/shikiji/issues/23
132
+ config.module.rules.push({
133
+ resolve: {
134
+ fullySpecified: false,
135
+ },
136
+ test: /\.m?js$/,
137
+ type: 'javascript/auto',
138
+ });
139
+
140
+ // https://github.com/pinojs/pino/issues/688#issuecomment-637763276
141
+ config.externals.push('pino-pretty');
142
+
143
+ config.resolve.alias.canvas = false;
144
+
145
+ return config;
146
+ },
145
147
  };
146
148
 
147
149
  const noWrapper = (config) => config;
@@ -165,20 +167,26 @@ const withSentry =
165
167
  withSentryConfig(
166
168
  c,
167
169
  {
170
+ org: process.env.SENTRY_ORG,
171
+
172
+ project: process.env.SENTRY_PROJECT,
168
173
  // For all available options, see:
169
174
  // https://github.com/getsentry/sentry-webpack-plugin#options
170
-
171
175
  // Suppresses source map uploading logs during build
172
176
  silent: true,
173
- org: process.env.SENTRY_ORG,
174
- project: process.env.SENTRY_PROJECT,
175
177
  },
176
178
  {
177
- // For all available options, see:
178
- // https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/
179
+ // Enables automatic instrumentation of Vercel Cron Monitors.
180
+ // See the following for more information:
181
+ // https://docs.sentry.io/product/crons/
182
+ // https://vercel.com/docs/cron-jobs
183
+ automaticVercelMonitors: true,
179
184
 
180
- // Upload a larger set of source maps for prettier stack traces (increases build time)
181
- widenClientFileUpload: true,
185
+ // Automatically tree-shake Sentry logger statements to reduce bundle size
186
+ disableLogger: true,
187
+
188
+ // Hides source maps from generated client bundles
189
+ hideSourceMaps: true,
182
190
 
183
191
  // Transpiles SDK to be compatible with IE11 (increases bundle size)
184
192
  transpileClientSDK: true,
@@ -188,19 +196,12 @@ const withSentry =
188
196
  // side errors will fail.
189
197
  tunnelRoute: '/monitoring',
190
198
 
191
- // Hides source maps from generated client bundles
192
- hideSourceMaps: true,
193
-
194
- // Automatically tree-shake Sentry logger statements to reduce bundle size
195
- disableLogger: true,
196
-
197
- // Enables automatic instrumentation of Vercel Cron Monitors.
198
- // See the following for more information:
199
- // https://docs.sentry.io/product/crons/
200
- // https://vercel.com/docs/cron-jobs
201
- automaticVercelMonitors: true,
199
+ // For all available options, see:
200
+ // https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/
201
+ // Upload a larger set of source maps for prettier stack traces (increases build time)
202
+ widenClientFileUpload: true,
202
203
  },
203
204
  )
204
205
  : noWrapper;
205
206
 
206
- export default withBundleAnalyzer(withPWA(withSentry(nextConfig)));
207
+ export default withBundleAnalyzer(withPWA(withSentry(nextConfig)));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "1.11.1",
3
+ "version": "1.11.2",
4
4
  "description": "Lobe Chat - an open-source, high-performance chatbot framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.",
5
5
  "keywords": [
6
6
  "framework",
@@ -32,12 +32,12 @@
32
32
  "build-sitemap": "next-sitemap --config next-sitemap.config.mjs",
33
33
  "build:analyze": "ANALYZE=true next build",
34
34
  "build:docker": "DOCKER=true next build && npm run build-sitemap",
35
- "db:generate": "drizzle-kit generate -- dotenv_config_path='.env'",
35
+ "db:generate": "drizzle-kit generate",
36
36
  "db:migrate": "MIGRATION_DB=1 tsx scripts/migrateServerDB/index.ts",
37
- "db:push": "drizzle-kit push -- dotenv_config_path='.env'",
38
- "db:push-test": "NODE_ENV=test drizzle-kit push -- dotenv_config_path='.env'",
37
+ "db:push": "drizzle-kit push",
38
+ "db:push-test": "NODE_ENV=test drizzle-kit push",
39
39
  "db:studio": "drizzle-kit studio",
40
- "db:z-pull": "drizzle-kit introspect -- dotenv_config_path='.env'",
40
+ "db:z-pull": "drizzle-kit introspect",
41
41
  "dev": "next dev -p 3010",
42
42
  "dev:clerk-proxy": "ngrok http http://localhost:3011",
43
43
  "docs:i18n": "lobe-i18n md && npm run lint:mdx",
@@ -110,14 +110,16 @@
110
110
  "@clerk/localizations": "2.0.0",
111
111
  "@clerk/nextjs": "^5.2.14",
112
112
  "@clerk/themes": "^2.1.10",
113
+ "@cyntler/react-doc-viewer": "^1.16.6",
113
114
  "@google/generative-ai": "^0.16.0",
114
115
  "@icons-pack/react-simple-icons": "9.6.0",
115
116
  "@khmyznikov/pwa-install": "^0.3.9",
117
+ "@langchain/community": "^0.2.27",
116
118
  "@lobehub/chat-plugin-sdk": "^1.32.4",
117
119
  "@lobehub/chat-plugins-gateway": "^1.9.0",
118
120
  "@lobehub/icons": "^1.28.0",
119
121
  "@lobehub/tts": "^1.24.3",
120
- "@lobehub/ui": "^1.147.0",
122
+ "@lobehub/ui": "^1.149.2",
121
123
  "@microsoft/fetch-event-source": "^2.0.1",
122
124
  "@neondatabase/serverless": "^0.9.4",
123
125
  "@next/third-parties": "^14.2.4",
@@ -129,10 +131,11 @@
129
131
  "@trpc/react-query": "next",
130
132
  "@trpc/server": "next",
131
133
  "@vercel/analytics": "^1.3.1",
134
+ "@vercel/edge-config": "^1.2.1",
132
135
  "@vercel/speed-insights": "^1.0.12",
133
136
  "ahooks": "^3.8.0",
134
137
  "ai": "^3.2.16",
135
- "antd": "^5.19.1",
138
+ "antd": "5.20.0",
136
139
  "antd-style": "^3.6.2",
137
140
  "brotli-wasm": "^3.0.1",
138
141
  "chroma-js": "^2.4.2",
@@ -143,6 +146,7 @@
143
146
  "drizzle-orm": "^0.32.0",
144
147
  "drizzle-zod": "^0.5.1",
145
148
  "fast-deep-equal": "^3.1.3",
149
+ "file-type": "^19.4.1",
146
150
  "gpt-tokenizer": "^2.1.2",
147
151
  "i18next": "^23.11.5",
148
152
  "i18next-browser-languagedetector": "^7.2.1",
@@ -151,10 +155,13 @@
151
155
  "immer": "^10.1.1",
152
156
  "ip": "^2.0.1",
153
157
  "jose": "^5.6.3",
158
+ "js-sha256": "^0.11.0",
159
+ "langchain": "^0.2.16",
154
160
  "langfuse": "^3.14.0",
155
161
  "langfuse-core": "^3.14.0",
156
162
  "lodash-es": "^4.17.21",
157
163
  "lucide-react": "latest",
164
+ "mammoth": "^1.8.0",
158
165
  "modern-screenshot": "^4.4.39",
159
166
  "nanoid": "^5.0.7",
160
167
  "next": "^14.2.4",
@@ -162,9 +169,12 @@
162
169
  "next-sitemap": "^4.2.3",
163
170
  "numeral": "^2.0.6",
164
171
  "nuqs": "^1.17.4",
172
+ "officeparser": "^4.1.1",
165
173
  "ollama": "^0.5.8",
166
174
  "openai": "~4.54.0",
167
175
  "partial-json": "^0.1.7",
176
+ "pdf-parse": "^1.1.1",
177
+ "pdfjs-dist": "4.4.168",
168
178
  "pg": "^8.12.0",
169
179
  "pino": "^9.2.0",
170
180
  "polished": "^4.3.1",
@@ -179,6 +189,7 @@
179
189
  "react-i18next": "14.0.2",
180
190
  "react-layout-kit": "^1.9.0",
181
191
  "react-lazy-load": "^4.0.1",
192
+ "react-pdf": "^9.1.0",
182
193
  "react-virtuoso": "^4.7.11",
183
194
  "react-wrap-balancer": "^1.1.1",
184
195
  "remark": "^14.0.3",
@@ -194,6 +205,7 @@
194
205
  "systemjs": "^6.15.1",
195
206
  "ts-md5": "^1.3.1",
196
207
  "ua-parser-js": "^1.0.38",
208
+ "unstructured-client": "^0.11.3",
197
209
  "url-join": "^5.0.0",
198
210
  "use-merge-value": "^1.2.0",
199
211
  "utility-types": "^3.11.0",
@@ -211,7 +223,7 @@
211
223
  "@commitlint/cli": "^19.3.0",
212
224
  "@ducanh2912/next-pwa": "^10.2.7",
213
225
  "@edge-runtime/vm": "^4.0.0",
214
- "@lobehub/i18n-cli": "^1.18.1",
226
+ "@lobehub/i18n-cli": "^1.19.1",
215
227
  "@lobehub/lint": "^1.24.3",
216
228
  "@lobehub/seo-cli": "^1.4.1",
217
229
  "@next/bundle-analyzer": "^14.2.4",
@@ -71,6 +71,17 @@ describe('TopActions', () => {
71
71
  expect(screen.queryByText('tab.market')).not.toBeInTheDocument();
72
72
  });
73
73
 
74
+ it('should render File icon when `-knowledge_base` is set', () => {
75
+ act(() => {
76
+ createServerConfigStore().setState({ featureFlags: { knowledge_base: false } });
77
+ });
78
+
79
+ renderTopActions();
80
+
81
+ expect(screen.getByText('tab.chat')).toBeInTheDocument();
82
+ expect(screen.queryByText('tab.files')).not.toBeInTheDocument();
83
+ });
84
+
74
85
  it('should switch back to previous active session', () => {
75
86
  act(() => {
76
87
  useSessionStore.setState({ activeId: '1' });
@@ -1,5 +1,5 @@
1
1
  import { ActionIcon } from '@lobehub/ui';
2
- import { Compass, MessageSquare } from 'lucide-react';
2
+ import { Compass, FolderClosed, MessageSquare } from 'lucide-react';
3
3
  import Link from 'next/link';
4
4
  import { memo } from 'react';
5
5
  import { useTranslation } from 'react-i18next';
@@ -17,6 +17,7 @@ const TopActions = memo<TopActionProps>(({ tab }) => {
17
17
  const { t } = useTranslation('common');
18
18
  const switchBackToChat = useGlobalStore((s) => s.switchBackToChat);
19
19
  const { showMarket } = useServerConfigStore(featureFlagsSelectors);
20
+ const { enableKnowledgeBase } = useServerConfigStore(featureFlagsSelectors);
20
21
 
21
22
  return (
22
23
  <>
@@ -36,6 +37,17 @@ const TopActions = memo<TopActionProps>(({ tab }) => {
36
37
  title={t('tab.chat')}
37
38
  />
38
39
  </Link>
40
+ {enableKnowledgeBase && (
41
+ <Link aria-label={t('tab.files')} href={'/files'}>
42
+ <ActionIcon
43
+ active={tab === SidebarTabKey.Files}
44
+ icon={FolderClosed}
45
+ placement={'right'}
46
+ size="large"
47
+ title={t('tab.files')}
48
+ />
49
+ </Link>
50
+ )}
39
51
  {showMarket && (
40
52
  <Link aria-label={t('tab.market')} href={'/market'}>
41
53
  <ActionIcon
@@ -23,6 +23,8 @@ export const FeatureFlagsSchema = z.object({
23
23
 
24
24
  market: z.boolean().optional(),
25
25
  speech_to_text: z.boolean().optional(),
26
+
27
+ knowledge_base: z.boolean().optional(),
26
28
  });
27
29
 
28
30
  // TypeScript 类型,从 Zod schema 生成
@@ -44,6 +46,8 @@ export const DEFAULT_FEATURE_FLAGS: IFeatureFlags = {
44
46
  check_updates: true,
45
47
  welcome_suggest: true,
46
48
 
49
+ knowledge_base: false,
50
+
47
51
  clerk_sign_up: true,
48
52
 
49
53
  cloud_promotion: false,
@@ -70,6 +74,8 @@ export const mapFeatureFlagsEnvToState = (config: IFeatureFlags) => {
70
74
 
71
75
  enableClerkSignUp: config.clerk_sign_up,
72
76
 
77
+ enableKnowledgeBase: config.knowledge_base,
78
+
73
79
  showCloudPromotion: config.cloud_promotion,
74
80
 
75
81
  showMarket: config.market,
@@ -10,6 +10,9 @@ export const getFileConfig = () => {
10
10
  NEXT_PUBLIC_S3_FILE_PATH: z.string().optional(),
11
11
  },
12
12
  runtimeEnv: {
13
+ CHUNKS_AUTO_EMBEDDING: process.env.CHUNKS_AUTO_EMBEDDING !== '0',
14
+ CHUNKS_AUTO_GEN_METADATA: process.env.CHUNKS_AUTO_GEN_METADATA !== '0',
15
+
13
16
  NEXT_PUBLIC_S3_DOMAIN: process.env.NEXT_PUBLIC_S3_DOMAIN,
14
17
  NEXT_PUBLIC_S3_FILE_PATH: process.env.NEXT_PUBLIC_S3_FILE_PATH || DEFAULT_S3_FILE_PATH,
15
18
 
@@ -21,6 +24,9 @@ export const getFileConfig = () => {
21
24
  S3_SET_ACL: process.env.S3_SET_ACL !== '0',
22
25
  },
23
26
  server: {
27
+ CHUNKS_AUTO_EMBEDDING: z.boolean(),
28
+ CHUNKS_AUTO_GEN_METADATA: z.boolean(),
29
+
24
30
  // S3
25
31
  S3_ACCESS_KEY_ID: z.string().optional(),
26
32
  S3_BUCKET: z.string().optional(),