Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
bentwnghk committed Jan 8, 2024
2 parents 488886e + 42c9a9e commit d0c23dd
Show file tree
Hide file tree
Showing 17 changed files with 277 additions and 77 deletions.
31 changes: 22 additions & 9 deletions .github/ISSUE_TEMPLATE/1_bug_report.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,35 @@
name: '🐛 反馈缺陷 Bug Report'
description: '反馈一个问题缺陷 | Report an bug'
name: '🐛 Bug Report'
description: 'Report an bug'
title: '[Bug] '
labels: '🐛 Bug'
labels: ['🐛 Bug']
body:
- type: dropdown
attributes:
label: '💻 系统环境 | Operating System'
label: '💻 Operating System'
options:
- Windows
- macOS
- Ubuntu
- Other Linux
- iOS
- Android
- Other
validations:
required: true
- type: dropdown
attributes:
label: '🌐 浏览器 | Browser'
label: '📦 Environment'
options:
- Official Preview
- Vercel / Zeabur / Sealos
- Docker
- Other
validations:
required: true

- type: dropdown
attributes:
label: '🌐 Browser'
options:
- Chrome
- Edge
Expand All @@ -27,19 +40,19 @@ body:
required: true
- type: textarea
attributes:
label: '🐛 问题描述 | Bug Description'
label: '🐛 Bug Description'
description: A clear and concise description of the bug.
validations:
required: true
- type: textarea
attributes:
label: '🚦 期望结果 | Expected Behavior'
label: '🚦 Expected Behavior'
description: A clear and concise description of what you expected to happen.
- type: textarea
attributes:
label: '📷 复现步骤 | Recurrence Steps'
label: '📷 Recurrence Steps'
description: A clear and concise description of how to recurrence.
- type: textarea
attributes:
label: '📝 补充信息 | Additional Information'
label: '📝 Additional Information'
description: If your problem needs further explanation, or if the issue you're seeing cannot be reproduced in a gist, please add more information here.
59 changes: 59 additions & 0 deletions .github/ISSUE_TEMPLATE/1_bug_report_cn.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: '🐛 反馈缺陷'
description: '反馈一个问题缺陷'
title: '[Bug] '
labels: ['🐛 Bug']
body:
- type: dropdown
attributes:
label: '💻 系统环境'
options:
- Windows
- macOS
- Ubuntu
- Other Linux
- iOS
- Android
- Other
validations:
required: true

- type: dropdown
attributes:
label: '📦 部署环境'
options:
- Official Preview
- Vercel / Zeabur / Sealos
- Docker
- Other
validations:
required: true

- type: dropdown
attributes:
label: '🌐 浏览器'
options:
- Chrome
- Edge
- Safari
- Firefox
- Other
validations:
required: true
- type: textarea
attributes:
label: '🐛 问题描述'
description: 请提供一个清晰且简洁的问题描述。
validations:
required: true
- type: textarea
attributes:
label: '🚦 期望结果'
description: 请提供一个清晰且简洁的描述,说明您期望发生什么。
- type: textarea
attributes:
label: '📷 复现步骤'
description: 请提供一个清晰且简洁的描述,说明如何复现问题。
- type: textarea
attributes:
label: '📝 补充信息'
description: 如果您的问题需要进一步说明,或者您遇到的问题无法在一个简单的示例中复现,请在这里添加更多信息。
12 changes: 6 additions & 6 deletions .github/ISSUE_TEMPLATE/2_feature_request.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
name: '🌠 功能需求 Feature Request'
description: '需求或建议 | Suggest an idea'
name: '🌠 Feature Request'
description: 'Suggest an idea'
title: '[Request] '
labels: '🌠 Feature Request'
labels: ['🌠 Feature Request']
body:
- type: textarea
attributes:
label: '🥰 需求描述 | Feature Description'
label: '🥰 Feature Description'
description: Please add a clear and concise description of the problem you are seeking to solve with this feature request.
validations:
required: true
- type: textarea
attributes:
label: '🧐 解决方案 | Proposed Solution'
label: '🧐 Proposed Solution'
description: Describe the solution you'd like in a clear and concise manner.
validations:
required: true
- type: textarea
attributes:
label: '📝 补充信息 | Additional Information'
label: '📝 Additional Information'
description: Add any other context about the problem here.
21 changes: 21 additions & 0 deletions .github/ISSUE_TEMPLATE/2_feature_request_cn.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: '🌠 功能需求'
description: '提出需求或建议'
title: '[Request] '
labels: ['🌠 功能需求']
body:
- type: textarea
attributes:
label: '🥰 需求描述'
description: 请添加一个清晰且简洁的问题描述,阐述您希望通过这个功能需求解决的问题。
validations:
required: true
- type: textarea
attributes:
label: '🧐 解决方案'
description: 请清晰且简洁地描述您想要的解决方案。
validations:
required: true
- type: textarea
attributes:
label: '📝 补充信息'
description: 在这里添加关于问题的任何其他背景信息。
15 changes: 0 additions & 15 deletions .github/ISSUE_TEMPLATE/3_question.yml

This file was deleted.

7 changes: 0 additions & 7 deletions .github/ISSUE_TEMPLATE/4_other.md

This file was deleted.

4 changes: 4 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
contact_links:
- name: Questions and ideas | 问题和想法
url: https://github.com/lobehub/lobe-chat/discussions/new/choose
about: Please post questions, and ideas in discussions. | 请在讨论区发布问题和想法。
1 change: 1 addition & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- [ ] ♻️ refactor
- [ ] 💄 style
- [ ] 🔨 chore
- [ ] ⚡️ perf
- [ ] 📝 docs

#### 🔀 变更说明 | Description of Change
Expand Down
70 changes: 70 additions & 0 deletions docs/Deployment/Common-Error.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Frequently Asked Questions

## When using a proxy(e.g. Surge), I encounter the `UNABLE_TO_VERIFY_LEAF_SIGNATURE` error

### Problem Description

When making network requests during private deployment, certificate validation errors may occur. The error messages may be as follows:

```
[TypeError: fetch failed] {
cause: [Error: unable to verify the first certificate] {
code: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE'
}
}
```

Or:

```
{
"endpoint": "https://api.openai.com/v1",
"error": {
"cause": {
"code": "UNABLE_TO_VERIFY_LEAF_SIGNATURE"
}
}
}
```

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.

### Solution

To resolve this issue, you can add an environment variable to bypass Node.js certificate validation when starting the application. The specific approach is to include `NODE_TLS_REJECT_UNAUTHORIZED=0` in the startup command. For example:

```bash
NODE_TLS_REJECT_UNAUTHORIZED=0 npm run start
```

Alternatively, when running in a Docker container, you can set the environment variable in the Dockerfile or docker-compose.yml:

```dockerfile
# In the Dockerfile
ENV NODE_TLS_REJECT_UNAUTHORIZED=0
```

```yaml
# In the docker-compose.yml
environment:
- NODE_TLS_REJECT_UNAUTHORIZED=0
```
Example Docker run command:
```bash
docker run -e NODE_TLS_REJECT_UNAUTHORIZED=0 <other parameters> <image name>
```

Please note that this method reduces security because it allows Node.js to accept unverified certificates. Therefore, it is only recommended for use in private deployments with fully trusted network environments, and the default certificate validation settings should be restored after resolving the certificate issue.

### More Secure Alternatives

If possible, it is recommended to address certificate issues using the following methods:

1. Ensure that all man-in-the-middle certificates are correctly installed on the proxy server and the corresponding clients.
2. Replace self-signed or man-in-the-middle certificates with valid certificates issued by trusted certificate authorities.
3. Properly configure the certificate chain in the code to ensure that Node.js can validate to the root certificate.

Implementing these methods can resolve certificate validation issues without sacrificing security.

69 changes: 69 additions & 0 deletions docs/Deployment/Common-Error.zh-CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# 常见问题

## 使用代理中转请求时(例如:Surge),报 `UNABLE_TO_VERIFY_LEAF_SIGNATURE` 错误

### 问题描述

在私有化部署时,进行网络请求可能会遇到证书验证错误。错误信息可能如下:

```
[TypeError: fetch failed] {
cause: [Error: unable to verify the first certificate] {
code: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE'
}
}
```

或者是:

```
{
"endpoint": "https://api.openai.com/v1",
"error": {
"cause": {
"code": "UNABLE_TO_VERIFY_LEAF_SIGNATURE"
}
}
}
```

这个问题通常出现在使用代理服务器时,代理服务器使用的自签名证书或中间人证书不被 Node.js 默认信任。

### 解决方案

要解决这个问题,可以在启动应用时添加环境变量,跳过 Node.js 的证书验证。具体做法是在启动命令中加入 `NODE_TLS_REJECT_UNAUTHORIZED=0`。例如:

```bash
NODE_TLS_REJECT_UNAUTHORIZED=0 npm run start
```

或者在 Docker 容器中运行时,可以在 Dockerfile 或者 docker-compose.yml 中设置环境变量:

```dockerfile
# 在 Dockerfile 中
ENV NODE_TLS_REJECT_UNAUTHORIZED=0
```

```yaml
# 在 docker-compose.yml 中
environment:
- NODE_TLS_REJECT_UNAUTHORIZED=0
```
Docker 运行命令示例:
```bash
docker run -e NODE_TLS_REJECT_UNAUTHORIZED=0 <其他参数> <镜像名>
```

请注意,这种方法会降低安全性,因为它允许 Node.js 接受未经验证的证书。因此,仅建议在完全信任网络环境的私有化部署中使用,且需要在解决证书问题后恢复默认的证书验证设置。

### 更安全的替代方案

如果可能,建议通过以下方法解决证书问题:

1. 确保所有的中间人证书都被正确地安装在代理服务器和相应的客户端上。
2. 使用有效的、由受信任的证书颁发机构签发的证书替换自签名或中间人证书。
3. 在代码中正确配置证书链,确保 Node.js 可以验证到根证书。

采用这些方法可以在不牺牲安全性的前提下解决证书验证问题。
3 changes: 2 additions & 1 deletion docs/Home.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ LobeChat is a open-source, extensible ([Function Calling][fc-url]), high-perform

### 🛳 Self-Hosting

- [Environment Variables](https://github.com/lobehub/lobe-chat/wiki/Environment-Variable) | [环境变量](https://github.com/lobehub/lobe-chat/wiki/Environment-Variable.zh-CN)
- [Docker Deployment Guide](https://github.com/lobehub/lobe-chat/wiki/Docker-Deployment) | [Docker 部署指引](https://github.com/lobehub/lobe-chat/wiki/Docker-Deployment.zh-CN)
- [Deploying with Azure OpenAI](https://github.com/lobehub/lobe-chat/wiki/Deploy-with-Azure-OpenAI) | [使用 Azure OpenAI 部署](https://github.com/lobehub/lobe-chat/wiki/Deploy-with-Azure-OpenAI.zh-CN)
- [Environment Variables](https://github.com/lobehub/lobe-chat/wiki/Environment-Variable) | [环境变量](https://github.com/lobehub/lobe-chat/wiki/Environment-Variable.zh-CN)
- [Upstream Sync](https://github.com/lobehub/lobe-chat/wiki/Upstream-Sync) | [自部署保持更新](https://github.com/lobehub/lobe-chat/wiki/Upstream-Sync.zh-CN)
- [Common Error](https://github.com/lobehub/lobe-chat/wiki/Common-Error) | [常见问题](https://github.com/lobehub/lobe-chat/wiki/Common-Error.zh-CN)
- [Data Statistics](https://github.com/lobehub/lobe-chat/wiki/Analytics) | [数据统计](https://github.com/lobehub/lobe-chat/wiki/Analytics.zh-CN)

<br/>
Expand Down
3 changes: 2 additions & 1 deletion docs/_Sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@

#### 🛳 Self-Hosting

- [Environment Variables](https://github.com/lobehub/lobe-chat/wiki/Environment-Variable) | [中文](https://github.com/lobehub/lobe-chat/wiki/Environment-Variable.zh-CN)
- [Docker Deployment Guide](https://github.com/lobehub/lobe-chat/wiki/Docker-Deployment) | [Docker 部署指引](https://github.com/lobehub/lobe-chat/wiki/Docker-Deployment.zh-CN)
- [Deploying with Azure OpenAI](https://github.com/lobehub/lobe-chat/wiki/Deploy-with-Azure-OpenAI) | [使用 Azure OpenAI 部署](https://github.com/lobehub/lobe-chat/wiki/Deploy-with-Azure-OpenAI.zh-CN)
- [Environment Variables](https://github.com/lobehub/lobe-chat/wiki/Environment-Variable) | [环境变量](https://github.com/lobehub/lobe-chat/wiki/Environment-Variable.zh-CN)
- [Upstream Sync](https://github.com/lobehub/lobe-chat/wiki/Upstream-Sync) | [自部署保持更新](https://github.com/lobehub/lobe-chat/wiki/Upstream-Sync.zh-CN)
- [Common Error](https://github.com/lobehub/lobe-chat/wiki/Common-Error) | [常见问题](https://github.com/lobehub/lobe-chat/wiki/Common-Error.zh-CN)
- [Data Statistics](https://github.com/lobehub/lobe-chat/wiki/Analytics) | [数据统计](https://github.com/lobehub/lobe-chat/wiki/Analytics.zh-CN)

#### ⌨️ Development
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
"@types/ua-parser-js": "^0.7",
"@types/uuid": "^9",
"@umijs/lint": "^4",
"@vitest/coverage-v8": "1.1.1",
"@vitest/coverage-v8": "^1.1.3",
"commitlint": "^18",
"consola": "^3",
"dpdm": "^3",
Expand All @@ -177,7 +177,7 @@
"typescript": "^5",
"unified": "^11",
"unist-util-visit": "^5",
"vitest": "1.1.1",
"vitest": "^1.1.3",
"vitest-canvas-mock": "^0.3.3"
},
"publishConfig": {
Expand Down
Loading

0 comments on commit d0c23dd

Please sign in to comment.