Skip to content

Commit

Permalink
📝 docs: update langfuse Chinese docs (lobehub#6168)
Browse files Browse the repository at this point in the history
* update docs

* update docs
  • Loading branch information
arvinxx authored Feb 15, 2025
1 parent a4ce534 commit a20aad0
Show file tree
Hide file tree
Showing 16 changed files with 132 additions and 59 deletions.
8 changes: 4 additions & 4 deletions docs/changelog/2025-02-02-deepseek-r1.mdx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
title: >-
LobeChat Integrates DeepSeek R1, Bringing a Revolutionary Chain of Thought Experience
LobeChat Integrates DeepSeek R1, Bringing a Revolutionary Chain of Thought
Experience
description: >-
LobeChat v1.49.12 fully supports the DeepSeek R1 model, providing users with an unprecedented interactive experience in the chain of thought.
LobeChat v1.49.12 fully supports the DeepSeek R1 model, providing users with
an unprecedented interactive experience in the chain of thought.
tags:
- LobeChat
- DeepSeek
Expand Down
7 changes: 4 additions & 3 deletions docs/self-hosting/advanced/auth/next-auth/casdoor.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,13 @@ If you are deploying using a public network, the following assumptions apply:
- Method: `POST`
- Content Type: `application/json`
- Headers: `casdoor-secret`: `Your Webhook Secret`
> The secret is generated by yourself, you can visit https://generate-secret.vercel.app/10 to generate a 10 bit secret.

> The secret is generated by yourself, you can visit [https://generate-secret.vercel.app/10](https://generate-secret.vercel.app/10) to generate a 10 bit secret.
- Event: `update-user`
- Is user extented: `true`

Save and Exit, then copy the Webhook secret and fill it in the environment variable `CASDOOR_WEBHOOK_SECRET.
Save and Exit, then copy the Webhook secret and fill it in the environment variable \`CASDOOR\_WEBHOOK\_SECRET.

### Configure Environment Variables

Expand All @@ -140,7 +141,7 @@ If you are deploying using a public network, the following assumptions apply:
| `AUTH_CASDOOR_SECRET` | Required | The client secret from the Casdoor application details page. |
| `AUTH_CASDOOR_ISSUER` | Required | The OpenID Connect issuer for the Casdoor provider. |
| `NEXTAUTH_URL` | Required | This URL specifies the callback address for Auth.js during OAuth verification and needs to be set only if the default generated redirect address is incorrect. `https://lobe.example.com/api/auth` |
| `CASDOOR_WEBHOOK_SECRET` | Optional | A key used to verify whether the request sent by Casdoor is legal. |
| `CASDOOR_WEBHOOK_SECRET` | Optional | A key used to verify whether the request sent by Casdoor is legal. |

<Callout type={'tip'}>
Visit [📘 Environment Variables](/docs/self-hosting/environment-variables/auth#casdoor) for
Expand Down
7 changes: 4 additions & 3 deletions docs/self-hosting/advanced/auth/next-auth/casdoor.zh-CN.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ tags:
- 方法:`POST`
- 内容类型:`application/json`
- 协议头:`casdoor-secret`: `你的Webhook密钥`
> 密钥由你自己生成,用于验证 Casdoor 发送的请求是否合法。 可以前往 https://generate-secret.vercel.app/10 生成一个 10 位的密钥。

> 密钥由你自己生成,用于验证 Casdoor 发送的请求是否合法。 可以前往 [https://generate-secret.vercel.app/10](https://generate-secret.vercel.app/10) 生成一个 10 位的密钥。
- 事件:`update-user`
- 拓展用户字段:`true`
Expand All @@ -112,7 +113,7 @@ tags:
### 关闭注册

为了保证你的应用安全,建议关闭 Casdoor 的注册功能,改为由管理员手动添加用户。

前往 `身份认证` -> `应用`,将 `启用注册` 设置为 ``

<Callout type={'warning'}>
Expand All @@ -139,7 +140,7 @@ tags:
| `AUTH_CASDOOR_SECRET` | 必选 | Casdoor 应用详情页的客户端密钥 |
| `AUTH_CASDOOR_ISSUER` | 必选 | Casdoor 提供程序的 OpenID Connect 颁发者。 |
| `NEXTAUTH_URL` | 必选 | 该 URL 用于指定 Auth.js 在执行 OAuth 验证时的回调地址,当默认生成的重定向地址发生不正确时才需要设置。`https://lobe.example.com/api/auth` |
| `CASDOOR_WEBHOOK_SECRET` | 可选 | 用于验证 Casdoor 发送的 Webhook 请求是否合法的密钥。 |
| `CASDOOR_WEBHOOK_SECRET` | 可选 | 用于验证 Casdoor 发送的 Webhook 请求是否合法的密钥。 |

<Callout type={'tip'}>
前往 [📘 环境变量](/zh/docs/self-hosting/environment-variables/auth#casdoor) 可查阅相关变量详情。
Expand Down
18 changes: 9 additions & 9 deletions docs/self-hosting/advanced/auth/next-auth/logto.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,15 @@ If you are using Logto Cloud, assume its endpoint domain is `https://example.log

When deploying LobeChat, you need to configure the following environment variables:

| Environment Variable | Type | Description |
| ------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `NEXT_AUTH_SECRET` | Required | The key used to encrypt Auth.js session tokens. You can generate a key using the command: `openssl rand -base64 32` |
| `NEXT_AUTH_SSO_PROVIDERS` | Required | Select the single sign-on provider for LobeChat. For Logto, enter `logto`. |
| `AUTH_LOGTO_ID` | Required | The Client ID from the Logto App details page |
| `AUTH_LOGTO_SECRET` | Required | The Client Secret from the Logto App details page |
| `AUTH_LOGTO_ISSUER` | Required | OpenID Connect issuer of the Logto provider |
| `NEXTAUTH_URL` | Required | This URL specifies the callback address for Auth.js during OAuth verification, needed only if the default generated redirect address is incorrect. `https://lobe.example.com/api/auth` |
| `LOGTO_WEBHOOK_SIGNING_KEY` | Optional | The key used to verify the legality of Webhook requests sent by Logto. |
| Environment Variable | Type | Description |
| --------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `NEXT_AUTH_SECRET` | Required | The key used to encrypt Auth.js session tokens. You can generate a key using the command: `openssl rand -base64 32` |
| `NEXT_AUTH_SSO_PROVIDERS` | Required | Select the single sign-on provider for LobeChat. For Logto, enter `logto`. |
| `AUTH_LOGTO_ID` | Required | The Client ID from the Logto App details page |
| `AUTH_LOGTO_SECRET` | Required | The Client Secret from the Logto App details page |
| `AUTH_LOGTO_ISSUER` | Required | OpenID Connect issuer of the Logto provider |
| `NEXTAUTH_URL` | Required | This URL specifies the callback address for Auth.js during OAuth verification, needed only if the default generated redirect address is incorrect. `https://lobe.example.com/api/auth` |
| `LOGTO_WEBHOOK_SIGNING_KEY` | Optional | The key used to verify the legality of Webhook requests sent by Logto. |

<Callout type={'tip'}>
Visit [📘 Environment Variables](/docs/self-hosting/environment-variables/auth#logto) for details on related variables.
Expand Down
18 changes: 9 additions & 9 deletions docs/self-hosting/advanced/auth/next-auth/logto.zh-CN.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ tags:

在部署 LobeChat 时,你需要配置以下环境变量:

| 环境变量 | 类型 | 描述 |
| ------------------------- | -- | ------------------------------------------------------------------------------------------------ |
| `NEXT_AUTH_SECRET` | 必选 | 用于加密 Auth.js 会话令牌的密钥。您可以使用以下命令生成秘钥: `openssl rand -base64 32` |
| `NEXT_AUTH_SSO_PROVIDERS` | 必选 | 选择 LoboChat 的单点登录提供商。使用 Logto 请填写 `logto`|
| `AUTH_LOGTO_ID` | 必选 | Logto App 详情页的 Client ID |
| `AUTH_LOGTO_SECRET` | 必选 | Logto App 详情页的 Client Secret |
| `AUTH_LOGTO_ISSUER` | 必选 | Logto 提供程序的 OpenID Connect 颁发者 |
| `NEXTAUTH_URL` | 必选 | 该 URL 用于指定 Auth.js 在执行 OAuth 验证时的回调地址,当默认生成的重定向地址发生不正确时才需要设置。`https://lobe.example.com/api/auth` |
| `LOGTO_WEBHOOK_SIGNING_KEY` | 可选 | 用于验证 Logto 发送的 Webhook 请求是否合法的密钥。 |
| 环境变量 | 类型 | 描述 |
| --------------------------- | -- | ------------------------------------------------------------------------------------------------ |
| `NEXT_AUTH_SECRET` | 必选 | 用于加密 Auth.js 会话令牌的密钥。您可以使用以下命令生成秘钥: `openssl rand -base64 32` |
| `NEXT_AUTH_SSO_PROVIDERS` | 必选 | 选择 LoboChat 的单点登录提供商。使用 Logto 请填写 `logto`|
| `AUTH_LOGTO_ID` | 必选 | Logto App 详情页的 Client ID |
| `AUTH_LOGTO_SECRET` | 必选 | Logto App 详情页的 Client Secret |
| `AUTH_LOGTO_ISSUER` | 必选 | Logto 提供程序的 OpenID Connect 颁发者 |
| `NEXTAUTH_URL` | 必选 | 该 URL 用于指定 Auth.js 在执行 OAuth 验证时的回调地址,当默认生成的重定向地址发生不正确时才需要设置。`https://lobe.example.com/api/auth` |
| `LOGTO_WEBHOOK_SIGNING_KEY` | 可选 | 用于验证 Logto 发送的 Webhook 请求是否合法的密钥。 |

<Callout type={'tip'}>
前往 [📘 环境变量](/zh/docs/self-hosting/environment-variables/auth#logto) 可查阅相关变量详情。
Expand Down
12 changes: 6 additions & 6 deletions docs/self-hosting/advanced/model-list.zh-CN.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ id=displayName<maxToken:vision:reasoning:fc:file>

目前支持的扩展能力有:

| --- | 描述 |
| ----------- | ------------------------------------- |
| `fc` | 函数调用(function calling) |
| `vision` | 视觉识别 |
| `reasoning` | 支持推理 |
| `file` | 文件上传(比较 hack,不建议日常使用) |
| --- | 描述 |
| ----------- | ---------------------- |
| `fc` | 函数调用(function calling) |
| `vision` | 视觉识别 |
| `reasoning` | 支持推理 |
| `file` | 文件上传(比较 hack,不建议日常使用) |
70 changes: 70 additions & 0 deletions docs/self-hosting/advanced/observability/langfuse.zh-CN.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
title: LobeChat 的可观测性和追踪
description: 使用 Langfuse 为你的 LobeChat 应用增强开源可观测性和追踪功能。自动捕获每个请求的详细追踪和指标,以优化和调试你的对话。
tags:
- 可观测性
- 追踪
- Langfuse
---

# 使用 Langfuse 监控你的 LobeChat 应用

## 什么是 Langfuse?

[Langfuse](https://langfuse.com/) 是一个 **开源的 LLM 可观测性平台**。启用 Langfuse 集成后,你可以追踪应用数据,以开发、监控和优化 LobeChat 的使用,包括:

- 应用 [追踪](https://langfuse.com/docs/tracing)
- 使用模式
- 按用户和模型的成本数据
- [评估](https://langfuse.com/docs/scores/overview)

## 快速开始

<Steps>
### 设置 Langfuse

通过注册 [Langfuse Cloud](https://cloud.langfuse.com)[自托管](https://langfuse.com/docs/deployment/self-host) Langfuse 来获取你的 Langfuse API 密钥。

### 设置 LobeChat

有多种方式可以 [自托管 LobeChat](https://lobehub.com/docs/self-hosting/start)。在本示例中,我们将使用 Docker Desktop 部署。

<Tabs items={["环境变量", "Docker Desktop 示例"]}>
<Tab>
在部署 LobeChat 之前,使用你在上一步创建的 Langfuse API 密钥设置以下四个环境变量。

```sh
ENABLE_LANGFUSE = '1'
LANGFUSE_SECRET_KEY = 'sk-lf...'
LANGFUSE_PUBLIC_KEY = 'pk-lf...'
LANGFUSE_HOST = 'https://cloud.langfuse.com'
```
</Tab>

<Tab>
在运行 Docker 容器之前,在 Docker Desktop 中设置环境变量,并填入你在上一步创建的 Langfuse API 密钥。

<Image alt={'Docker Desktop 中的环境变量'} src={'https://langfuse.com/images/docs/lobechat-docker-desktop-env.png'} />
</Tab>
</Tabs>

### 在设置中启用分析功能

当 LobeChat 运行后,进入 **设置** 中的 **关于** 选项卡,并启用分析功能。这是将追踪数据发送到 Langfuse 所必需的。

<Image alt={'LobeChat 设置'} src={'https://langfuse.com/images/docs/lobechat-settings.png'} />

### 在 Langfuse 中查看聊天追踪

设置好 LLM 模型密钥后,你就可以开始与 LobeChat 进行交互。

<Image alt={'LobeChat 对话'} src={'https://langfuse.com/images/docs/lobechat-converstation.png'} />

所有对话都会被自动追踪并发送到 Langfuse。你可以在 Langfuse UI 的 [追踪部分](https://langfuse.com/docs/tracing) 查看这些数据。

<Image alt={'LobeChat Trace 示例'} src={'https://langfuse.com/images/docs/lobechat-example-trace.png'} />
</Steps>

## 反馈

如果你有任何反馈或需求,请在 GitHub 上创建 [Issue](https://langfuse.com/issue),或在 [Discord](https://discord.langfuse.com/) 上与 Langfuse 社区分享你的想法。
6 changes: 3 additions & 3 deletions docs/self-hosting/environment-variables/auth.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ LobeChat provides a complete authentication service capability when deployed. Th

- Changes after v1.52.0.

- For users who deploy with Vercel using Next Auth, it is necessary to add the environment variable NEXT_PUBLIC_ENABLE_NEXT_AUTH=1 to ensure that Next Auth is enabled.
- For users who use Clerk in their self-built image, it is necessary to configure the environment variable NEXT_PUBLIC_ENABLE_NEXT_AUTH=0 to disable Next Auth.\n
- Other standard deployment scenarios (using Clerk on Vercel and next-auth in Docker) are not affected
- For users who deploy with Vercel using Next Auth, it is necessary to add the environment variable NEXT\_PUBLIC\_ENABLE\_NEXT\_AUTH=1 to ensure that Next Auth is enabled.

- For users who use Clerk in their self-built image, it is necessary to configure the environment variable NEXT\_PUBLIC\_ENABLE\_NEXT\_AUTH=0 to disable Next Auth.\n

- Other standard deployment scenarios (using Clerk on Vercel and next-auth in Docker) are not affected

#### `NEXT_AUTH_SECRET`

Expand Down
5 changes: 3 additions & 2 deletions docs/self-hosting/environment-variables/auth.zh-CN.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ LobeChat 在部署时提供了完善的身份验证服务能力,以下是相
### 通用设置

#### `NEXT_PUBLIC_ENABLE_NEXT_AUTH`

- v1.52.0 之后有变更
- 针对使用 Vercel 部署中使用 next-auth 的用户,需要额外添加 NEXT_PUBLIC_ENABLE_NEXT_AUTH=1 环境变量来确保开启 Next Auth
- 针对使用自构建镜像中使用 clerk 的用户,需要额外配置 NEXT_PUBLIC_ENABLE_NEXT_AUTH=0 环境变量来关闭 Next Auth
- 针对使用 Vercel 部署中使用 next-auth 的用户,需要额外添加 NEXT\_PUBLIC\_ENABLE\_NEXT\_AUTH=1 环境变量来确保开启 Next Auth
- 针对使用自构建镜像中使用 clerk 的用户,需要额外配置 NEXT\_PUBLIC\_ENABLE\_NEXT\_AUTH=0 环境变量来关闭 Next Auth
- 其他标准部署场景(Vercel 中使用 Clerk 与 Docker 中使用 next-auth )不受影响

#### `NEXT_AUTH_SECRET`
Expand Down
2 changes: 1 addition & 1 deletion docs/self-hosting/platform/btpanel.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ To install aaPanel, go to the [aaPanel](https://www.aapanel.com/new/download.htm
6. After submission, the panel will automatically initialize the application, which will take about `1-3` minutes. It can be accessed after the initialization is completed.

<Callout type="warning">
⚠️ Do not enable any form of cache in the reverse proxy settings of the panel to avoid affecting the normal operation of the service. Read more at https://github.com/lobehub/lobe-chat/discussions/5986
⚠️ Do not enable any form of cache in the reverse proxy settings of the panel to avoid affecting the normal operation of the service. Read more at [https://github.com/lobehub/lobe-chat/discussions/5986](https://github.com/lobehub/lobe-chat/discussions/5986)
</Callout>

## Visit LobeChat
Expand Down
2 changes: 1 addition & 1 deletion docs/self-hosting/platform/btpanel.zh-CN.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ tags:
5. 提交后面板会自动进行应用初始化,大概需要`1-3`分钟,初始化完成后即可访问。

<Callout type="warning">
⚠️ 请不要在面板的反向代理设置中开启任何形式的缓存,以免影响服务的正常运行。详情请见 https://github.com/lobehub/lobe-chat/discussions/5986
⚠️ 请不要在面板的反向代理设置中开启任何形式的缓存,以免影响服务的正常运行。详情请见 [https://github.com/lobehub/lobe-chat/discussions/5986](https://github.com/lobehub/lobe-chat/discussions/5986)
</Callout>

## 访问 LobeChat
Expand Down
Loading

0 comments on commit a20aad0

Please sign in to comment.