@lobehub/chat 0.128.2 → 0.128.4

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 (146) hide show
  1. package/.github/workflows/issue-close-require.yml +3 -3
  2. package/.github/workflows/issues-translate.yml +3 -3
  3. package/.github/workflows/wiki-sync.yml +2 -2
  4. package/.husky/commit-msg +0 -3
  5. package/.husky/pre-commit +0 -3
  6. package/.i18nrc.js +2 -2
  7. package/CHANGELOG.md +50 -0
  8. package/README.md +3 -3
  9. package/README.zh-CN.md +3 -3
  10. package/contributing/Basic/Feature-Development.md +713 -0
  11. package/{docs/Development → contributing/Basic}/Feature-Development.zh-CN.md +2 -2
  12. package/{docs/Development → contributing/Basic}/Intro.zh-CN.md +5 -5
  13. package/{docs → contributing}/Home.md +21 -30
  14. package/{docs/Development → contributing/Internationalization}/Internationalization-Implementation.zh-CN.md +1 -1
  15. package/{docs → contributing}/_Sidebar.md +19 -30
  16. package/docs/agents/concepts.mdx +18 -0
  17. package/docs/agents/concepts.zh-CN.mdx +17 -0
  18. package/docs/agents/custom-agent.mdx +34 -0
  19. package/docs/agents/custom-agent.zh-CN.mdx +31 -0
  20. package/docs/agents/model.mdx +68 -0
  21. package/docs/agents/model.zh-CN.mdx +64 -0
  22. package/docs/agents/prompt.mdx +96 -0
  23. package/docs/agents/prompt.zh-CN.mdx +97 -0
  24. package/docs/agents/topics.mdx +7 -0
  25. package/docs/agents/topics.zh-CN.mdx +6 -0
  26. package/docs/common-errors/no-v1-suffix.mdx +18 -0
  27. package/docs/common-errors/no-v1-suffix.zh-CN.mdx +17 -0
  28. package/docs/common-errors/proxy-with-unable-to-verify-leaf-signature.mdx +70 -0
  29. package/docs/{Deployment/Common-Error.zh-CN.md → common-errors/proxy-with-unable-to-verify-leaf-signature.zh-CN.mdx} +8 -26
  30. package/docs/environment-variables/common.mdx +215 -0
  31. package/docs/environment-variables/common.zh-CN.mdx +214 -0
  32. package/docs/environment-variables/model-provider.mdx +135 -0
  33. package/docs/environment-variables/model-provider.zh-CN.mdx +133 -0
  34. package/docs/package.json +5 -0
  35. package/docs/plugins/basic-usage.mdx +40 -0
  36. package/docs/{Usage/Plugins.zh-CN.md → plugins/basic-usage.zh-CN.mdx} +7 -21
  37. package/docs/plugins/custom-plugin.mdx +27 -0
  38. package/docs/plugins/custom-plugin.zh-CN.mdx +26 -0
  39. package/docs/plugins/plugin-development.mdx +262 -0
  40. package/docs/{Plugins/Plugin-Development.zh-CN.md → plugins/plugin-development.zh-CN.mdx} +9 -33
  41. package/docs/plugins/plugin-store.mdx +10 -0
  42. package/docs/plugins/plugin-store.zh-CN.mdx +9 -0
  43. package/docs/self-hosting/analytics.mdx +20 -0
  44. package/docs/{Deployment/Analytics.zh-CN.md → self-hosting/analytics.zh-CN.mdx} +5 -8
  45. package/docs/self-hosting/authentication.mdx +94 -0
  46. package/docs/self-hosting/authentication.zh-CN.mdx +90 -0
  47. package/docs/self-hosting/deploy-with-azure-openai.mdx +48 -0
  48. package/docs/{Deployment/Deploy-with-Azure-OpenAI.zh-CN.md → self-hosting/deploy-with-azure-openai.zh-CN.mdx} +16 -21
  49. package/docs/self-hosting/docker-compose.mdx +121 -0
  50. package/docs/self-hosting/docker-compose.zh-CN.mdx +121 -0
  51. package/docs/self-hosting/docker.mdx +152 -0
  52. package/docs/self-hosting/docker.zh-CN.mdx +149 -0
  53. package/docs/self-hosting/environment-variable.mdx +340 -0
  54. package/docs/{Deployment/Environment-Variable.zh-CN.md → self-hosting/environment-variable.zh-CN.mdx} +43 -57
  55. package/docs/self-hosting/upstream-sync.mdx +66 -0
  56. package/docs/{Deployment/Upstream-Sync.zh-CN.md → self-hosting/upstream-sync.zh-CN.mdx} +23 -21
  57. package/docs/self-hosting/vercel.mdx +39 -0
  58. package/docs/self-hosting/vercel.zh-CN.mdx +39 -0
  59. package/docs/usage/agent-market.mdx +35 -0
  60. package/docs/usage/agent-market.zh-CN.mdx +32 -0
  61. package/docs/usage/mobile.mdx +8 -0
  62. package/docs/usage/mobile.zh-CN.mdx +7 -0
  63. package/docs/usage/more.mdx +21 -0
  64. package/docs/usage/more.zh-CN.mdx +19 -0
  65. package/docs/usage/plugin-system.mdx +84 -0
  66. package/docs/usage/plugin-system.zh-CN.mdx +77 -0
  67. package/docs/usage/pwa.mdx +21 -0
  68. package/docs/usage/pwa.zh-CN.mdx +21 -0
  69. package/docs/usage/text-to-image.mdx +5 -0
  70. package/docs/usage/text-to-image.zh-CN.mdx +6 -0
  71. package/docs/usage/theme.mdx +17 -0
  72. package/docs/usage/theme.zh-CN.mdx +15 -0
  73. package/docs/usage/tts.mdx +26 -0
  74. package/docs/usage/tts.zh-CN.mdx +24 -0
  75. package/docs/usage/vision.mdx +8 -0
  76. package/docs/usage/vision.zh-CN.mdx +7 -0
  77. package/locales/ar/common.json +1 -0
  78. package/locales/de-DE/common.json +1 -0
  79. package/locales/en-US/common.json +1 -0
  80. package/locales/es-ES/common.json +1 -0
  81. package/locales/fr-FR/common.json +1 -0
  82. package/locales/it-IT/common.json +1 -0
  83. package/locales/ja-JP/common.json +1 -0
  84. package/locales/ko-KR/common.json +1 -0
  85. package/locales/nl-NL/common.json +1 -0
  86. package/locales/pl-PL/common.json +1 -0
  87. package/locales/pt-BR/common.json +1 -0
  88. package/locales/ru-RU/common.json +1 -0
  89. package/locales/tr-TR/common.json +1 -0
  90. package/locales/vi-VN/common.json +1 -0
  91. package/locales/zh-CN/common.json +1 -0
  92. package/locales/zh-TW/common.json +1 -0
  93. package/next.config.mjs +5 -0
  94. package/package.json +6 -5
  95. package/scripts/docsWorkflow/const.ts +1 -1
  96. package/scripts/docsWorkflow/toc.ts +6 -6
  97. package/src/app/welcome/(desktop)/features/Footer.tsx +5 -3
  98. package/src/config/client.ts +6 -0
  99. package/src/const/url.ts +10 -1
  100. package/src/features/PluginStore/OnlineList.tsx +2 -16
  101. package/src/features/SideBar/BottomActions.tsx +11 -10
  102. package/src/locales/default/common.ts +1 -0
  103. package/docs/Deployment/Analytics.md +0 -20
  104. package/docs/Deployment/Authentication.md +0 -80
  105. package/docs/Deployment/Authentication.zh-CN.md +0 -80
  106. package/docs/Deployment/Common-Error.md +0 -87
  107. package/docs/Deployment/Deploy-with-Azure-OpenAI.md +0 -54
  108. package/docs/Deployment/Docker-Deployment.md +0 -219
  109. package/docs/Deployment/Docker-Deployment.zh-CN.md +0 -217
  110. package/docs/Deployment/Environment-Variable.md +0 -362
  111. package/docs/Deployment/Upstream-Sync.md +0 -62
  112. package/docs/Plugins/Plugin-Development.md +0 -287
  113. package/docs/Usage/Plugins.md +0 -53
  114. package/docs/Usage/Usage-Agents.md +0 -201
  115. package/docs/Usage/Usage-Agents.zh-CN.md +0 -202
  116. package/docs/Usage/Usage-Topics.md +0 -31
  117. package/docs/Usage/Usage-Topics.zh-CN.md +0 -31
  118. /package/{docs/Development → contributing/Basic}/Add-New-Authentication-Providers.md +0 -0
  119. /package/{docs/Development → contributing/Basic}/Add-New-Authentication-Providers.zh-CN.md +0 -0
  120. /package/{docs/Development → contributing/Basic}/Architecture.md +0 -0
  121. /package/{docs/Development → contributing/Basic}/Architecture.zh-CN.md +0 -0
  122. /package/{docs/Development → contributing/Basic}/Chat-API.md +0 -0
  123. /package/{docs/Development → contributing/Basic}/Chat-API.zh-CN.md +0 -0
  124. /package/{docs/Development → contributing/Basic}/Contributing-Guidelines.md +0 -0
  125. /package/{docs/Development → contributing/Basic}/Contributing-Guidelines.zh-CN.md +0 -0
  126. /package/{docs/Development → contributing/Basic}/Feature-Development-Frontend.md +0 -0
  127. /package/{docs/Development → contributing/Basic}/Feature-Development-Frontend.zh-CN.md +0 -0
  128. /package/{docs/Development → contributing/Basic}/Folder-Structure.md +0 -0
  129. /package/{docs/Development → contributing/Basic}/Folder-Structure.zh-CN.md +0 -0
  130. /package/{docs/Development → contributing/Basic}/Intro.md +0 -0
  131. /package/{docs/Development → contributing/Basic}/Resources.md +0 -0
  132. /package/{docs/Development → contributing/Basic}/Resources.zh-CN.md +0 -0
  133. /package/{docs/Development → contributing/Basic}/Setup-Development.md +0 -0
  134. /package/{docs/Development → contributing/Basic}/Setup-Development.zh-CN.md +0 -0
  135. /package/{docs/Development → contributing/Basic}/Test.md +0 -0
  136. /package/{docs/Development → contributing/Basic}/Test.zh-CN.md +0 -0
  137. /package/{docs/Development → contributing/Internationalization}/Add-New-Locale.md +0 -0
  138. /package/{docs/Development → contributing/Internationalization}/Add-New-Locale.zh-CN.md +0 -0
  139. /package/{docs/Development → contributing/Internationalization}/Internationalization-Implementation.md +0 -0
  140. /package/{docs → contributing}/Others/Lighthouse.md +0 -0
  141. /package/{docs → contributing}/Others/Lighthouse.zh-CN.md +0 -0
  142. /package/{docs/Development → contributing/State-Management}/State-Management-Intro.md +0 -0
  143. /package/{docs/Development → contributing/State-Management}/State-Management-Intro.zh-CN.md +0 -0
  144. /package/{docs/Development → contributing/State-Management}/State-Management-Selectors.md +0 -0
  145. /package/{docs/Development → contributing/State-Management}/State-Management-Selectors.zh-CN.md +0 -0
  146. /package/{docs → contributing}/_Footer.md +0 -0
@@ -0,0 +1,97 @@
1
+ import { Callout } from 'nextra/components';
2
+
3
+ # Prompt 使用指南
4
+
5
+ ## Prompt 基本概念
6
+
7
+ 生成式 AI 非常有用,但它需要人类指导。通常情况下,生成式 AI 能就像公司新来的实习生一样,非常有能力,但需要清晰的指示才能做得好。能够正确地指导生成式 AI 是一项非常强大的技能。你可以通过发送一个 prompt 来指导生成式 AI,这通常是一个文本指令。Prompt 是向助手提供的输入,它会影响输出结果。一个好的 Prompt 应该是结构化的,清晰的,简洁的,并且具有指向性。
8
+
9
+ ## 如何写好一个结构化 prompt
10
+
11
+ <Callout type={'info'}>
12
+ 结构化 prompt 是指 prompt 的构造应该有明确的逻辑和结构。例如,如果你想让模型生成一篇文章,你的
13
+ prompt 可能需要包括文章的主题,文章的大纲,文章的风格等信息。
14
+ </Callout>
15
+
16
+ 让我们看一个基本的讨论问题的例子:
17
+
18
+ > _"我们星球面临的最紧迫的环境问题是什么,个人可以采取哪些措施来帮助解决这些问题?"_
19
+
20
+ 我们可以将其转化为简单的助手提示,将回答以下问题:放在前面。
21
+
22
+ ```prompt
23
+ 回答以下问题:
24
+ 我们星球面临的最紧迫的环境问题是什么,个人可以采取哪些措施来帮助解决这些问题?
25
+ ```
26
+
27
+ 由于这个提示生成的结果并不一致,有些只有一两个句子。一个典型的讨论回答应该有多个段落,因此这些结果并不理想。一个好的提示应该给出**具体的格式和内容指令**。您需要消除语言中的歧义以提高一致性和质量。这是一个更好的提示。
28
+
29
+ ```prompt
30
+ 写一篇高度详细的论文,包括引言、正文和结论段,回答以下问题:
31
+ 我们星球面临的最紧迫的环境问题是什么,
32
+ 个人可以采取哪些措施来帮助解决这些问题?
33
+ ```
34
+
35
+ 第二个提示生成了更长的输出和更好的结构。提示中使用 “论文” 一词是有意的,因为助手可以理解论文的定义,因此更有可能生成连贯的、结构化的回答。
36
+
37
+ <br />
38
+
39
+ ## 如何提升其质量和效果
40
+
41
+ <Callout type={'info'}>
42
+ 提升 prompt 质量和效果的方法主要有以下几点:
43
+
44
+ - **尽量明确你的需求:** 模型的输出会尽可能满足你的需求,所以如果你的需求不明确,输出可能会不如预期。
45
+ - **使用正确的语法和拼写:** 模型会尽可能模仿你的语言风格,所以如果你的语言风格有问题,输出可能也会有问题。
46
+ - **提供足够的上下文信息:** 模型会根据你提供的上下文信息生成输出,所以如果你提供的上下文信息不足,可能无法生成你想要的结果。
47
+
48
+ </Callout>
49
+
50
+ 在为讨论问题制定有效的提示后,您现在需要细化生成的结果。这可能涉及到调整输出以符合诸如字数等限制,或将不同生成的结果的概念组合在一起。
51
+
52
+ 迭代的一个简单方法是生成多个输出并查看它们,以了解正在使用的概念和结构。一旦评估了输出,您就可以选择最合适的输出并将它们组合成一个连贯的回答。另一种迭代的方法是逐步开始,然后**逐步扩展**。这需要不止一个提示:一个起始提示,用于撰写最初的一两段,然后是其他提示,以扩展已经写过的内容。以下是一个潜在的哲学讨论问题:
53
+
54
+ > _"数学是发明还是发现?用仔细的推理来解释你的答案。"_
55
+
56
+ 将其添加到一个简单的提示中,如下所示:
57
+
58
+ ```prompt
59
+ 写一个起始段回答以下问题:
60
+ 数学是发明还是发现?用仔细的推理来解释你的答案。
61
+ ```
62
+
63
+ 生成了一些回答,找到了一个我们喜欢的:
64
+
65
+ ```prompt
66
+ 哲学家和数学家之间争论不休,数学是发明还是发现。
67
+ 一些人认为,数学的概念和原则独立于人类思维存在,因此可以被认为是被发现而不是被发明的。
68
+ 例如,数字、比率和几何形状的概念在自然界中被观察到,可以被抽象化和系统化地研究。
69
+ ```
70
+
71
+ 是一个不错的开端。然后使用另一个提示来扩展:
72
+
73
+ ```prompt
74
+ 我正在撰写一篇详细的短文,回答以下提示:
75
+ 数学是发明还是发现?用仔细的推理来解释你的答案。这是我目前的情况: 哲学家和数学家之间争论不休,数学是发明还是发现。
76
+ 一些人认为,数学的概念和原则独立于人类思维存在,因此可以被认为是被发现而不是被发明的。
77
+ 例如,数字、比率和几何形状的概念在自然界中被观察到,可以被抽象化和系统化地研究。写下我文章的下一段。
78
+ ```
79
+
80
+ 使用此提示生成了几个扩展,并选择了一个我喜欢的,最终得到了以下结果:
81
+
82
+ ```prompt
83
+ 哲学家和数学家之间争论不休,数学是发明还是发现。
84
+ 一些人认为,数学的概念和原则独立于人类思维存在,因此可以被认为是被发现而不是被发明的。
85
+ 例如,数字、比率和几何形状的概念在自然界中被观察到,可以被抽象化和系统化地研究。
86
+ 另一方面,有人认为数学在很大程度上是人类思维的发明。
87
+ 数学原理基于逻辑推理,这是人类思维的一个特征。
88
+ 例如,欧几里德几何基于抽象的公理和前提,被接受为真实而无需证明。
89
+ 因此,可以认为几何是人类思维的发明,而不是一种发现。
90
+ 同样,数学公式和方程用于模拟和预测物理现象,这又是人类推理的结果。
91
+ ```
92
+
93
+ 使用扩展提示,我们可以逐步地写作并在每个步骤上进行迭代。这对于需要**生成更高质量的输出并希望逐步修改**的情况非常有用。
94
+
95
+ ## 扩展阅读
96
+
97
+ - **Learn Prompting**: https://learnprompting.org/zh-Hans/docs/intro
@@ -0,0 +1,7 @@
1
+ # Topic Usage Guide
2
+
3
+ ![](https://github-production-user-asset-6210df.s3.amazonaws.com/17870709/279602496-fd72037a-735e-4cc2-aa56-2994bceaba81.png)
4
+
5
+ - **Save Topic:** During a conversation, if you want to save the current context and start a new topic, you can click the save button next to the send button.
6
+ - **Topic List:** Clicking on a topic in the list allows for quick switching of historical conversation records and continuing the conversation. You can also use the star icon <kbd>⭐️</kbd> to pin favorite topics to the top, or use the more button on the right to rename or delete topics.
7
+
@@ -0,0 +1,6 @@
1
+ # 话题使用指南
2
+
3
+ ![](https://github-production-user-asset-6210df.s3.amazonaws.com/17870709/279602496-fd72037a-735e-4cc2-aa56-2994bceaba81.png)
4
+
5
+ - **保存话题:** 在聊天过程中,如果想要保存当前上下文并开启新的话题,可以点击发送按钮旁边的保存按钮。
6
+ - **话题列表:** 点击列表中的话题可以快速切换历史对话记录,并继续对话。你还可以通过点击星标图标 <kbd>⭐️</kbd> 将话题收藏置顶,或者通过右侧更多按钮对话题进行重命名和删除操作。
@@ -0,0 +1,18 @@
1
+ # Configuring `OPENAI_PROXY_URL` Environment Variable but Getting Empty Response
2
+
3
+ ### Problem Description
4
+
5
+ After configuring the `OPENAI_PROXY_URL` environment variable, you may encounter a situation where the AI returns an empty message. This may be due to an incorrect configuration of `OPENAI_PROXY_URL`.
6
+
7
+ ### Solution
8
+
9
+ Recheck and confirm whether `OPENAI_PROXY_URL` is set correctly, including whether the `/v1` suffix is added correctly (if required).
10
+
11
+ ### Related Discussion Links
12
+
13
+ - [Why is the return value blank after configuring environment variables in Docker?](https://github.com/lobehub/lobe-chat/discussions/623)
14
+ - [Reasons for errors when using third-party interfaces](https://github.com/lobehub/lobe-chat/discussions/734)
15
+ - [No response when the proxy server address is filled in for chat](https://github.com/lobehub/lobe-chat/discussions/1065)
16
+
17
+ If the problem still cannot be resolved, it is recommended to raise the issue in the community, providing relevant logs and configuration information for other developers or maintainers to offer assistance.
18
+
@@ -0,0 +1,17 @@
1
+ # 配置 `OPENAI_PROXY_URL` 环境变量但返回值为空
2
+
3
+ ### 问题描述
4
+
5
+ 配置 `OPENAI_PROXY_URL` 环境变量后,可能会遇到 AI 的返回消息为空的情况。这可能是由于 `OPENAI_PROXY_URL` 配置不正确导致。
6
+
7
+ ### 解决方案
8
+
9
+ 重新检查并确认 `OPENAI_PROXY_URL` 是否设置正确,包括是否正确地添加了 `/v1` 后缀(如果需要)。
10
+
11
+ ### 相关讨论链接
12
+
13
+ - [Docker 安装,配置好环境变量后,为何返回值是空白?](https://github.com/lobehub/lobe-chat/discussions/623)
14
+ - [使用第三方接口报错的原因](https://github.com/lobehub/lobe-chat/discussions/734)
15
+ - [代理服务器地址填了聊天没任何反应](https://github.com/lobehub/lobe-chat/discussions/1065)
16
+
17
+ 如果问题依旧无法解决,建议在社区中提出问题,附上相关日志和配置信息,以便其他开发者或维护者提供帮助。
@@ -0,0 +1,70 @@
1
+ # Encounter `UNABLE_TO_VERIFY_LEAF_SIGNATURE` Error When Using Proxy
2
+
3
+ ## Problem Description
4
+
5
+ When deploying privately and using a proxy (e.g., Surge) for network requests, you may encounter certificate verification errors.
6
+
7
+ The error message may look like this:
8
+
9
+ ```bash
10
+ [TypeError: fetch failed] {
11
+ cause: [Error: unable to verify the first certificate] {
12
+ code: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE'
13
+ }
14
+ }
15
+ ```
16
+
17
+ Or:
18
+
19
+ ```json
20
+ {
21
+ "endpoint": "https://api.openai.com/v1",
22
+ "error": {
23
+ "cause": {
24
+ "code": "UNABLE_TO_VERIFY_LEAF_SIGNATURE"
25
+ }
26
+ }
27
+ }
28
+ ```
29
+
30
+ This problem typically occurs when using a proxy server with a self-signed certificate or a man-in-the-middle certificate that is not trusted by Node.js by default.
31
+
32
+ ## Solution
33
+
34
+ To resolve this issue, you can bypass Node.js certificate validation by adding an environment variable when starting the application. Specifically, you can add `NODE_TLS_REJECT_UNAUTHORIZED=0` to the startup command. For example:
35
+
36
+ ```bash
37
+ NODE_TLS_REJECT_UNAUTHORIZED=0 npm run start
38
+ ```
39
+
40
+ Alternatively, when running in a Docker container, you can set the environment variable in the Dockerfile or docker-compose.yml:
41
+
42
+ ```dockerfile
43
+ # In the Dockerfile
44
+ ENV NODE_TLS_REJECT_UNAUTHORIZED=0
45
+ ```
46
+
47
+ ```yaml
48
+ # In the docker-compose.yml
49
+ environment:
50
+ - NODE_TLS_REJECT_UNAUTHORIZED=0
51
+ ```
52
+
53
+ Example Docker run command:
54
+
55
+ ```bash
56
+ docker run -e NODE_TLS_REJECT_UNAUTHORIZED=0 <other parameters> <image name>
57
+ ```
58
+
59
+ Please note that this method reduces security as it allows Node.js to accept unverified certificates. Therefore, it is only recommended for use in privately deployed environments with complete trust and should be reverted to the default certificate validation settings after resolving the certificate issue.
60
+
61
+ ## More Secure Alternatives
62
+
63
+ If possible, it is recommended to address the certificate issue using the following methods:
64
+
65
+ 1. Ensure all man-in-the-middle certificates are correctly installed on the proxy server and the corresponding clients.
66
+ 2. Replace self-signed or man-in-the-middle certificates with valid certificates issued by trusted certificate authorities.
67
+ 3. Properly configure the certificate chain in the code to ensure Node.js can validate to the root certificate.
68
+
69
+ Implementing these methods can resolve certificate validation issues without compromising security.
70
+
@@ -1,30 +1,12 @@
1
- # 常见问题
1
+ # 使用代理时遇到 `UNABLE_TO_VERIFY_LEAF_SIGNATURE` 错误
2
2
 
3
- ## 配置 `OPENAI_PROXY_URL` 环境变量但返回值为空
3
+ ## 问题描述
4
4
 
5
- ### 问题描述
5
+ 在私有化部署时,使用代理(例如:Surge)进行网络请求可能会遇到证书验证错误。
6
6
 
7
- 配置 `OPENAI_PROXY_URL` 环境变量后,可能会遇到 AI 的返回消息为空的情况。这可能是由于 `OPENAI_PROXY_URL` 配置不正确导致。
7
+ 此时错误信息可能如下:
8
8
 
9
- ### 解决方案
10
-
11
- 重新检查并确认 `OPENAI_PROXY_URL` 是否设置正确,包括是否正确地添加了 `/v1` 后缀(如果需要)。
12
-
13
- ### 相关讨论链接
14
-
15
- - [Docker 安装,配置好环境变量后,为何返回值是空白?](https://github.com/lobehub/lobe-chat/discussions/623)
16
- - [使用第三方接口报错的原因](https://github.com/lobehub/lobe-chat/discussions/734)
17
- - [代理服务器地址填了聊天没任何反应](https://github.com/lobehub/lobe-chat/discussions/1065)
18
-
19
- 如果问题依旧无法解决,建议在社区中提出问题,附上相关日志和配置信息,以便其他开发者或维护者提供帮助。
20
-
21
- ## 使用代理中转请求时(例如:Surge),报 `UNABLE_TO_VERIFY_LEAF_SIGNATURE` 错误
22
-
23
- ### 问题描述
24
-
25
- 在私有化部署时,进行网络请求可能会遇到证书验证错误。错误信息可能如下:
26
-
27
- ```
9
+ ```bash
28
10
  [TypeError: fetch failed] {
29
11
  cause: [Error: unable to verify the first certificate] {
30
12
  code: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE'
@@ -34,7 +16,7 @@
34
16
 
35
17
  或者是:
36
18
 
37
- ```
19
+ ```json
38
20
  {
39
21
  "endpoint": "https://api.openai.com/v1",
40
22
  "error": {
@@ -47,7 +29,7 @@
47
29
 
48
30
  这个问题通常出现在使用代理服务器时,代理服务器使用的自签名证书或中间人证书不被 Node.js 默认信任。
49
31
 
50
- ### 解决方案
32
+ ## 解决方案
51
33
 
52
34
  要解决这个问题,可以在启动应用时添加环境变量,跳过 Node.js 的证书验证。具体做法是在启动命令中加入 `NODE_TLS_REJECT_UNAUTHORIZED=0`。例如:
53
35
 
@@ -76,7 +58,7 @@ docker run -e NODE_TLS_REJECT_UNAUTHORIZED=0 <其他参数> <镜像名>
76
58
 
77
59
  请注意,这种方法会降低安全性,因为它允许 Node.js 接受未经验证的证书。因此,仅建议在完全信任网络环境的私有化部署中使用,且需要在解决证书问题后恢复默认的证书验证设置。
78
60
 
79
- ### 更安全的替代方案
61
+ ## 更安全的替代方案
80
62
 
81
63
  如果可能,建议通过以下方法解决证书问题:
82
64
 
@@ -0,0 +1,215 @@
1
+ import { Callout } from 'nextra/components';
2
+
3
+ # Environment Variables
4
+
5
+ LobeChat provides some additional configuration options during deployment, which can be customized using environment variables.
6
+
7
+ ## Common Variables
8
+
9
+ ### `ACCESS_CODE`
10
+
11
+ - Type: Optional
12
+ - Description: Add a password to access the LobeChat service. You can set a long password to prevent brute force attacks.
13
+ - Default: -
14
+ - Example: `awCTe)re_r74` or `rtrt_ewee3@09!`
15
+
16
+ ### `ENABLE_OAUTH_SSO`
17
+
18
+ - Type: Optional
19
+ - Description: Enable Single Sign-On (SSO) for LobeChat. Set to `1` to enable SSO. For more information, see [Authentication Services](#authentication-services).
20
+ - Default: -
21
+ - Example: `1`
22
+
23
+ ### `NEXT_PUBLIC_BASE_PATH`
24
+
25
+ - Type: Optional
26
+ - Description: Add a `basePath` for LobeChat.
27
+ - Default: -
28
+ - Example: `/test`
29
+
30
+ ### `DEFAULT_AGENT_CONFIG`
31
+
32
+ - Type: Optional
33
+ - Description: Used to configure the default settings for the LobeChat default agent. It supports various data types and structures, including key-value pairs, nested fields, array values, and more.
34
+ - Default: -
35
+ - Example: `'model=gpt-4-1106-preview;params.max_tokens=300;plugins=search-engine,lobe-image-designer`
36
+
37
+ The `DEFAULT_AGENT_CONFIG` is used to configure the default settings for the LobeChat default agent. It supports various data types and structures, including key-value pairs, nested fields, array values, and more. The table below provides detailed information on the configuration options, examples, and corresponding explanations for the `DEFAULT_AGENT_CONFIG` environment variable:
38
+
39
+ | Configuration Type | Example | Explanation |
40
+ | --- | --- | --- |
41
+ | Basic Key-Value Pair | `model=gpt-4` | Set the model to `gpt-4`. |
42
+ | Nested Field | `tts.sttLocale=en-US` | Set the language locale for the text-to-speech service to `en-US`. |
43
+ | Array | `plugins=search-engine,lobe-image-designer` | Enable the `search-engine` and `lobe-image-designer` plugins. |
44
+ | Chinese Comma | `plugins=search-engine,lobe-image-designer` | Same as above, demonstrating support for Chinese comma separation. |
45
+ | Multiple Configurations | `model=glm-4;provider=zhipu` | Set the model to `glm-4` and the model provider to `zhipu`. |
46
+ | Numeric Value | `params.max_tokens=300` | Set the maximum tokens to `300`. |
47
+ | Boolean Value | `enableAutoCreateTopic=true` | Enable automatic topic creation. |
48
+ | Special Characters | `inputTemplate="Hello; I am a bot;"` | Set the input template to `Hello; I am a bot;`. |
49
+ | Error Handling | `model=gpt-4;maxToken` | Ignore invalid entry `maxToken` and only parse `model=gpt-4`. |
50
+ | Value Override | `model=gpt-4;model=gpt-4-1106-preview` | If a key is repeated, use the value that appears last; in this case, the value of `model` is `gpt-4-1106-preview`. |
51
+
52
+ Further reading:
53
+
54
+ - [\[RFC\] 022 - Default Assistant Parameters Configuration via Environment Variables](https://github.com/lobehub/lobe-chat/discussions/913)
55
+
56
+ ## Identity Verification Service
57
+
58
+ ### General Settings
59
+
60
+ #### `ENABLE_OAUTH_SSO`
61
+
62
+ - Type: Required
63
+ - Description: Enable single sign-on (SSO) for LobeChat. Set to `1` to enable single sign-on.
64
+ - Default: `-`
65
+ - Example: `1`
66
+
67
+ #### `NEXTAUTH_SECRET`
68
+
69
+ - Type: Required
70
+ - Description: Key used to encrypt the session tokens in Auth.js. You can generate the key using the following command: `openssl rand -base64 32`.
71
+ - Default: `-`
72
+ - Example: `Tfhi2t2pelSMEA8eaV61KaqPNEndFFdMIxDaJnS1CUI=`
73
+
74
+ ### Auth0
75
+
76
+ <Callout>
77
+ Currently, we only support the Auth0 identity verification service provider. If you need to use
78
+ other identity verification service providers, you can submit a [feature
79
+ request](https://github.com/lobehub/lobe-chat/issues/new/choose) or Pull Request.
80
+ </Callout>
81
+
82
+ #### `AUTH0_CLIENT_ID`
83
+
84
+ - Type: Required
85
+ - Description: Client ID of the Auth0 application. You can access it [here][auth0-client-page] and navigate to the application settings to view.
86
+ - Default: `-`
87
+ - Example: `evCnOJP1UX8FMnXR9Xkj5t0NyFn5p70P`
88
+
89
+ #### `AUTH0_CLIENT_SECRET`
90
+
91
+ - Type: Required
92
+ - Description: Client Secret of the Auth0 application.
93
+ - Default: `-`
94
+ - Example: `wnX7UbZg85ZUzF6ioxPLnJVEQa1Elbs7aqBUSF16xleBS5AdkVfASS49-fQIC8Rm`
95
+
96
+ #### `AUTH0_ISSUER`
97
+
98
+ - Type: Required
99
+ - Description: Issuer/domain of the Auth0 application.
100
+ - Default: `-`
101
+ - Example: `https://example.auth0.com`
102
+
103
+ ## Plugin Service
104
+
105
+ ### `PLUGINS_INDEX_URL`
106
+
107
+ - Type: Optional
108
+ - Description: Index address of the LobeChat plugin market. If you have deployed the plugin market service on your own, you can use this variable to override the default plugin market address.
109
+ - Default: `https://chat-plugins.lobehub.com`
110
+
111
+ ### `PLUGIN_SETTINGS`
112
+
113
+ - Type: Optional
114
+ - Description: Used to configure plugin settings. Use the format `plugin-name:setting-field=setting-value` to configure the settings of the plugin. Separate multiple setting fields with a semicolon `;`, and separate multiple plugin settings with a comma `,`.
115
+ - Default: `-`
116
+ - Example: `search-engine:SERPAPI_API_KEY=xxxxx,plugin-2:key1=value1;key2=value2`
117
+
118
+ The above example sets the `SERPAPI_API_KEY` of the `search-engine` plugin to `xxxxx`, and sets `key1` of `plugin-2` to `value1`, and `key2` to `value2`. The generated plugin settings configuration is as follows:
119
+
120
+ ```json
121
+ {
122
+ "plugin-2": {
123
+ "key1": "value1",
124
+ "key2": "value2"
125
+ },
126
+ "search-engine": {
127
+ "SERPAPI_API_KEY": "xxxxx"
128
+ }
129
+ }
130
+ ```
131
+
132
+ ## Assistant Market
133
+
134
+ ### `AGENTS_INDEX_URL`
135
+
136
+ - Type: Optional
137
+ - Description: Index address of the LobeChat assistant market. If you have deployed the assistant market service on your own, you can use this variable to override the default market address.
138
+ - Default: `https://chat-agents.lobehub.com`
139
+
140
+ ## Data Statistics
141
+
142
+ ### Vercel Analytics
143
+
144
+ #### `NEXT_PUBLIC_ANALYTICS_VERCEL`
145
+
146
+ - Type: Optional
147
+ - Description: Used to configure the environment variable for Vercel Analytics. Set to `1` to enable Vercel Analytics.
148
+ - Default: `-`
149
+ - Example: `1`
150
+
151
+ #### `NEXT_PUBLIC_VERCEL_DEBUG`
152
+
153
+ - Type: Optional
154
+ - Description: Used to enable the debug mode for Vercel Analytics.
155
+ - Default: `-`
156
+ - Example: `1`
157
+
158
+ ### Posthog Analytics
159
+
160
+ #### `NEXT_PUBLIC_ANALYTICS_POSTHOG`
161
+
162
+ - Type: Optional
163
+ - Description: Used to enable the environment variable for [PostHog Analytics][posthog-analytics-url]. Set to `1` to enable PostHog Analytics.
164
+ - Default: `-`
165
+ - Example: `1`
166
+
167
+ #### `NEXT_PUBLIC_POSTHOG_KEY`
168
+
169
+ - Type: Optional
170
+ - Description: Set the PostHog project Key.
171
+ - Default: `-`
172
+ - Example: `phc_xxxxxxxx`
173
+
174
+ #### `NEXT_PUBLIC_POSTHOG_HOST`
175
+
176
+ - Type: Optional
177
+ - Description: Set the deployment address of the PostHog service, defaulting to the official SAAS address.
178
+ - Default: `https://app.posthog.com`
179
+ - Example: `https://example.com`
180
+
181
+ #### `NEXT_PUBLIC_POSTHOG_DEBUG`
182
+
183
+ - Type: Optional
184
+ - Description: Enable the debug mode for PostHog.
185
+ - Default: `-`
186
+ - Example: `1`
187
+
188
+ ### Umami Analytics
189
+
190
+ #### `NEXT_PUBLIC_ANALYTICS_UMAMI`
191
+
192
+ - Type: Optional
193
+ - Description: Used to enable the environment variable for [Umami Analytics][umami-analytics-url]. Set to `1` to enable Umami Analytics.
194
+ - Default: `-`
195
+ - Example: `1`
196
+
197
+ #### `NEXT_PUBLIC_UMAMI_SCRIPT_URL`
198
+
199
+ - Type: Optional
200
+ - Description: The URL of the Umami script, defaulting to the script URL provided by Umami Cloud.
201
+ - Default: `https://analytics.umami.is/script.js`
202
+ - Example: `https://umami.your-site.com/script.js`
203
+
204
+ #### `NEXT_PUBLIC_UMAMI_WEBSITE_ID`
205
+
206
+ - Type: Required
207
+ - Description: Your Umami Website ID.
208
+ - Default: `-`
209
+ - Example: `E738D82A-EE9E-4806-A81F-0CA3CAE57F65`
210
+
211
+ [auth0-client-page]: https://manage.auth0.com/dashboard
212
+ [azure-api-verion-url]: https://docs.microsoft.com/zh-cn/azure/developer/javascript/api-reference/es-modules/azure-sdk/ai-translation/translationconfiguration?view=azure-node-latest#api-version
213
+ [openai-api-page]: https://platform.openai.com/account/api-keys
214
+ [posthog-analytics-url]: https://posthog.com
215
+ [umami-analytics-url]: https://umami.is