@lobehub/lobehub 2.0.0-next.332 → 2.0.0-next.334

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 (234) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/apps/desktop/src/main/const/dir.ts +3 -0
  3. package/apps/desktop/src/main/controllers/SystemCtr.ts +19 -0
  4. package/apps/desktop/src/main/controllers/__tests__/SystemCtr.test.ts +1 -0
  5. package/apps/desktop/src/main/menus/impls/macOS.test.ts +1 -0
  6. package/changelog/v1.json +21 -0
  7. package/docs/changelog/2023-09-09-plugin-system.mdx +3 -2
  8. package/docs/changelog/2023-11-14-gpt4-vision.mdx +6 -4
  9. package/docs/changelog/2023-11-19-tts-stt.mdx +3 -2
  10. package/docs/changelog/2023-12-22-dalle-3.mdx +5 -2
  11. package/docs/changelog/2023-12-22-dalle-3.zh-CN.mdx +2 -2
  12. package/docs/changelog/2024-02-08-sso-oauth.mdx +2 -2
  13. package/docs/changelog/2024-06-19-lobe-chat-v1.mdx +3 -2
  14. package/docs/changelog/2024-06-19-lobe-chat-v1.zh-CN.mdx +2 -2
  15. package/docs/changelog/2024-07-19-gpt-4o-mini.mdx +3 -2
  16. package/docs/changelog/2024-07-19-gpt-4o-mini.zh-CN.mdx +2 -2
  17. package/docs/changelog/2024-08-02-lobe-chat-database-docker.mdx +3 -2
  18. package/docs/changelog/2024-08-21-file-upload-and-knowledge-base.mdx +5 -4
  19. package/docs/changelog/2024-09-13-openai-o1-models.mdx +2 -2
  20. package/docs/changelog/2024-09-20-artifacts.mdx +3 -2
  21. package/docs/changelog/2024-09-20-artifacts.zh-CN.mdx +2 -2
  22. package/docs/changelog/2024-10-27-pin-assistant.mdx +3 -2
  23. package/docs/changelog/2024-11-06-share-text-json.mdx +4 -2
  24. package/docs/changelog/2024-11-06-share-text-json.zh-CN.mdx +2 -2
  25. package/docs/changelog/2024-11-25-november-providers.mdx +2 -2
  26. package/docs/changelog/2024-11-27-forkable-chat.mdx +2 -2
  27. package/docs/changelog/2025-01-03-user-profile.mdx +2 -2
  28. package/docs/changelog/2025-01-22-new-ai-provider.mdx +2 -2
  29. package/docs/changelog/2025-02-02-deepseek-r1.mdx +4 -4
  30. package/docs/development/basic/add-new-authentication-providers.mdx +4 -0
  31. package/docs/development/basic/add-new-authentication-providers.zh-CN.mdx +4 -0
  32. package/docs/development/basic/add-new-image-model.mdx +4 -0
  33. package/docs/development/basic/add-new-image-model.zh-CN.mdx +4 -0
  34. package/docs/development/basic/architecture.mdx +4 -0
  35. package/docs/development/basic/architecture.zh-CN.mdx +4 -0
  36. package/docs/development/basic/chat-api.mdx +4 -0
  37. package/docs/development/basic/chat-api.zh-CN.mdx +4 -0
  38. package/docs/development/basic/comfyui-development.mdx +3 -1
  39. package/docs/development/basic/contributing-guidelines.mdx +4 -0
  40. package/docs/development/basic/contributing-guidelines.zh-CN.mdx +4 -0
  41. package/docs/development/basic/feature-development-frontend.mdx +11 -3
  42. package/docs/development/basic/feature-development-frontend.zh-CN.mdx +11 -3
  43. package/docs/development/basic/feature-development.mdx +14 -5
  44. package/docs/development/basic/feature-development.zh-CN.mdx +14 -5
  45. package/docs/development/basic/folder-structure.mdx +7 -0
  46. package/docs/development/basic/folder-structure.zh-CN.mdx +7 -0
  47. package/docs/development/basic/resources.mdx +4 -0
  48. package/docs/development/basic/resources.zh-CN.mdx +4 -0
  49. package/docs/development/basic/setup-development.mdx +4 -0
  50. package/docs/development/basic/setup-development.zh-CN.mdx +4 -0
  51. package/docs/development/basic/test.mdx +4 -0
  52. package/docs/development/basic/test.zh-CN.mdx +4 -0
  53. package/docs/development/basic/work-with-server-side-database.mdx +5 -5
  54. package/docs/development/basic/work-with-server-side-database.zh-CN.mdx +5 -5
  55. package/docs/development/internationalization/add-new-locale.mdx +4 -0
  56. package/docs/development/internationalization/add-new-locale.zh-CN.mdx +4 -0
  57. package/docs/development/internationalization/internationalization-implementation.mdx +4 -0
  58. package/docs/development/internationalization/internationalization-implementation.zh-CN.mdx +4 -0
  59. package/docs/development/others/lighthouse.mdx +4 -0
  60. package/docs/development/others/lighthouse.zh-CN.mdx +4 -0
  61. package/docs/development/start.mdx +4 -0
  62. package/docs/development/start.zh-CN.mdx +4 -0
  63. package/docs/development/state-management/state-management-intro.mdx +4 -2
  64. package/docs/development/state-management/state-management-intro.zh-CN.mdx +4 -2
  65. package/docs/development/state-management/state-management-selectors.mdx +6 -1
  66. package/docs/development/state-management/state-management-selectors.zh-CN.mdx +6 -1
  67. package/docs/development/tests/integration-testing.zh-CN.mdx +4 -0
  68. package/docs/self-hosting/advanced/analytics.mdx +2 -2
  69. package/docs/self-hosting/advanced/auth/better-auth/apple.mdx +132 -0
  70. package/docs/self-hosting/advanced/auth/better-auth/apple.zh-CN.mdx +127 -0
  71. package/docs/self-hosting/advanced/auth/better-auth/auth0.mdx +111 -0
  72. package/docs/self-hosting/advanced/auth/better-auth/auth0.zh-CN.mdx +107 -0
  73. package/docs/self-hosting/advanced/auth/better-auth/authelia.mdx +66 -0
  74. package/docs/self-hosting/advanced/auth/better-auth/authelia.zh-CN.mdx +62 -0
  75. package/docs/self-hosting/advanced/auth/better-auth/authentik.mdx +67 -0
  76. package/docs/self-hosting/advanced/auth/better-auth/authentik.zh-CN.mdx +63 -0
  77. package/docs/self-hosting/advanced/auth/better-auth/casdoor.mdx +62 -0
  78. package/docs/self-hosting/advanced/auth/better-auth/casdoor.zh-CN.mdx +58 -0
  79. package/docs/self-hosting/advanced/auth/better-auth/cloudflare-zero-trust.mdx +59 -0
  80. package/docs/self-hosting/advanced/auth/better-auth/cloudflare-zero-trust.zh-CN.mdx +55 -0
  81. package/docs/self-hosting/advanced/auth/better-auth/cognito.mdx +88 -0
  82. package/docs/self-hosting/advanced/auth/better-auth/cognito.zh-CN.mdx +85 -0
  83. package/docs/self-hosting/advanced/auth/better-auth/feishu.mdx +73 -0
  84. package/docs/self-hosting/advanced/auth/better-auth/feishu.zh-CN.mdx +69 -0
  85. package/docs/self-hosting/advanced/auth/better-auth/generic-oidc.mdx +86 -0
  86. package/docs/self-hosting/advanced/auth/better-auth/generic-oidc.zh-CN.mdx +83 -0
  87. package/docs/self-hosting/advanced/auth/better-auth/github.mdx +93 -0
  88. package/docs/self-hosting/advanced/auth/better-auth/github.zh-CN.mdx +90 -0
  89. package/docs/self-hosting/advanced/auth/better-auth/google.mdx +80 -0
  90. package/docs/self-hosting/advanced/auth/better-auth/google.zh-CN.mdx +77 -0
  91. package/docs/self-hosting/advanced/auth/better-auth/keycloak.mdx +77 -0
  92. package/docs/self-hosting/advanced/auth/better-auth/keycloak.zh-CN.mdx +74 -0
  93. package/docs/self-hosting/advanced/auth/better-auth/logto.mdx +64 -0
  94. package/docs/self-hosting/advanced/auth/better-auth/logto.zh-CN.mdx +60 -0
  95. package/docs/self-hosting/advanced/auth/better-auth/microsoft.mdx +113 -0
  96. package/docs/self-hosting/advanced/auth/better-auth/microsoft.zh-CN.mdx +109 -0
  97. package/docs/self-hosting/advanced/auth/better-auth/okta.mdx +67 -0
  98. package/docs/self-hosting/advanced/auth/better-auth/okta.zh-CN.mdx +63 -0
  99. package/docs/self-hosting/advanced/auth/better-auth/wechat.mdx +77 -0
  100. package/docs/self-hosting/advanced/auth/better-auth/wechat.zh-CN.mdx +72 -0
  101. package/docs/self-hosting/advanced/auth/better-auth/zitadel.mdx +73 -0
  102. package/docs/self-hosting/advanced/auth/better-auth/zitadel.zh-CN.mdx +69 -0
  103. package/docs/self-hosting/advanced/auth/clerk.mdx +2 -2
  104. package/docs/self-hosting/advanced/auth/legacy.mdx +106 -0
  105. package/docs/self-hosting/advanced/auth/legacy.zh-CN.mdx +101 -0
  106. package/docs/self-hosting/advanced/auth/next-auth/auth0.mdx +3 -2
  107. package/docs/self-hosting/advanced/auth/next-auth/authelia.mdx +3 -2
  108. package/docs/self-hosting/advanced/auth/next-auth/authentik.mdx +3 -2
  109. package/docs/self-hosting/advanced/auth/next-auth/casdoor.mdx +5 -2
  110. package/docs/self-hosting/advanced/auth/next-auth/casdoor.zh-CN.mdx +2 -0
  111. package/docs/self-hosting/advanced/auth/next-auth/cloudflare-zero-trust.mdx +3 -2
  112. package/docs/self-hosting/advanced/auth/next-auth/cloudflare-zero-trust.zh-CN.mdx +2 -2
  113. package/docs/self-hosting/advanced/auth/next-auth/github.mdx +3 -2
  114. package/docs/self-hosting/advanced/auth/next-auth/google.mdx +10 -12
  115. package/docs/self-hosting/advanced/auth/next-auth/keycloak.mdx +3 -2
  116. package/docs/self-hosting/advanced/auth/next-auth/logto.mdx +2 -2
  117. package/docs/self-hosting/advanced/auth/next-auth/microsoft-entra-id.mdx +3 -2
  118. package/docs/self-hosting/advanced/auth/next-auth/okta.mdx +3 -2
  119. package/docs/self-hosting/advanced/auth/next-auth/okta.zh-CN.mdx +1 -3
  120. package/docs/self-hosting/advanced/auth/next-auth/wechat.mdx +2 -2
  121. package/docs/self-hosting/advanced/auth/next-auth/zitadel.mdx +3 -2
  122. package/docs/self-hosting/advanced/auth.mdx +86 -139
  123. package/docs/self-hosting/advanced/auth.zh-CN.mdx +84 -135
  124. package/docs/self-hosting/advanced/desktop.mdx +9 -3
  125. package/docs/self-hosting/advanced/desktop.zh-CN.mdx +9 -3
  126. package/docs/self-hosting/advanced/feature-flags.mdx +3 -2
  127. package/docs/self-hosting/advanced/knowledge-base.mdx +2 -2
  128. package/docs/self-hosting/advanced/model-list.mdx +2 -2
  129. package/docs/self-hosting/advanced/observability/grafana.mdx +4 -2
  130. package/docs/self-hosting/advanced/observability/grafana.zh-CN.mdx +2 -1
  131. package/docs/self-hosting/advanced/observability/langfuse.mdx +3 -2
  132. package/docs/self-hosting/advanced/online-search.mdx +4 -6
  133. package/docs/self-hosting/advanced/s3/tencent-cloud.mdx +2 -2
  134. package/docs/self-hosting/advanced/settings-url-share.mdx +3 -2
  135. package/docs/self-hosting/advanced/upstream-sync.mdx +3 -4
  136. package/docs/self-hosting/advanced/upstream-sync.zh-CN.mdx +0 -2
  137. package/docs/self-hosting/environment-variables/analytics.mdx +3 -2
  138. package/docs/self-hosting/environment-variables/auth.mdx +5 -12
  139. package/docs/self-hosting/environment-variables/auth.zh-CN.mdx +2 -9
  140. package/docs/self-hosting/environment-variables/basic.mdx +3 -10
  141. package/docs/self-hosting/environment-variables/basic.zh-CN.mdx +0 -7
  142. package/docs/self-hosting/environment-variables/model-provider.mdx +3 -4
  143. package/docs/self-hosting/environment-variables/s3.mdx +2 -2
  144. package/docs/self-hosting/environment-variables.mdx +2 -3
  145. package/docs/self-hosting/examples/azure-openai.mdx +2 -3
  146. package/docs/self-hosting/examples/azure-openai.zh-CN.mdx +0 -1
  147. package/docs/self-hosting/examples/ollama.mdx +3 -2
  148. package/docs/self-hosting/faq/no-v1-suffix.mdx +4 -4
  149. package/docs/self-hosting/faq/proxy-with-unable-to-verify-leaf-signature.mdx +3 -2
  150. package/docs/self-hosting/faq/vercel-ai-image-timeout.mdx +2 -2
  151. package/docs/self-hosting/migration/v2/breaking-changes.mdx +73 -0
  152. package/docs/self-hosting/migration/v2/breaking-changes.zh-CN.mdx +71 -0
  153. package/docs/self-hosting/platform/alibaba-cloud.mdx +2 -7
  154. package/docs/self-hosting/platform/alibaba-cloud.zh-CN.mdx +1 -6
  155. package/docs/self-hosting/platform/btpanel.mdx +4 -2
  156. package/docs/self-hosting/platform/btpanel.zh-CN.mdx +2 -2
  157. package/docs/self-hosting/platform/docker-compose.mdx +3 -3
  158. package/docs/self-hosting/platform/docker-compose.zh-CN.mdx +0 -1
  159. package/docs/self-hosting/platform/docker.mdx +2 -11
  160. package/docs/self-hosting/platform/docker.zh-CN.mdx +0 -8
  161. package/docs/self-hosting/platform/netlify.mdx +5 -17
  162. package/docs/self-hosting/platform/netlify.zh-CN.mdx +3 -17
  163. package/docs/self-hosting/platform/railway.mdx +3 -7
  164. package/docs/self-hosting/platform/railway.zh-CN.mdx +1 -7
  165. package/docs/self-hosting/platform/repocloud.mdx +3 -7
  166. package/docs/self-hosting/platform/repocloud.zh-CN.mdx +1 -6
  167. package/docs/self-hosting/platform/sealos.mdx +2 -7
  168. package/docs/self-hosting/platform/sealos.zh-CN.mdx +1 -6
  169. package/docs/self-hosting/platform/tencentcloud-lighthouse.mdx +2 -7
  170. package/docs/self-hosting/platform/tencentcloud-lighthouse.zh-CN.mdx +1 -6
  171. package/docs/self-hosting/platform/vercel.mdx +4 -9
  172. package/docs/self-hosting/platform/vercel.zh-CN.mdx +3 -8
  173. package/docs/self-hosting/platform/zeabur.mdx +2 -11
  174. package/docs/self-hosting/platform/zeabur.zh-CN.mdx +1 -10
  175. package/docs/self-hosting/server-database/docker-compose.mdx +11 -19
  176. package/docs/self-hosting/server-database/docker-compose.zh-CN.mdx +12 -21
  177. package/docs/self-hosting/server-database/docker.mdx +9 -24
  178. package/docs/self-hosting/server-database/docker.zh-CN.mdx +7 -24
  179. package/docs/self-hosting/server-database/dokploy.mdx +27 -25
  180. package/docs/self-hosting/server-database/dokploy.zh-CN.mdx +23 -21
  181. package/docs/self-hosting/server-database/netlify.mdx +2 -2
  182. package/docs/self-hosting/server-database/netlify.zh-CN.mdx +2 -2
  183. package/docs/self-hosting/server-database/railway.mdx +2 -2
  184. package/docs/self-hosting/server-database/repocloud.mdx +2 -2
  185. package/docs/self-hosting/server-database/sealos.mdx +2 -2
  186. package/docs/self-hosting/server-database/vercel.mdx +19 -72
  187. package/docs/self-hosting/server-database/vercel.zh-CN.mdx +17 -68
  188. package/docs/self-hosting/server-database/zeabur.mdx +2 -2
  189. package/docs/self-hosting/server-database.mdx +1 -19
  190. package/docs/self-hosting/server-database.zh-CN.mdx +0 -17
  191. package/docs/self-hosting/start.mdx +2 -2
  192. package/docs/self-hosting/start.zh-CN.mdx +2 -2
  193. package/locales/ar/common.json +1 -0
  194. package/locales/bg-BG/common.json +1 -0
  195. package/locales/de-DE/common.json +1 -0
  196. package/locales/en-US/common.json +1 -0
  197. package/locales/en-US/desktop-onboarding.json +1 -0
  198. package/locales/es-ES/common.json +1 -0
  199. package/locales/fa-IR/common.json +1 -0
  200. package/locales/fr-FR/common.json +1 -0
  201. package/locales/it-IT/common.json +1 -0
  202. package/locales/ja-JP/common.json +1 -0
  203. package/locales/ko-KR/common.json +1 -0
  204. package/locales/nl-NL/common.json +1 -0
  205. package/locales/pl-PL/common.json +1 -0
  206. package/locales/pt-BR/common.json +1 -0
  207. package/locales/ru-RU/common.json +1 -0
  208. package/locales/tr-TR/common.json +1 -0
  209. package/locales/vi-VN/common.json +1 -0
  210. package/locales/zh-CN/common.json +1 -0
  211. package/locales/zh-CN/desktop-onboarding.json +1 -0
  212. package/locales/zh-TW/common.json +1 -0
  213. package/package.json +2 -2
  214. package/packages/builtin-tool-cloud-sandbox/src/systemRole.ts +62 -2
  215. package/packages/const/src/url.ts +6 -0
  216. package/packages/conversation-flow/src/__tests__/fixtures/inputs/tasks/index.ts +2 -0
  217. package/packages/conversation-flow/src/__tests__/fixtures/inputs/tasks/multi-tasks-with-summary.json +234 -0
  218. package/packages/conversation-flow/src/__tests__/parse.test.ts +25 -0
  219. package/packages/conversation-flow/src/transformation/ContextTreeBuilder.ts +15 -0
  220. package/packages/conversation-flow/src/transformation/FlatListBuilder.ts +20 -0
  221. package/packages/types/src/serverConfig.ts +0 -1
  222. package/src/app/[variants]/(desktop)/desktop-onboarding/features/LoginStep.tsx +39 -1
  223. package/src/app/[variants]/(main)/settings/common/features/Common/Common.tsx +34 -14
  224. package/src/app/[variants]/(mobile)/me/(home)/features/useCategory.tsx +16 -9
  225. package/src/app/[variants]/layout.tsx +0 -4
  226. package/src/envs/app.ts +0 -13
  227. package/src/features/User/UserPanel/useMenu.tsx +18 -9
  228. package/src/hooks/usePlatform.test.ts +5 -0
  229. package/src/hooks/usePlatform.ts +1 -0
  230. package/src/locales/default/common.ts +1 -0
  231. package/src/locales/default/desktop-onboarding.ts +1 -0
  232. package/src/server/globalConfig/index.ts +1 -2
  233. package/src/services/electron/system.ts +4 -0
  234. package/src/store/serverConfig/selectors.ts +0 -1
@@ -1,3 +1,7 @@
1
+ ---
2
+ title: 如何开发一个新功能:前端实现
3
+ ---
4
+
1
5
  # 如何开发一个新功能:前端实现
2
6
 
3
7
  LobeChat 基于 Next.js 框架构建,使用 TypeScript 作为主要开发语言。在开发新功能时,我们需要遵循一定的开发流程,以确保代码的质量和稳定性。大致的流程分为以下五步:
@@ -76,7 +80,8 @@ const ChatPage = () => {
76
80
  renderItem={(message) => (
77
81
  <List.Item>
78
82
  <Typography.Text>{message.content}</Typography.Text>
79
- </List.Item>
83
+
84
+ </List.Item>
80
85
  )}
81
86
  />
82
87
  );
@@ -86,6 +91,7 @@ export default ChatPage;
86
91
  ```
87
92
 
88
93
  > **关于功能组件组织方式的说明**:LobeChat 使用两种模式来组织功能组件:
94
+ >
89
95
  > - **全局功能**(`src/features/`):跨应用共享的组件,如 `ChatInput`、`Conversation` 等
90
96
  > - **页面专属功能**(`src/app/<page>/features/`):仅在特定页面路由中使用的组件
91
97
  >
@@ -113,11 +119,13 @@ const ChatPage = () => {
113
119
  renderItem={(message) => (
114
120
  <List.Item>
115
121
  <Typography.Text>{message.content}</Typography.Text>
116
- </List.Item>
122
+
123
+ </List.Item>
117
124
  )}
118
125
  />
119
126
  <Button onClick={handleSend}>Send</Button>
120
- </>
127
+
128
+ </>
121
129
  );
122
130
  };
123
131
 
@@ -1,3 +1,7 @@
1
+ ---
2
+ title: LobeChat Feature Development Complete Guide
3
+ ---
4
+
1
5
  # LobeChat Feature Development Complete Guide
2
6
 
3
7
  This document aims to guide developers on how to develop a complete feature in LobeChat.
@@ -362,7 +366,8 @@ const OpeningQuestions = memo(() => {
362
366
  {isRepeat && (
363
367
  <p className={styles.repeatError}>{t('settingOpening.openingQuestions.repeat')}</p>
364
368
  )}
365
- </Flexbox>
369
+
370
+ </Flexbox>
366
371
 
367
372
  <div className={styles.questionsList}>
368
373
  {openingQuestions.length > 0 ? (
@@ -378,7 +383,8 @@ const OpeningQuestions = memo(() => {
378
383
  onClick={() => removeQuestion(item.content)}
379
384
  type="text"
380
385
  />
381
- </SortableList.Item>
386
+
387
+ </SortableList.Item>
382
388
  )}
383
389
  />
384
390
  ) : (
@@ -387,8 +393,10 @@ const OpeningQuestions = memo(() => {
387
393
  description={t('settingOpening.openingQuestions.empty')}
388
394
  />
389
395
  )}
390
- </div>
391
- </Flexbox>
396
+
397
+ </div>
398
+
399
+ </Flexbox>
392
400
  );
393
401
  });
394
402
 
@@ -440,7 +448,8 @@ const WelcomeMessage = () => {
440
448
  {chatItem}
441
449
  {/* Render guiding questions */}
442
450
  <OpeningQuestions mobile={mobile} questions={openingQuestions} />
443
- </Flexbox>
451
+
452
+ </Flexbox>
444
453
  ) : (
445
454
  chatItem
446
455
  );
@@ -1,3 +1,7 @@
1
+ ---
2
+ title: LobeChat 功能开发完全指南
3
+ ---
4
+
1
5
  # LobeChat 功能开发完全指南
2
6
 
3
7
  本文档旨在指导开发者了解如何在 LobeChat 中开发一块完整的功能需求。
@@ -362,7 +366,8 @@ const OpeningQuestions = memo(() => {
362
366
  {isRepeat && (
363
367
  <p className={styles.repeatError}>{t('settingOpening.openingQuestions.repeat')}</p>
364
368
  )}
365
- </Flexbox>
369
+
370
+ </Flexbox>
366
371
 
367
372
  <div className={styles.questionsList}>
368
373
  {openingQuestions.length > 0 ? (
@@ -378,7 +383,8 @@ const OpeningQuestions = memo(() => {
378
383
  onClick={() => removeQuestion(item.content)}
379
384
  type="text"
380
385
  />
381
- </SortableList.Item>
386
+
387
+ </SortableList.Item>
382
388
  )}
383
389
  />
384
390
  ) : (
@@ -387,8 +393,10 @@ const OpeningQuestions = memo(() => {
387
393
  description={t('settingOpening.openingQuestions.empty')}
388
394
  />
389
395
  )}
390
- </div>
391
- </Flexbox>
396
+
397
+ </div>
398
+
399
+ </Flexbox>
392
400
  );
393
401
  });
394
402
 
@@ -440,7 +448,8 @@ const WelcomeMessage = () => {
440
448
  {chatItem}
441
449
  {/* 渲染引导性问题 */}
442
450
  <OpeningQuestions mobile={mobile} questions={openingQuestions} />
443
- </Flexbox>
451
+
452
+ </Flexbox>
444
453
  ) : (
445
454
  chatItem
446
455
  );
@@ -1,3 +1,7 @@
1
+ ---
2
+ title: Directory Structure
3
+ ---
4
+
1
5
  # Directory Structure
2
6
 
3
7
  The directory structure of LobeChat is as follows:
@@ -73,17 +77,20 @@ app
73
77
  ### Architecture Explanation
74
78
 
75
79
  **Route Groups:**
80
+
76
81
  - `(backend)` - Contains all server-side API routes, middleware, and backend services
77
82
  - `[variants]` - Dynamic route group handling different platform variants and main application pages
78
83
  - `@modal` - Parallel routes for modal dialogs using Next.js parallel routing
79
84
 
80
85
  **Platform Organization:**
86
+
81
87
  - The architecture supports multiple platforms (web, desktop, mobile) through route organization
82
88
  - Desktop-specific routes are in the `desktop/` directory
83
89
  - Mobile-specific routes are organized under `(main)/(mobile)/`
84
90
  - Shared layouts and components are in `_layout/` directories
85
91
 
86
92
  **API Architecture:**
93
+
87
94
  - REST APIs in `(backend)/api/` and `(backend)/webapi/`
88
95
  - tRPC endpoints organized by runtime environment (edge, lambda, async, desktop)
89
96
  - Authentication and OIDC handling in dedicated route groups
@@ -1,3 +1,7 @@
1
+ ---
2
+ title: 目录架构
3
+ ---
4
+
1
5
  # 目录架构
2
6
 
3
7
  LobeChat 的文件夹目录架构如下:
@@ -73,17 +77,20 @@ app
73
77
  ### 架构说明
74
78
 
75
79
  **路由组:**
80
+
76
81
  - `(backend)` - 包含所有服务端 API 路由、中间件和后端服务
77
82
  - `[variants]` - 处理不同平台变体和主应用页面的动态路由组
78
83
  - `@modal` - 使用 Next.js 并行路由的模态框对话框并行路由
79
84
 
80
85
  **平台组织:**
86
+
81
87
  - 架构通过路由组织支持多个平台(Web、桌面端、移动端)
82
88
  - 桌面端专用路由位于 `desktop/` 目录中
83
89
  - 移动端专用路由组织在 `(main)/(mobile)/` 下
84
90
  - 共享布局和组件位于 `_layout/` 目录中
85
91
 
86
92
  **API 架构:**
93
+
87
94
  - `(backend)/api/` 和 `(backend)/webapi/` 中的 REST API
88
95
  - 按运行时环境组织的 tRPC 端点(edge、lambda、async、desktop)
89
96
  - 专用路由组中的身份验证和 OIDC 处理
@@ -1,3 +1,7 @@
1
+ ---
2
+ title: Resources and References
3
+ ---
4
+
1
5
  # Resources and References
2
6
 
3
7
  The design and development of LobeChat would not have been possible without the excellent projects in the community and ecosystem. We have used or referred to some outstanding resources and guides in the design and development process. Here are some key reference resources for developers to refer to during the development and learning process:
@@ -1,3 +1,7 @@
1
+ ---
2
+ title: 资源与参考
3
+ ---
4
+
1
5
  # 资源与参考
2
6
 
3
7
  LobeChat 的设计和开发离不开社区和生态中的优秀项目。我们在设计和开发过程中使用或参考了一些优秀的资源和指南。以下是一些主要的参考资源,供开发者在开发和学习过程中参考:
@@ -1,3 +1,7 @@
1
+ ---
2
+ title: Environment Setup Guide
3
+ ---
4
+
1
5
  # Environment Setup Guide
2
6
 
3
7
  Welcome to the LobeChat development environment setup guide.
@@ -1,3 +1,7 @@
1
+ ---
2
+ title: 环境设置指南
3
+ ---
4
+
1
5
  # 环境设置指南
2
6
 
3
7
  欢迎阅读 LobeChat 的开发环境设置指南。
@@ -1,3 +1,7 @@
1
+ ---
2
+ title: Testing Guide
3
+ ---
4
+
1
5
  # Testing Guide
2
6
 
3
7
  LobeChat's testing strategy includes unit testing and end-to-end (E2E) testing. Below are detailed explanations of each type of testing:
@@ -1,3 +1,7 @@
1
+ ---
2
+ title: 测试指南
3
+ ---
4
+
1
5
  # 测试指南
2
6
 
3
7
  LobeChat 的测试策略包括单元测试和端到端 (E2E) 测试。下面是每种测试的详细说明:
@@ -1,3 +1,7 @@
1
+ ---
2
+ title: Work with Server-Side Database
3
+ ---
4
+
1
5
  # Work with Server-Side Database
2
6
 
3
7
  LobeChat provides a battery-included experience with its client-side database.
@@ -19,7 +23,6 @@ cp docker-compose/local/.env.example docker-compose/local/.env
19
23
 
20
24
  Edit `docker-compose/local/.env` as needed for your development setup. This file contains all necessary environment variables for the Docker services and configures:
21
25
 
22
- - **Service Mode**: `NEXT_PUBLIC_SERVICE_MODE=server`
23
26
  - **Database**: PostgreSQL with connection string
24
27
  - **Authentication**: NextAuth with Casdoor SSO
25
28
  - **Storage**: MinIO S3-compatible storage
@@ -80,7 +83,6 @@ The image generation feature requires:
80
83
 
81
84
  - **PostgreSQL**: Stores metadata about generated images
82
85
  - **MinIO/S3**: Stores the actual image files
83
- - **Server Mode**: Required for file handling (`NEXT_PUBLIC_SERVICE_MODE=server`)
84
86
 
85
87
  ### Storage Configuration
86
88
 
@@ -138,14 +140,13 @@ await fetch(uploadUrl, {
138
140
  });
139
141
  ```
140
142
 
141
-
142
143
  ### Service URLs
143
144
 
144
145
  When running with Docker Compose development setup:
145
146
 
146
147
  - **PostgreSQL**: `postgres://postgres@localhost:5432/lobechat`
147
148
  - **MinIO API**: `http://localhost:9000`
148
- - **MinIO Console**: `http://localhost:9001` (admin/CHANGE_THIS_PASSWORD_IN_PRODUCTION)
149
+ - **MinIO Console**: `http://localhost:9001` (admin/CHANGE\_THIS\_PASSWORD\_IN\_PRODUCTION)
149
150
  - **Application**: `http://localhost:3010`
150
151
 
151
152
  ### Reset Services
@@ -164,7 +165,6 @@ docker-compose -f docker-compose.development.yml up -d
164
165
  pnpm db:migrate
165
166
  ```
166
167
 
167
-
168
168
  ### Troubleshooting
169
169
 
170
170
  #### Port Conflicts
@@ -1,3 +1,7 @@
1
+ ---
2
+ title: 使用服务端数据库
3
+ ---
4
+
1
5
  # 使用服务端数据库
2
6
 
3
7
  LobeChat 提供了内置的客户端数据库体验。
@@ -19,7 +23,6 @@ cp docker-compose/local/.env.example docker-compose/local/.env
19
23
 
20
24
  根据需要编辑 `docker-compose/local/.env` 文件以适应你的开发设置。此文件包含 Docker 服务所需的所有环境变量,配置了:
21
25
 
22
- - **服务模式**: `NEXT_PUBLIC_SERVICE_MODE=server`
23
26
  - **数据库**: 带连接字符串的 PostgreSQL
24
27
  - **身份验证**: 带 Casdoor SSO 的 NextAuth
25
28
  - **存储**: MinIO S3 兼容存储
@@ -80,7 +83,6 @@ docker-compose -f docker-compose.development.yml ps
80
83
 
81
84
  - **PostgreSQL**:存储生成图像的元数据
82
85
  - **MinIO/S3**:存储实际的图像文件
83
- - **服务器模式**:文件处理所需(`NEXT_PUBLIC_SERVICE_MODE=server`)
84
86
 
85
87
  ### 存储配置
86
88
 
@@ -138,14 +140,13 @@ await fetch(uploadUrl, {
138
140
  });
139
141
  ```
140
142
 
141
-
142
143
  ### 服务地址
143
144
 
144
145
  运行 Docker Compose 开发环境时:
145
146
 
146
147
  - **PostgreSQL**:`postgres://postgres@localhost:5432/lobechat`
147
148
  - **MinIO API**:`http://localhost:9000`
148
- - **MinIO 控制台**:`http://localhost:9001` (admin/CHANGE_THIS_PASSWORD_IN_PRODUCTION)
149
+ - **MinIO 控制台**:`http://localhost:9001` (admin/CHANGE\_THIS\_PASSWORD\_IN\_PRODUCTION)
149
150
  - **应用程序**:`http://localhost:3010`
150
151
 
151
152
  ### 重置服务
@@ -164,7 +165,6 @@ docker-compose -f docker-compose.development.yml up -d
164
165
  pnpm db:migrate
165
166
  ```
166
167
 
167
-
168
168
  ### 故障排除
169
169
 
170
170
  #### 端口冲突
@@ -1,3 +1,7 @@
1
+ ---
2
+ title: New Locale Guide
3
+ ---
4
+
1
5
  # New Locale Guide
2
6
 
3
7
  LobeChat uses [lobe-i18n](https://github.com/lobehub/lobe-cli-toolbox/tree/master/packages/lobe-i18n) as the i18n solution, which allows for quick addition of new language support in the application.
@@ -1,3 +1,7 @@
1
+ ---
2
+ title: 新语种添加指南
3
+ ---
4
+
1
5
  # 新语种添加指南
2
6
 
3
7
  LobeChat 使用 [lobe-i18n](https://github.com/lobehub/lobe-cli-toolbox/tree/master/packages/lobe-i18n) 作为 i18n 解决方案,可以在应用中快速添加新的语言支持。
@@ -1,3 +1,7 @@
1
+ ---
2
+ title: Internationalization Implementation Guide
3
+ ---
4
+
1
5
  # Internationalization Implementation Guide
2
6
 
3
7
  Welcome to the LobeChat Internationalization Implementation Guide. This document will guide you through understanding the internationalization mechanism of LobeChat, including file structure and how to add new languages. LobeChat uses `i18next` and `lobe-i18n` as the internationalization solution, aiming to provide users with seamless multilingual support.
@@ -1,3 +1,7 @@
1
+ ---
2
+ title: 国际化实现指南
3
+ ---
4
+
1
5
  # 国际化实现指南
2
6
 
3
7
  欢迎阅读 LobeChat 国际化实现指南。本文档将指导你了解 LobeChat 的国际化机制,包括文件结构、如何添加新语种。LobeChat 采用 `i18next` 和 `lobe-i18n` 作为国际化解决方案,旨在为用户提供流畅的多语言支持。
@@ -1,3 +1,7 @@
1
+ ---
2
+ title: Lighthouse Reports
3
+ ---
4
+
1
5
  # Lighthouse Reports
2
6
 
3
7
  ## Chat Page
@@ -1,3 +1,7 @@
1
+ ---
2
+ title: Lighthouse 测试报告
3
+ ---
4
+
1
5
  # Lighthouse 测试报告
2
6
 
3
7
  ## Chat 聊天页面
@@ -1,3 +1,7 @@
1
+ ---
2
+ title: Technical Development Getting Started Guide
3
+ ---
4
+
1
5
  # Technical Development Getting Started Guide
2
6
 
3
7
  Welcome to the LobeChat Technical Development Getting Started Guide. LobeChat is an AI conversation application built on the Next.js framework, incorporating a range of technology stacks to achieve diverse functionalities and features. This guide will detail the main technical components of LobeChat and how to configure and use these technologies in your development environment.
@@ -1,3 +1,7 @@
1
+ ---
2
+ title: 技术开发上手指南
3
+ ---
4
+
1
5
  # 技术开发上手指南
2
6
 
3
7
  欢迎来到 LobeChat 技术开发上手指南。LobeChat 是一款基于 Next.js 框架构建的 AI 会话应用,它汇集了一系列的技术栈,以实现多样化的功能和特性。本指南将详细介绍 LobeChat 的主要技术组成,以及如何在你的开发环境中配置和使用这些技术。
@@ -1,3 +1,7 @@
1
+ ---
2
+ title: Best Practices for State Management
3
+ ---
4
+
1
5
  # Best Practices for State Management
2
6
 
3
7
  LobeChat differs from traditional CRUD web applications in that it involves a large amount of rich interactive capabilities. Therefore, it is crucial to design a data flow architecture that is easy to develop and maintain. This document will introduce the best practices for data flow management in LobeChat.
@@ -167,8 +171,6 @@ const createStore: StateCreator<SessionStore, [['zustand/devtools', never]]> = (
167
171
  ...createSessionSlice(...parameters),
168
172
  });
169
173
 
170
-
171
-
172
174
  // =============== Implement useStore ============ //
173
175
 
174
176
  export const useSessionStore = createWithEqualityFn<SessionStore>()(
@@ -1,3 +1,7 @@
1
+ ---
2
+ title: 状态管理最佳实践
3
+ ---
4
+
1
5
  # 状态管理最佳实践
2
6
 
3
7
  LobeChat 不同于传统 CRUD 的网页,存在大量的富交互能力,如何设计一个易于开发与易于维护的数据流架构非常重要。本篇文档将介绍 LobeChat 中的数据流管理最佳实践。
@@ -159,8 +163,6 @@ const createStore: StateCreator<SessionStore, [['zustand/devtools', never]]> = (
159
163
  ...createSessionSlice(...parameters),
160
164
  });
161
165
 
162
-
163
-
164
166
  // =============== 实装 useStore ============ //
165
167
 
166
168
  export const useSessionStore = createWithEqualityFn<SessionStore>()(
@@ -1,3 +1,7 @@
1
+ ---
2
+ title: Data Store Selector
3
+ ---
4
+
1
5
  # Data Store Selector
2
6
 
3
7
  Selectors are data retrieval modules under the LobeChat data flow development framework. Their role is to extract data from the store using specific business logic for consumption by components.
@@ -51,7 +55,8 @@ import { pluginSelectors } from '@/store/plugin/selectors';
51
55
  const Render = ({ plugins }) => {
52
56
  const list = usePluginStore(pluginSelectors.displayPluginList);
53
57
 
54
- return <> ... </>;
58
+ return <> ...
59
+ </>;
55
60
  };
56
61
  ```
57
62
 
@@ -1,3 +1,7 @@
1
+ ---
2
+ title: 数据存储取数模块
3
+ ---
4
+
1
5
  # 数据存储取数模块
2
6
 
3
7
  selectors 是 LobeChat 数据流研发框架下的取数模块,它的作用是从 store 中以特定特务逻辑取出数据,供组件消费使用。
@@ -32,7 +36,8 @@ import { pluginSelectors } from '@/store/tool/selectors';
32
36
  const Render = () => {
33
37
  const list = useToolStore(pluginSelectors.installedPluginMetaList);
34
38
 
35
- return <> ... </>;
39
+ return <> ...
40
+ </>;
36
41
  };
37
42
  ```
38
43
 
@@ -1,3 +1,7 @@
1
+ ---
2
+ title: 集成测试指南
3
+ ---
4
+
1
5
  # 集成测试指南
2
6
 
3
7
  ## 概述
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  title: Integrating Data Analytics Services in LobeChat for User Usage Analysis
3
3
  description: >-
4
- Learn how to integrate free/open-source data analytics services in LobeChat to collect user usage data efficiently.
5
-
4
+ Learn how to integrate free/open-source data analytics services in LobeChat to
5
+ collect user usage data efficiently.
6
6
  tags:
7
7
  - LobeChat
8
8
  - data analytics
@@ -0,0 +1,132 @@
1
+ ---
2
+ title: Configuring Apple Authentication for LobeChat
3
+ description: >-
4
+ Learn how to configure Apple Sign In for LobeChat, including creating
5
+ credentials in Apple Developer Portal and setting up environment variables.
6
+ tags:
7
+ - Apple
8
+ - Authentication
9
+ - LobeChat
10
+ - Single Sign-On
11
+ ---
12
+
13
+ # Configuring Apple Authentication
14
+
15
+ <Callout type={'warning'}>
16
+ Apple Sign In requires a paid Apple Developer account ($99/year) and does not
17
+ support localhost. You must use a domain with HTTPS for both development and
18
+ production.
19
+ </Callout>
20
+
21
+ <Steps>
22
+ ### Create an App ID
23
+
24
+ 1. Go to [Apple Developer Portal](https://developer.apple.com/account/resources/identifiers/list)
25
+ 2. Navigate to **Certificates, Identifiers & Profiles** > **Identifiers**
26
+ 3. Click **+** to register a new identifier
27
+ 4. Select **App IDs** > **App** type > **Continue**
28
+ 5. Fill in:
29
+ - **Description**: e.g., `LobeChat`
30
+ - **Bundle ID**: e.g., `com.yourcompany.lobechat`
31
+ 6. Enable **Sign In with Apple** capability
32
+ 7. Click **Continue** > **Register**
33
+
34
+ ### Create a Services ID
35
+
36
+ 1. Go back to **Identifiers**, click **+**
37
+ 2. Select **Services IDs** > **Continue**
38
+ 3. Fill in:
39
+ - **Description**: e.g., `LobeChat Web`
40
+ - **Identifier**: e.g., `com.yourcompany.lobechat.web` (this is your Client ID)
41
+ 4. Click **Continue** > **Register**
42
+
43
+ ### Configure Services ID
44
+
45
+ 1. Click on the created Services ID
46
+ 2. Enable **Sign In with Apple**
47
+ 3. Click **Configure**
48
+ 4. Select your Primary App ID
49
+ 5. Add domains and callback URLs:
50
+ - **Domains**: `your-domain.com`
51
+ - **Return URLs**: `https://your-domain.com/api/auth/callback/apple`
52
+ 6. Click **Save** > **Continue** > **Save**
53
+
54
+ <Callout type={'info'}>
55
+ Callback URL format:
56
+
57
+ - Production: `https://your-domain.com/api/auth/callback/apple`
58
+ - Apple does **not** support localhost or HTTP URLs
59
+ </Callout>
60
+
61
+ ### Create a Sign In Key
62
+
63
+ 1. Navigate to **Keys**, click **+**
64
+ 2. Fill in key name
65
+ 3. Enable **Sign In with Apple**, click **Configure**
66
+ 4. Select your Primary App ID
67
+ 5. Click **Save** > **Continue** > **Register**
68
+ 6. **Download the key file** (`.p8`) - you can only download it once
69
+ 7. Note down:
70
+ - **Key ID**: shown on the key page
71
+ - **Team ID**: shown in top right corner of developer portal
72
+
73
+ ### Generate Client Secret
74
+
75
+ Apple requires a JWT as the client secret. Generate it using your `.p8` key file:
76
+
77
+ ```js
78
+ // Example using Node.js
79
+ const jwt = require('jsonwebtoken');
80
+ const fs = require('fs');
81
+
82
+ const privateKey = fs.readFileSync('AuthKey_XXXXX.p8');
83
+ const token = jwt.sign({}, privateKey, {
84
+ algorithm: 'ES256',
85
+ expiresIn: '180d', // Max 6 months
86
+ issuer: 'YOUR_TEAM_ID',
87
+ audience: 'https://appleid.apple.com',
88
+ subject: 'YOUR_SERVICES_ID', // Client ID
89
+ keyid: 'YOUR_KEY_ID',
90
+ });
91
+ ```
92
+
93
+ <Callout type={'warning'}>
94
+ The JWT expires after maximum 180 days. You need to regenerate and update it
95
+ before expiration.
96
+ </Callout>
97
+
98
+ ### Configure Environment Variables
99
+
100
+ | Environment Variable | Type | Description |
101
+ | ---------------------------------- | -------- | --------------------------------------------------------------- |
102
+ | `AUTH_SECRET` | Required | Session encryption key, generate with `openssl rand -base64 32` |
103
+ | `AUTH_SSO_PROVIDERS` | Required | Set to `apple` |
104
+ | `AUTH_APPLE_CLIENT_ID` | Required | Your Services ID |
105
+ | `AUTH_APPLE_CLIENT_SECRET` | Required | The generated JWT |
106
+ | `AUTH_APPLE_APP_BUNDLE_IDENTIFIER` | Optional | App Bundle ID (for native app integration) |
107
+
108
+ <Callout type={'tip'}>
109
+ Go to [📘 Environment Variables](/docs/self-hosting/environment-variables/auth#apple)
110
+ for detailed information.
111
+ </Callout>
112
+ </Steps>
113
+
114
+ <Callout type={'info'}>
115
+ After successful deployment, users will be able to authenticate with Apple and
116
+ use LobeChat.
117
+ </Callout>
118
+
119
+ ## Common Issues
120
+
121
+ ### localhost Not Supported
122
+
123
+ Apple Sign In does not support localhost or non-HTTPS URLs. For local development, use a tunneling service like ngrok or deploy to a staging environment with HTTPS.
124
+
125
+ ### Secret Expiration
126
+
127
+ The JWT client secret expires after 180 days maximum. Set a reminder to regenerate it before expiration.
128
+
129
+ ## Related Resources
130
+
131
+ - [Apple Developer Portal](https://developer.apple.com/account)
132
+ - [Sign In with Apple Documentation](https://developer.apple.com/sign-in-with-apple/)