@lobehub/chat 1.12.20 → 1.13.1

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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,56 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 1.13.1](https://github.com/lobehub/lobe-chat/compare/v1.13.0...v1.13.1)
6
+
7
+ <sup>Released on **2024-08-27**</sup>
8
+
9
+ #### 💄 Styles
10
+
11
+ - **misc**: Update Qwen models.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### Styles
19
+
20
+ - **misc**: Update Qwen models, closes [#3626](https://github.com/lobehub/lobe-chat/issues/3626) ([4393386](https://github.com/lobehub/lobe-chat/commit/4393386))
21
+
22
+ </details>
23
+
24
+ <div align="right">
25
+
26
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
27
+
28
+ </div>
29
+
30
+ ## [Version 1.13.0](https://github.com/lobehub/lobe-chat/compare/v1.12.20...v1.13.0)
31
+
32
+ <sup>Released on **2024-08-27**</sup>
33
+
34
+ #### ✨ Features
35
+
36
+ - **misc**: Supports Authelia login.
37
+
38
+ <br/>
39
+
40
+ <details>
41
+ <summary><kbd>Improvements and Fixes</kbd></summary>
42
+
43
+ #### What's improved
44
+
45
+ - **misc**: Supports Authelia login, closes [#3589](https://github.com/lobehub/lobe-chat/issues/3589) ([2141ae7](https://github.com/lobehub/lobe-chat/commit/2141ae7))
46
+
47
+ </details>
48
+
49
+ <div align="right">
50
+
51
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
52
+
53
+ </div>
54
+
5
55
  ### [Version 1.12.20](https://github.com/lobehub/lobe-chat/compare/v1.12.19...v1.12.20)
6
56
 
7
57
  <sup>Released on **2024-08-26**</sup>
@@ -0,0 +1,75 @@
1
+ ---
2
+ title: Configuring Authelia Authentication Service for LobeChat
3
+ description: >-
4
+ Learn how to configure Authelia authentication service in LobeChat, including
5
+ creating a provider, configuring environment variables, and deploying
6
+ LobeChat. Detailed steps and necessary environment variable settings.
7
+ tags:
8
+ - Authelia Configuration
9
+ - Single Sign-On (SSO)
10
+ - LobeChat Authentication
11
+ - Environment Variables
12
+ - Deployment Instructions
13
+ ---
14
+
15
+ ## Configuring Authelia Authentication Service
16
+
17
+ ## Authelia Configuration Flow
18
+
19
+ <Steps>
20
+ ### Create an Authelia Identity Provider
21
+
22
+ We assume you are already familiar with using Authelia. Let's say your LobeChat instance is deployed at https://lobe.example.com/.
23
+ Note that currently only localhost supports HTTP access; other domains need to enable TLS, otherwise Authelia will actively interrupt authentication by default.
24
+
25
+ Now, let's open and edit the configuration file of your Authelia instance:
26
+
27
+ Add a new lobe-chat item under identity_providers -> oidc:
28
+
29
+ ```yaml
30
+ identity_providers:
31
+ oidc:
32
+ ...
33
+ ## The other portions of the mandatory OpenID Connect 1.0 configuration go here.
34
+ ## See: https://www.authelia.com/c/oidc
35
+ - id: lobe-chat
36
+ description: LobeChat
37
+ secret: '$pbkdf2-sha512$310000$c8p78n7pUMln0jzvd4aK4Q$JNRBzwAo0ek5qKn50cFzzvE9RXV88h1wJn5KGiHrD0YKtZaR/nCb2CJPOsKaPK0hjf.9yHxzQGZziziccp6Yng' # The digest of 'insecure_secret'.
38
+ public: false
39
+ authorization_policy: two_factor
40
+ redirect_uris:
41
+ - https://chat.example.com/api/auth/callback/authelia
42
+ scopes:
43
+ - openid
44
+ - profile
45
+ - email
46
+ userinfo_signing_algorithm: none
47
+ ```
48
+
49
+ Make sure to replace secret and redirect_urls with your own values.
50
+ Note! The secret configured in Authelia is ciphertext, i.e., a salted hash value. Its corresponding plaintext needs to be filled in LobeChat later.
51
+
52
+ Save the configuration file and restart the Authelia service. Now we have completed the Authelia configuration.
53
+
54
+ ### Configure Environment Variables
55
+
56
+ When deploying LobeChat, you need to configure the following environment variables:
57
+
58
+ | Environment Variable | Type | Description |
59
+ | --- | --- | --- |
60
+ | `NEXT_AUTH_SECRET` | Required | The secret used to encrypt Auth.js session tokens. You can generate a secret using the following command: `openssl rand -base64 32` |
61
+ | `NEXT_AUTH_SSO_PROVIDERS` | Required | Select the SSO provider for LoboChat. Use `authentik` for Authentik. |
62
+ | `AUTHELIA_CLIENT_ID` | Required | The id just configured in Authelia, example value is lobe-chat |
63
+ | `AUTHELIA_CLIENT_SECRET` | The plaintext corresponding to the secret just configured in Authelia, example value is insecure_secret |
64
+ | `AUTHELIA_ISSUER` | Required | Your Authelia URL, for example https://sso.example.com |
65
+ | `NEXTAUTH_URL` | Optional | This URL is used to specify the callback address for Auth.js when performing OAuth verification. It only needs to be set when the default generated redirect address is incorrect. https://chat.example.com/api/auth |
66
+
67
+ <Callout type={'tip'}>
68
+ Go to [📘 Environment Variables](/docs/self-hosting/environment-variable#Authelia) for details about the variables.
69
+ </Callout>
70
+ </Steps>
71
+
72
+ <Callout type={'info'}>
73
+ After a successful deployment, users will be able to use LobeChat by authenticating with the users
74
+ configured in Authelia.
75
+ </Callout>
@@ -0,0 +1,73 @@
1
+ ---
2
+ title: 在 LobeChat 中配置 Authelia 身份验证服务
3
+ description: 学习如何在 LobeChat 中配置 Authelia 身份验证服务,包括创建提供程序、配置环境变量和部署 LobeChat。详细步骤和必要环境变量设置。
4
+ tags:
5
+ - Authelia
6
+ - 身份验证
7
+ - 单点登录
8
+ - 环境变量
9
+ - LobeChat
10
+ ---
11
+
12
+ # 配置 Authelia 身份验证服务
13
+
14
+ ## Authelia 配置流程
15
+
16
+ <Steps>
17
+ ### 创建 Authelia 提供应用
18
+
19
+ 我们现在默认您已经了解了如何使用 Authelia。假设您的 LobeChat 实例部署在 `https://lobe.example.com/` 中。
20
+ 注意,目前只有 `localhost` 支持 HTTP 访问,其他域名需要启用 TLS,否则 Authelia 默认将主动中断身份认证。
21
+
22
+ 现在,我们打开 Authelia 实例的配置文件进行编辑:
23
+
24
+ 在 `identity_providers`-> `oidc` 下新增一个 `lobe-chat` 的项目:
25
+
26
+ ```yaml
27
+ ...
28
+ identity_providers:
29
+ oidc:
30
+ ...
31
+ ## The other portions of the mandatory OpenID Connect 1.0 configuration go here.
32
+ ## See: https://www.authelia.com/c/oidc
33
+ - id: lobe-chat
34
+ description: LobeChat
35
+ secret: '$pbkdf2-sha512$310000$c8p78n7pUMln0jzvd4aK4Q$JNRBzwAo0ek5qKn50cFzzvE9RXV88h1wJn5KGiHrD0YKtZaR/nCb2CJPOsKaPK0hjf.9yHxzQGZziziccp6Yng' # The digest of 'insecure_secret'.
36
+ public: false
37
+ authorization_policy: two_factor
38
+ redirect_uris:
39
+ - https://chat.example.com/api/auth/callback/authelia
40
+ scopes:
41
+ - openid
42
+ - profile
43
+ - email
44
+ userinfo_signing_algorithm: none
45
+ ```
46
+
47
+ 请您确保 `secret` 和 `redirect_urls` 替换成您自己的值。
48
+ 注意!Authelia 中配置 `secret` 是密文,即加盐哈希值。其对应的明文稍后需要填写在 lobeChat 中。
49
+
50
+ 保存配置文件,然后重启 Authelia 服务。现在我们完成了 Authelia 的配置工作。
51
+
52
+ ### 配置环境变量
53
+
54
+ 在部署 LobeChat 时,你需要配置以下环境变量:
55
+
56
+ | 环境变量 | 类型 | 描述 |
57
+ | --- | --- | --- |
58
+ | `NEXT_AUTH_SECRET` | 必选 | 用于加密 Auth.js 会话令牌的密钥。您可以使用以下命令生成秘钥: `openssl rand -base64 32` |
59
+ | `NEXT_AUTH_SSO_PROVIDERS` | 必选 | 选择 LoboChat 的单点登录提供商。使用 Authelia 请填写 `authelia`。 |
60
+ | `AUTHELIA_CLIENT_ID` | 必选 | 刚刚在 Authelia 配置的 `id`,示例值是 `lobe-chat` |
61
+ | `AUTHELIA_CLIENT_SECRET` | 必选 | 刚刚在 Authelia 配置的 `secret` 对应的明文,示例值是 `insecure_secret` |
62
+ | `AUTHELIA_ISSUER` | 必选 |您的 Authelia 的网址,例如 `https://sso.example.com` |
63
+ | `NEXTAUTH_URL` | 可选 | 该 URL 用于指定 Auth.js 在执行 OAuth 验证时的回调地址,当默认生成的重定向地址发生不正确时才需要设置。`https://chat.example.com/api/auth` |
64
+
65
+ <Callout type={'tip'}>
66
+ 前往 [📘 环境变量](/docs/self-hosting/environment-variable#Authelia) 可查阅相关变量详情。
67
+
68
+ </Callout>
69
+ </Steps>
70
+
71
+ <Callout type={'info'}>
72
+ 部署成功后,用户将可以使用 Authelia 中配置的用户通过身份认证并使用 LobeChat。
73
+ </Callout>
@@ -109,6 +109,29 @@ LobeChat provides a complete authentication service capability when deployed. Th
109
109
  - Default: `-`
110
110
  - Example: `https://your-authentik-domain.com/application/o/slug/`
111
111
 
112
+ ### Authelia
113
+
114
+ #### `AUTHELIA_CLIENT_ID`
115
+
116
+ - Type: Required
117
+ - Description: Client ID of the Authelia provider application. You can access it [here][auth0-client-page] and navigate to the application settings to view.
118
+ - Default: `-`
119
+ - Example: `lobe-chat`
120
+
121
+ #### `AUTHELIA_CLIENT_SECRET`
122
+
123
+ - Type: Required
124
+ - Description: The plaintext of the Client Secret for the Authelia provider
125
+ - Default: `-`
126
+ - Example: `insecure_secret`
127
+
128
+ #### `AUTHELIA_ISSUER`
129
+
130
+ - Type: Required
131
+ - Description: Issuer of the Authelia provider application.
132
+ - Default: `-`
133
+ - Example: `https://sso.example.com`
134
+
112
135
  ### Github
113
136
 
114
137
  #### `GITHUB_CLIENT_ID`
@@ -107,6 +107,29 @@ LobeChat 在部署时提供了完善的身份验证服务能力,以下是相
107
107
  - 默认值: `-`
108
108
  - 示例: `https://your-authentik-domain.com/application/o/slug/`
109
109
 
110
+ ### Authelia
111
+
112
+ #### `AUTHELIA_CLIENT_ID`
113
+
114
+ - 类型:必选
115
+ - 描述: Authelia 提供程序的 Client ID
116
+ - 默认值: `-`
117
+ - 示例: `lobe-chat`
118
+
119
+ #### `AUTHELIA_CLIENT_SECRET`
120
+
121
+ - 类型:必选
122
+ - 描述: Authelia 提供程序的 Client Secret 的明文
123
+ - 默认值: `-`
124
+ - 示例: `insecure_secret`
125
+
126
+ #### `AUTHELIA_ISSUER`
127
+
128
+ - 类型:必选
129
+ - 描述: Authentik 提供程序的 OpenID Connect 颁发者
130
+ - 默认值: `-`
131
+ - 示例: `https://sso.example.com`
132
+
110
133
  ### Github
111
134
 
112
135
  #### `GITHUB_CLIENT_ID`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "1.12.20",
3
+ "version": "1.13.1",
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",
@@ -81,6 +81,11 @@ export const getAuthConfig = () => {
81
81
  AUTHENTIK_CLIENT_SECRET: z.string().optional(),
82
82
  AUTHENTIK_ISSUER: z.string().optional(),
83
83
 
84
+ // AUTHELIA
85
+ AUTHELIA_CLIENT_ID: z.string().optional(),
86
+ AUTHELIA_CLIENT_SECRET: z.string().optional(),
87
+ AUTHELIA_ISSUER: z.string().optional(),
88
+
84
89
  // ZITADEL
85
90
  ZITADEL_CLIENT_ID: z.string().optional(),
86
91
  ZITADEL_CLIENT_SECRET: z.string().optional(),
@@ -118,6 +123,11 @@ export const getAuthConfig = () => {
118
123
  AUTHENTIK_CLIENT_SECRET: process.env.AUTHENTIK_CLIENT_SECRET,
119
124
  AUTHENTIK_ISSUER: process.env.AUTHENTIK_ISSUER,
120
125
 
126
+ // AUTHELIA
127
+ AUTHELIA_CLIENT_ID: process.env.AUTHELIA_CLIENT_ID,
128
+ AUTHELIA_CLIENT_SECRET: process.env.AUTHELIA_CLIENT_SECRET,
129
+ AUTHELIA_ISSUER: process.env.AUTHELIA_ISSUER,
130
+
121
131
  // ZITADEL
122
132
  ZITADEL_CLIENT_ID: process.env.ZITADEL_CLIENT_ID,
123
133
  ZITADEL_CLIENT_SECRET: process.env.ZITADEL_CLIENT_SECRET,
@@ -60,7 +60,7 @@ const Qwen: ModelProviderCard = {
60
60
  displayName: 'Qwen VL Plus',
61
61
  enabled: true,
62
62
  id: 'qwen-vl-plus',
63
- tokens: 6144,
63
+ tokens: 8192,
64
64
  vision: true,
65
65
  },
66
66
  {
@@ -69,7 +69,41 @@ const Qwen: ModelProviderCard = {
69
69
  displayName: 'Qwen VL Max',
70
70
  enabled: true,
71
71
  id: 'qwen-vl-max',
72
- tokens: 6144,
72
+ tokens: 8192,
73
+ vision: true,
74
+ },
75
+ {
76
+ description:
77
+ '以 Qwen-7B 语言模型初始化,添加图像模型,图像输入分辨率为448的预训练模型。',
78
+ displayName: 'Qwen VL',
79
+ enabled: true,
80
+ id: 'qwen-vl-v1',
81
+ tokens: 8192,
82
+ vision: true,
83
+ },
84
+ {
85
+ description:
86
+ '通义千问VL支持灵活的交互方式,包括多图、多轮问答、创作等能力的模型。',
87
+ displayName: 'Qwen VL Chat',
88
+ enabled: true,
89
+ id: 'qwen-vl-chat-v1',
90
+ tokens: 8192,
91
+ vision: true,
92
+ },
93
+ {
94
+ description: 'Qwen2-Math 模型具有强大的数学解题能力',
95
+ displayName: 'Qwen2 Math 72B',
96
+ enabled: true,
97
+ id: 'qwen2-math-72b-instruct',
98
+ tokens: 4096,
99
+ },
100
+ {
101
+ description:
102
+ '抢先体验即将升级的 qwen-vl-max 大模型。',
103
+ displayName: 'Qwen VL Max 0809',
104
+ enabled: true,
105
+ id: 'qwen-vl-max-0809',
106
+ tokens: 32_768,
73
107
  vision: true,
74
108
  },
75
109
  ],
@@ -0,0 +1,40 @@
1
+ import type { OIDCConfig } from '@auth/core/providers';
2
+
3
+ import { authEnv } from '@/config/auth';
4
+
5
+ import { CommonProviderConfig } from './sso.config';
6
+
7
+ export type AutheliaProfile = {
8
+ // The users display name
9
+ email: string;
10
+ // The users email
11
+ groups: string[];
12
+ // The username the user used to login with
13
+ name: string;
14
+ preferred_username: string; // The users groups
15
+ sub: string; // The users id
16
+ };
17
+
18
+ const provider = {
19
+ id: 'authelia',
20
+ provider: {
21
+ ...CommonProviderConfig,
22
+ authorization: { params: { scope: 'openid email profile' } },
23
+ checks: ['state', 'pkce'],
24
+ clientId: authEnv.AUTHELIA_CLIENT_ID,
25
+ clientSecret: authEnv.AUTHELIA_CLIENT_SECRET,
26
+ id: 'authelia',
27
+ issuer: authEnv.AUTHELIA_ISSUER,
28
+ name: 'Authelia',
29
+ profile(profile) {
30
+ return {
31
+ email: profile.email,
32
+ name: profile.name,
33
+ providerAccountId: profile.sub,
34
+ };
35
+ },
36
+ type: 'oidc',
37
+ } satisfies OIDCConfig<AutheliaProfile>,
38
+ };
39
+
40
+ export default provider;
@@ -1,7 +1,8 @@
1
1
  import Auth0 from './auth0';
2
+ import Authelia from './authelia';
2
3
  import Authentik from './authentik';
3
4
  import AzureAD from './azure-ad';
4
5
  import Github from './github';
5
6
  import Zitadel from './zitadel';
6
7
 
7
- export const ssoProviders = [Auth0, Authentik, AzureAD, Github, Zitadel];
8
+ export const ssoProviders = [Auth0, Authentik, AzureAD, Github, Zitadel, Authelia];