@lobehub/chat 0.161.7 → 0.161.9
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 +42 -0
- package/docs/self-hosting/advanced/feature-flags.mdx +45 -0
- package/docs/self-hosting/advanced/feature-flags.zh-CN.mdx +42 -0
- package/docs/self-hosting/environment-variables/basic.mdx +11 -2
- package/docs/self-hosting/environment-variables/basic.zh-CN.mdx +11 -2
- package/package.json +1 -1
- package/src/app/(main)/chat/(workspace)/@conversation/features/ChatInput/Desktop/Footer/DragUpload.tsx +92 -42
- package/src/app/(main)/chat/(workspace)/@conversation/features/ChatInput/Desktop/Footer/index.tsx +2 -2
- package/src/app/(main)/chat/(workspace)/@conversation/features/ChatInput/Mobile/Files.tsx +4 -3
- package/src/app/(main)/chat/@session/default.tsx +8 -2
- package/src/app/(main)/chat/@session/features/SessionListContent/List/index.tsx +1 -1
- package/src/app/(main)/chat/@session/features/SessionListContent/SearchMode.tsx +1 -1
- package/src/app/(main)/chat/@session/features/{SessionListContent/SkeletonList.tsx → SkeletonList.tsx} +2 -0
- package/src/app/(main)/settings/system-agent/features/Translation.tsx +0 -2
- package/src/components/FileList/ImageFileItem.tsx +1 -1
- package/src/const/meta.ts +1 -2
- package/src/layout/AuthProvider/Clerk/useAppearance.ts +1 -1
- package/src/store/session/slices/session/action.ts +5 -0
- package/src/store/session/slices/session/initialState.ts +1 -5
- package/src/store/session/slices/sessionGroup/initialState.ts +8 -1
- package/src/styles/antdOverride.ts +6 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,48 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog
|
|
4
4
|
|
|
5
|
+
### [Version 0.161.9](https://github.com/lobehub/lobe-chat/compare/v0.161.8...v0.161.9)
|
|
6
|
+
|
|
7
|
+
<sup>Released on **2024-05-23**</sup>
|
|
8
|
+
|
|
9
|
+
#### 💄 Styles
|
|
10
|
+
|
|
11
|
+
- **misc**: Fix image style and improve drag upload box.
|
|
12
|
+
|
|
13
|
+
<br/>
|
|
14
|
+
|
|
15
|
+
<details>
|
|
16
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
17
|
+
|
|
18
|
+
#### Styles
|
|
19
|
+
|
|
20
|
+
- **misc**: Fix image style and improve drag upload box, closes [#2610](https://github.com/lobehub/lobe-chat/issues/2610) ([5e1a4d6](https://github.com/lobehub/lobe-chat/commit/5e1a4d6))
|
|
21
|
+
|
|
22
|
+
</details>
|
|
23
|
+
|
|
24
|
+
<div align="right">
|
|
25
|
+
|
|
26
|
+
[](#readme-top)
|
|
27
|
+
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
### [Version 0.161.8](https://github.com/lobehub/lobe-chat/compare/v0.161.7...v0.161.8)
|
|
31
|
+
|
|
32
|
+
<sup>Released on **2024-05-22**</sup>
|
|
33
|
+
|
|
34
|
+
<br/>
|
|
35
|
+
|
|
36
|
+
<details>
|
|
37
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
38
|
+
|
|
39
|
+
</details>
|
|
40
|
+
|
|
41
|
+
<div align="right">
|
|
42
|
+
|
|
43
|
+
[](#readme-top)
|
|
44
|
+
|
|
45
|
+
</div>
|
|
46
|
+
|
|
5
47
|
### [Version 0.161.7](https://github.com/lobehub/lobe-chat/compare/v0.161.6...v0.161.7)
|
|
6
48
|
|
|
7
49
|
<sup>Released on **2024-05-22**</sup>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: LobeChat Feature Flags Environment Variables Configuration Guide
|
|
3
|
+
description: >-
|
|
4
|
+
Learn how to use environment variables to customize LobeChat's feature flags,
|
|
5
|
+
including controlling whether a feature is enabled or disabled, or enabling or
|
|
6
|
+
disabling features for specific user groups or environments as needed.
|
|
7
|
+
tags:
|
|
8
|
+
- LobeChat
|
|
9
|
+
- Environment Variables
|
|
10
|
+
- Configuration Guide
|
|
11
|
+
- Feature Flags
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# Feature Flags
|
|
15
|
+
|
|
16
|
+
In addition to basic environment variable configuration, LobeChat also offers feature flags to control whether a feature is enabled globally, or to enable or disable features for specific user groups or environments as needed.
|
|
17
|
+
|
|
18
|
+
## Feature Flags Environment Variable `FEATURE_FLAGS`
|
|
19
|
+
|
|
20
|
+
- Type: Optional
|
|
21
|
+
- Description: Used to control LobeChat's feature functionalities. Supports multiple feature flags, using `+` to add a feature and `-` to disable a feature. Separate multiple feature flags with a comma `,` and enclose the entire value in quotes `"` to avoid parsing errors.
|
|
22
|
+
- Default: `-`
|
|
23
|
+
- Example: `"-welcome_suggest"`
|
|
24
|
+
|
|
25
|
+
All features are controlled by the `FEATURE_FLAGS` variable as the sole configuration variable.
|
|
26
|
+
|
|
27
|
+
You can achieve various feature combinations using the above configuration syntax. All feature flags are Boolean values, enabled with `+` and disabled with `-`.
|
|
28
|
+
|
|
29
|
+
<Callout type={'tip'}>
|
|
30
|
+
Attention: Unlike the `OPENAI_MODEL_LIST` variable, the `FEATURE_FLAGS` variable does not support the `all` keyword. You need to manually control all feature flags (otherwise, they will adopt their default values).
|
|
31
|
+
</Callout>
|
|
32
|
+
|
|
33
|
+
| Configuration Item | Description | Default Value |
|
|
34
|
+
| ------------------------- | --------------------------------- | ------------- |
|
|
35
|
+
| `webrtc_sync` | Enables WebRTC sync functionality.| Enabled |
|
|
36
|
+
| `language_model_settings` | Enables language model settings. | Enabled |
|
|
37
|
+
| `openai_api_key` | Allows users to customize the OpenAI API Key. | Enabled |
|
|
38
|
+
| `openai_proxy_url` | Allows users to customize the OpenAI proxy URL. | Enabled |
|
|
39
|
+
| `create_session` | Allows users to create sessions. | Enabled |
|
|
40
|
+
| `edit_agent` | Allows users to edit assistants. | Enabled |
|
|
41
|
+
| `dalle` | Enables the DALL-E functionality. | Enabled |
|
|
42
|
+
| `check_updates` | Allows checking for updates. | Enabled |
|
|
43
|
+
| `welcome_suggest` | Displays welcome suggestions. | Enabled |
|
|
44
|
+
|
|
45
|
+
You can always check the [featureFlags](https://github.com/lobehub/lobe-chat/blob/main/src/config/featureFlags/schema.ts) to get the latest list of feature flags.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: LobeChat 特性标志环境变量配置指南
|
|
3
|
+
description: 了解如何使用环境变量自定义 LobeChat 的特性标志,包括控制否启用某个功能、或者根据需要对特定用户群体或环境启用或禁用功能。
|
|
4
|
+
tags:
|
|
5
|
+
- LobeChat
|
|
6
|
+
- 环境变量
|
|
7
|
+
- 配置指南
|
|
8
|
+
- 特征标志
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# 特性标志
|
|
12
|
+
|
|
13
|
+
除了基础的环境变量配置外,LobeChat 还提供了一些特性标志(Feature Flags),用于控制是否全局启用某个功能,或者根据需要对特定用户群体或环境启用或禁用功能。
|
|
14
|
+
|
|
15
|
+
## 特性标志环境变量 `FEATURE_FLAGS`
|
|
16
|
+
|
|
17
|
+
- 类型:可选
|
|
18
|
+
- 描述:用于控制 LobeChat 的特性功能,支持多个功能标志,使用 `+` 增加一个功能,使用 `-` 来关闭一个功能,多个功能标志之间使用英文逗号 `,` 隔开,最外层建议添加引号 `"` 以避免解析错误。
|
|
19
|
+
- 默认值:`-`
|
|
20
|
+
- 示例:`"-welcome_suggest"`
|
|
21
|
+
|
|
22
|
+
所有的功能统一以特性标志 `FEATURE_FLAGS` 作为唯一的配置变量。
|
|
23
|
+
|
|
24
|
+
你可以通过上述配置语法来实现更多的功能组合。所有的功能配置项都是布尔类型,通过 `+` 来启用,通过 `-` 来关闭。
|
|
25
|
+
|
|
26
|
+
<Callout type={'tip'}>
|
|
27
|
+
注意:与 `OPENAI_MODEL_LIST` 变量不同,`FEATURE_FLAGS` 变量不支持 `all` 关键字,你需要手动控制所有的功能标志(否则它们会采用对应的默认值)。
|
|
28
|
+
</Callout>
|
|
29
|
+
|
|
30
|
+
| 配置项 | 解释 | 默认值 |
|
|
31
|
+
| ------------------------- | -------------------------------- | ------ |
|
|
32
|
+
| `webrtc_sync` | 启用 WebRTC 同步功能。 | 开启 |
|
|
33
|
+
| `language_model_settings` | 启用语言模型设置。 | 开启 |
|
|
34
|
+
| `openai_api_key` | 允许用户自定义 OpenAI API Key。 | 开启 |
|
|
35
|
+
| `openai_proxy_url` | 允许用户自定义 OpenAI 代理 URL。 | 开启 |
|
|
36
|
+
| `create_session` | 允许用户创建会话。 | 开启 |
|
|
37
|
+
| `edit_agent` | 允许用户编辑助手。 | 开启 |
|
|
38
|
+
| `dalle` | 启用 DALL-E 功能。 | 开启 |
|
|
39
|
+
| `check_updates` | 允许检查更新。 | 开启 |
|
|
40
|
+
| `welcome_suggest` | 显示欢迎建议。 | 开启 |
|
|
41
|
+
|
|
42
|
+
你可以随时检查 [featureFlags](https://github.com/lobehub/lobe-chat/blob/main/src/config/featureFlags/schema.ts) 以获取最新的特性标志列表。
|
|
@@ -36,7 +36,7 @@ LobeChat provides some additional configuration options during deployment, which
|
|
|
36
36
|
|
|
37
37
|
When using the `random` mode, a random API Key will be selected from the available multiple API Keys.
|
|
38
38
|
|
|
39
|
-
When using the `turn` mode, the API Keys will be retrieved in a
|
|
39
|
+
When using the `turn` mode, the API Keys will be retrieved in a polling manner according to the specified order.
|
|
40
40
|
|
|
41
41
|
### `NEXT_PUBLIC_BASE_PATH`
|
|
42
42
|
|
|
@@ -50,7 +50,7 @@ When using the `turn` mode, the API Keys will be retrieved in a round-robin mann
|
|
|
50
50
|
- Type: Optional
|
|
51
51
|
- 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.
|
|
52
52
|
- Default: -
|
|
53
|
-
- Example: `'model=gpt-4-1106-preview;params.max_tokens=300;plugins=search-engine,lobe-image-designer`
|
|
53
|
+
- Example: `'model=gpt-4-1106-preview;params.max_tokens=300;plugins=search-engine,lobe-image-designer'`
|
|
54
54
|
|
|
55
55
|
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:
|
|
56
56
|
|
|
@@ -71,6 +71,15 @@ Further reading:
|
|
|
71
71
|
|
|
72
72
|
- [[RFC] 022 - Default Assistant Parameters Configuration via Environment Variables](https://github.com/lobehub/lobe-chat/discussions/913)
|
|
73
73
|
|
|
74
|
+
### `FEATURE_FLAGS`
|
|
75
|
+
|
|
76
|
+
- Type: Optional
|
|
77
|
+
- Description: Used to control LobeChat's feature functionalities. Supports multiple feature flags, using `+` to add a feature and `-` to disable a feature. Separate multiple feature flags with a comma `,` and enclose the entire value in quotes `"` to avoid parsing errors.
|
|
78
|
+
- Default: `-`
|
|
79
|
+
- Example: `"-welcome_suggest"`
|
|
80
|
+
|
|
81
|
+
For specific content, please refer to the [Feature Flags](/docs/self-hosting/advanced/feature-flags) documentation.
|
|
82
|
+
|
|
74
83
|
## Plugin Service
|
|
75
84
|
|
|
76
85
|
### `PLUGINS_INDEX_URL`
|
|
@@ -32,7 +32,7 @@ LobeChat 在部署时提供了一些额外的配置项,你可以使用环境
|
|
|
32
32
|
|
|
33
33
|
使用 `random` 模式下,将在多个 API Keys 中随机获取一个 API Key。
|
|
34
34
|
|
|
35
|
-
使用 `turn`
|
|
35
|
+
使用 `turn` 模式下,将按照填写的顺序,轮询获取得到 API Key。
|
|
36
36
|
|
|
37
37
|
### `NEXT_PUBLIC_BASE_PATH`
|
|
38
38
|
|
|
@@ -46,7 +46,7 @@ LobeChat 在部署时提供了一些额外的配置项,你可以使用环境
|
|
|
46
46
|
- 类型:可选
|
|
47
47
|
- 描述:用于配置 LobeChat 默认助理的默认配置。它支持多种数据类型和结构,包括键值对、嵌套字段、数组值等。
|
|
48
48
|
- 默认值:`-`
|
|
49
|
-
- 示例:`'model=gpt-4-1106-preview;params.max_tokens=300;plugins=search-engine,lobe-image-designer`
|
|
49
|
+
- 示例:`'model=gpt-4-1106-preview;params.max_tokens=300;plugins=search-engine,lobe-image-designer'`
|
|
50
50
|
|
|
51
51
|
`DEFAULT_AGENT_CONFIG` 用于配置 LobeChat 默认助理的默认配置。它支持多种数据类型和结构,包括键值对、嵌套字段、数组值等。下表详细说明了 `DEFAULT_AGENT_CONFIG` 环境变量的配置项、示例以及相应解释:
|
|
52
52
|
|
|
@@ -67,6 +67,15 @@ LobeChat 在部署时提供了一些额外的配置项,你可以使用环境
|
|
|
67
67
|
|
|
68
68
|
- [[RFC] 022 - 环境变量配置默认助手参数](https://github.com/lobehub/lobe-chat/discussions/913)
|
|
69
69
|
|
|
70
|
+
### `FEATURE_FLAGS`
|
|
71
|
+
|
|
72
|
+
- 类型:可选
|
|
73
|
+
- 描述:用于控制 LobeChat 的特性功能,支持多个功能标志,使用 `+` 增加一个功能,使用 `-` 来关闭一个功能,多个功能标志之间使用英文逗号 `,` 隔开,最外层建议添加引号 `"` 以避免解析错误。
|
|
74
|
+
- 默认值:`-`
|
|
75
|
+
- 示例:`"-welcome_suggest"`
|
|
76
|
+
|
|
77
|
+
具体的内容可以参见 [特性标志](/zh/docs/self-hosting/advanced/feature-flags) 中的说明。
|
|
78
|
+
|
|
70
79
|
## 插件服务
|
|
71
80
|
|
|
72
81
|
### `PLUGINS_INDEX_URL`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/chat",
|
|
3
|
-
"version": "0.161.
|
|
3
|
+
"version": "0.161.9",
|
|
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",
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Icon } from '@lobehub/ui';
|
|
2
2
|
import { createStyles } from 'antd-style';
|
|
3
3
|
import { FileImage, FileText, FileUpIcon } from 'lucide-react';
|
|
4
|
-
import {
|
|
4
|
+
import { darken, lighten } from 'polished';
|
|
5
5
|
import { memo, useEffect, useRef, useState } from 'react';
|
|
6
|
+
import { createPortal } from 'react-dom';
|
|
6
7
|
import { useTranslation } from 'react-i18next';
|
|
7
8
|
import { Center, Flexbox } from 'react-layout-kit';
|
|
8
9
|
|
|
@@ -12,50 +13,57 @@ import { useFileStore } from '@/store/file';
|
|
|
12
13
|
import { useUserStore } from '@/store/user';
|
|
13
14
|
import { modelProviderSelectors } from '@/store/user/selectors';
|
|
14
15
|
|
|
15
|
-
const
|
|
16
|
+
const DRAGGING_ROOT_ID = 'dragging-root';
|
|
17
|
+
const getContainer = () => document.querySelector(`#${DRAGGING_ROOT_ID}`);
|
|
18
|
+
const BLOCK_SIZE = 64;
|
|
19
|
+
const ICON_SIZE = 36;
|
|
20
|
+
|
|
21
|
+
const useStyles = createStyles(({ css, token }) => {
|
|
16
22
|
return {
|
|
17
23
|
container: css`
|
|
18
|
-
width:
|
|
19
|
-
height:
|
|
20
|
-
padding:
|
|
21
|
-
|
|
22
|
-
color: ${token.colorWhite};
|
|
24
|
+
width: 320px;
|
|
25
|
+
height: 200px;
|
|
26
|
+
padding: ${token.borderRadiusLG + 4}px;
|
|
23
27
|
|
|
24
28
|
background: ${token.geekblue};
|
|
25
29
|
border-radius: 16px;
|
|
26
|
-
box-shadow:
|
|
27
|
-
${rgba(token.geekblue, 0.1)} 0 1px 1px 0 inset,
|
|
28
|
-
${rgba(token.geekblue, 0.1)} 0 50px 100px -20px,
|
|
29
|
-
${rgba(token.geekblue, 0.3)} 0 30px 60px -30px;
|
|
30
30
|
`,
|
|
31
31
|
content: css`
|
|
32
32
|
width: 100%;
|
|
33
33
|
height: 100%;
|
|
34
34
|
padding: 16px;
|
|
35
35
|
|
|
36
|
-
border:
|
|
37
|
-
border-radius:
|
|
36
|
+
border: 1.5px dashed ${token.colorBorder};
|
|
37
|
+
border-radius: ${token.borderRadiusLG}px;
|
|
38
38
|
`,
|
|
39
39
|
desc: css`
|
|
40
|
-
color:
|
|
40
|
+
color: #fff;
|
|
41
|
+
`,
|
|
42
|
+
icon: css`
|
|
43
|
+
color: ${darken(0.05, token.geekblue)};
|
|
44
|
+
background: ${lighten(0.38, token.geekblue)};
|
|
45
|
+
border-radius: ${token.borderRadiusLG}px;
|
|
46
|
+
`,
|
|
47
|
+
iconGroup: css`
|
|
48
|
+
margin-top: -44px;
|
|
41
49
|
`,
|
|
42
50
|
title: css`
|
|
43
|
-
font-size:
|
|
51
|
+
font-size: 20px;
|
|
44
52
|
font-weight: bold;
|
|
53
|
+
color: #fff;
|
|
45
54
|
`,
|
|
46
55
|
wrapper: css`
|
|
47
56
|
position: fixed;
|
|
48
|
-
z-index:
|
|
49
|
-
|
|
50
|
-
left: 0;
|
|
57
|
+
z-index: 9999;
|
|
58
|
+
inset: 0;
|
|
51
59
|
|
|
52
60
|
width: 100%;
|
|
53
61
|
height: 100%;
|
|
54
62
|
|
|
55
|
-
transition: all 0.3s ease-in-out;
|
|
56
|
-
|
|
57
63
|
background: ${token.colorBgMask};
|
|
58
|
-
|
|
64
|
+
backdrop-filter: blur(4px);
|
|
65
|
+
|
|
66
|
+
transition: all 0.3s ease-in-out;
|
|
59
67
|
`,
|
|
60
68
|
};
|
|
61
69
|
});
|
|
@@ -70,7 +78,7 @@ const handleDragOver = (e: DragEvent) => {
|
|
|
70
78
|
};
|
|
71
79
|
|
|
72
80
|
const DragUpload = memo(() => {
|
|
73
|
-
const { styles } = useStyles();
|
|
81
|
+
const { styles, theme } = useStyles();
|
|
74
82
|
const { t } = useTranslation('chat');
|
|
75
83
|
const [isDragging, setIsDragging] = useState(false);
|
|
76
84
|
// When a file is dragged to a different area, the 'dragleave' event may be triggered,
|
|
@@ -151,6 +159,17 @@ const DragUpload = memo(() => {
|
|
|
151
159
|
uploadImages(files);
|
|
152
160
|
};
|
|
153
161
|
|
|
162
|
+
useEffect(() => {
|
|
163
|
+
if (getContainer()) return;
|
|
164
|
+
const root = document.createElement('div');
|
|
165
|
+
root.id = DRAGGING_ROOT_ID;
|
|
166
|
+
document.body.append(root);
|
|
167
|
+
|
|
168
|
+
return () => {
|
|
169
|
+
root.remove();
|
|
170
|
+
};
|
|
171
|
+
}, []);
|
|
172
|
+
|
|
154
173
|
useEffect(() => {
|
|
155
174
|
window.addEventListener('dragenter', handleDragEnter);
|
|
156
175
|
window.addEventListener('dragover', handleDragOver);
|
|
@@ -167,28 +186,59 @@ const DragUpload = memo(() => {
|
|
|
167
186
|
};
|
|
168
187
|
}, [handleDragEnter, handleDragOver, handleDragLeave, handleDrop, handlePaste]);
|
|
169
188
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
189
|
+
if (!isDragging) return;
|
|
190
|
+
|
|
191
|
+
return createPortal(
|
|
192
|
+
<Center className={styles.wrapper}>
|
|
193
|
+
<div className={styles.container}>
|
|
194
|
+
<Center className={styles.content} gap={12}>
|
|
195
|
+
<Flexbox className={styles.iconGroup} horizontal>
|
|
196
|
+
<Center
|
|
197
|
+
className={styles.icon}
|
|
198
|
+
height={BLOCK_SIZE * 1.25}
|
|
199
|
+
style={{
|
|
200
|
+
background: lighten(0.32, theme.geekblue),
|
|
201
|
+
transform: 'rotateZ(-20deg) translateX(10px)',
|
|
202
|
+
}}
|
|
203
|
+
width={BLOCK_SIZE}
|
|
204
|
+
>
|
|
205
|
+
<Icon icon={FileImage} size={{ fontSize: ICON_SIZE, strokeWidth: 1.5 }} />
|
|
206
|
+
</Center>
|
|
207
|
+
<Center
|
|
208
|
+
className={styles.icon}
|
|
209
|
+
height={BLOCK_SIZE * 1.25}
|
|
210
|
+
style={{
|
|
211
|
+
transform: 'translateY(-12px)',
|
|
212
|
+
zIndex: 1,
|
|
213
|
+
}}
|
|
214
|
+
width={BLOCK_SIZE}
|
|
215
|
+
>
|
|
216
|
+
<Icon icon={FileUpIcon} size={{ fontSize: ICON_SIZE, strokeWidth: 1.5 }} />
|
|
217
|
+
</Center>
|
|
218
|
+
<Center
|
|
219
|
+
className={styles.icon}
|
|
220
|
+
height={BLOCK_SIZE * 1.25}
|
|
221
|
+
style={{
|
|
222
|
+
background: lighten(0.32, theme.geekblue),
|
|
223
|
+
transform: 'rotateZ(20deg) translateX(-10px)',
|
|
224
|
+
}}
|
|
225
|
+
width={BLOCK_SIZE}
|
|
226
|
+
>
|
|
227
|
+
<Icon icon={FileText} size={{ fontSize: ICON_SIZE, strokeWidth: 1.5 }} />
|
|
228
|
+
</Center>
|
|
229
|
+
</Flexbox>
|
|
230
|
+
<Flexbox align={'center'} gap={8} style={{ textAlign: 'center' }}>
|
|
231
|
+
<Flexbox className={styles.title}>
|
|
232
|
+
{t(enabledFiles ? 'upload.dragFileTitle' : 'upload.dragTitle')}
|
|
179
233
|
</Flexbox>
|
|
180
|
-
<Flexbox
|
|
181
|
-
|
|
182
|
-
{t(enabledFiles ? 'upload.dragFileTitle' : 'upload.dragTitle')}
|
|
183
|
-
</Flexbox>
|
|
184
|
-
<Flexbox className={styles.desc}>
|
|
185
|
-
{t(enabledFiles ? 'upload.dragFileDesc' : 'upload.dragDesc')}
|
|
186
|
-
</Flexbox>
|
|
234
|
+
<Flexbox className={styles.desc}>
|
|
235
|
+
{t(enabledFiles ? 'upload.dragFileDesc' : 'upload.dragDesc')}
|
|
187
236
|
</Flexbox>
|
|
188
|
-
</
|
|
189
|
-
</
|
|
190
|
-
</
|
|
191
|
-
|
|
237
|
+
</Flexbox>
|
|
238
|
+
</Center>
|
|
239
|
+
</div>
|
|
240
|
+
</Center>,
|
|
241
|
+
getContainer()!,
|
|
192
242
|
);
|
|
193
243
|
});
|
|
194
244
|
|
package/src/app/(main)/chat/(workspace)/@conversation/features/ChatInput/Desktop/Footer/index.tsx
CHANGED
|
@@ -101,7 +101,7 @@ const Footer = memo<FooterProps>(({ setExpand }) => {
|
|
|
101
101
|
horizontal
|
|
102
102
|
padding={'0 24px'}
|
|
103
103
|
>
|
|
104
|
-
<Flexbox align={'center'} gap={8} horizontal>
|
|
104
|
+
<Flexbox align={'center'} gap={8} horizontal style={{ overflow: 'hidden' }}>
|
|
105
105
|
{canUpload && (
|
|
106
106
|
<>
|
|
107
107
|
<DragUpload />
|
|
@@ -109,7 +109,7 @@ const Footer = memo<FooterProps>(({ setExpand }) => {
|
|
|
109
109
|
</>
|
|
110
110
|
)}
|
|
111
111
|
</Flexbox>
|
|
112
|
-
<Flexbox align={'center'} gap={8} horizontal>
|
|
112
|
+
<Flexbox align={'center'} flex={'none'} gap={8} horizontal>
|
|
113
113
|
<Flexbox
|
|
114
114
|
gap={4}
|
|
115
115
|
horizontal
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { memo } from 'react';
|
|
2
|
+
import { Flexbox } from 'react-layout-kit';
|
|
2
3
|
|
|
3
4
|
import EditableFileList from '@/components/FileList/EditableFileList';
|
|
4
5
|
import { useFileStore } from '@/store/file';
|
|
@@ -9,9 +10,9 @@ const Files = memo(() => {
|
|
|
9
10
|
if (!inputFilesList || inputFilesList?.length === 0) return null;
|
|
10
11
|
|
|
11
12
|
return (
|
|
12
|
-
<
|
|
13
|
-
<EditableFileList alwaysShowClose items={inputFilesList} padding={'
|
|
14
|
-
</
|
|
13
|
+
<Flexbox paddingBlock={4} style={{ position: 'relative' }}>
|
|
14
|
+
<EditableFileList alwaysShowClose items={inputFilesList} padding={'4px 8px 8px'} />
|
|
15
|
+
</Flexbox>
|
|
15
16
|
);
|
|
16
17
|
});
|
|
17
18
|
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
import { Suspense, lazy } from 'react';
|
|
2
|
+
|
|
1
3
|
import ServerLayout from '@/components/server/ServerLayout';
|
|
2
4
|
|
|
3
5
|
import Desktop from './_layout/Desktop';
|
|
4
6
|
import Mobile from './_layout/Mobile';
|
|
5
7
|
import SessionHydration from './features/SessionHydration';
|
|
6
|
-
import
|
|
8
|
+
import SkeletonList from './features/SkeletonList';
|
|
9
|
+
|
|
10
|
+
const SessionListContent = lazy(() => import('./features/SessionListContent'));
|
|
7
11
|
|
|
8
12
|
const Layout = ServerLayout({ Desktop, Mobile });
|
|
9
13
|
|
|
@@ -11,7 +15,9 @@ const Session = () => {
|
|
|
11
15
|
return (
|
|
12
16
|
<>
|
|
13
17
|
<Layout>
|
|
14
|
-
<
|
|
18
|
+
<Suspense fallback={<SkeletonList />}>
|
|
19
|
+
<SessionListContent />
|
|
20
|
+
</Suspense>
|
|
15
21
|
</Layout>
|
|
16
22
|
<SessionHydration />
|
|
17
23
|
</>
|
|
@@ -12,7 +12,7 @@ import { useSessionStore } from '@/store/session';
|
|
|
12
12
|
import { sessionSelectors } from '@/store/session/selectors';
|
|
13
13
|
import { LobeAgentSession } from '@/types/session';
|
|
14
14
|
|
|
15
|
-
import SkeletonList from '
|
|
15
|
+
import SkeletonList from '../../SkeletonList';
|
|
16
16
|
import AddButton from './AddButton';
|
|
17
17
|
import SessionItem from './Item';
|
|
18
18
|
|
|
@@ -2,8 +2,8 @@ import { memo } from 'react';
|
|
|
2
2
|
|
|
3
3
|
import { useSessionStore } from '@/store/session';
|
|
4
4
|
|
|
5
|
+
import SkeletonList from '../SkeletonList';
|
|
5
6
|
import SessionList from './List';
|
|
6
|
-
import SkeletonList from './SkeletonList';
|
|
7
7
|
|
|
8
8
|
const SearchMode = memo(() => {
|
|
9
9
|
const [sessionSearchKeywords, useSearchSessions] = useSessionStore((s) => [
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import { Form, type ItemGroup } from '@lobehub/ui';
|
|
4
4
|
import { Form as AntForm } from 'antd';
|
|
5
5
|
import isEqual from 'fast-deep-equal';
|
|
6
|
-
import { Globe } from 'lucide-react';
|
|
7
6
|
import { memo } from 'react';
|
|
8
7
|
import { useTranslation } from 'react-i18next';
|
|
9
8
|
|
|
@@ -40,7 +39,6 @@ const Translation = memo(() => {
|
|
|
40
39
|
name: [SYSTEM_AGENT_SETTING_KEY, 'translation', 'model'],
|
|
41
40
|
},
|
|
42
41
|
],
|
|
43
|
-
icon: Globe,
|
|
44
42
|
title: t('systemAgent.translation.title'),
|
|
45
43
|
};
|
|
46
44
|
|
|
@@ -19,7 +19,7 @@ export const useStyles = createStyles(({ css, token }) => ({
|
|
|
19
19
|
`,
|
|
20
20
|
editableImage: css`
|
|
21
21
|
background: ${token.colorBgContainer};
|
|
22
|
-
|
|
22
|
+
box-shadow: 0 0 0 1px ${token.colorFill} inset;
|
|
23
23
|
`,
|
|
24
24
|
image: css`
|
|
25
25
|
margin-block: 0 !important;
|
package/src/const/meta.ts
CHANGED
|
@@ -5,5 +5,4 @@ export const DEFAULT_USER_AVATAR = '😀';
|
|
|
5
5
|
export const DEFAULT_BACKGROUND_COLOR = 'rgba(0,0,0,0)';
|
|
6
6
|
export const DEFAULT_AGENT_META: MetaData = {};
|
|
7
7
|
export const DEFAULT_INBOX_AVATAR = '🤯';
|
|
8
|
-
export const DEFAULT_USER_AVATAR_URL =
|
|
9
|
-
'https://registry.npmmirror.com/@lobehub/assets-logo/1.2.0/files/assets/logo-3d.webp';
|
|
8
|
+
export const DEFAULT_USER_AVATAR_URL = '/icons/icon-192x192.png';
|
|
@@ -112,7 +112,7 @@ export const useAppearance = () => {
|
|
|
112
112
|
colorDanger: theme.colorError,
|
|
113
113
|
colorInputBackground: theme.colorFillTertiary,
|
|
114
114
|
colorNeutral: theme.colorText,
|
|
115
|
-
|
|
115
|
+
|
|
116
116
|
colorSuccess: theme.colorSuccess,
|
|
117
117
|
colorText: theme.colorText,
|
|
118
118
|
colorTextSecondary: theme.colorTextDescription,
|
|
@@ -194,6 +194,10 @@ export const createSessionSlice: StateCreator<
|
|
|
194
194
|
|
|
195
195
|
useFetchSessions: () =>
|
|
196
196
|
useClientDataSWR<ChatSessionList>(FETCH_SESSIONS_KEY, sessionService.getGroupedSessions, {
|
|
197
|
+
fallbackData: {
|
|
198
|
+
sessionGroups: [],
|
|
199
|
+
sessions: [],
|
|
200
|
+
},
|
|
197
201
|
onSuccess: (data) => {
|
|
198
202
|
if (
|
|
199
203
|
get().isSessionsFirstFetchFinished &&
|
|
@@ -209,6 +213,7 @@ export const createSessionSlice: StateCreator<
|
|
|
209
213
|
);
|
|
210
214
|
set({ isSessionsFirstFetchFinished: true }, false, n('useFetchSessions/onSuccess', data));
|
|
211
215
|
},
|
|
216
|
+
suspense: true,
|
|
212
217
|
}),
|
|
213
218
|
useSearchSessions: (keyword) =>
|
|
214
219
|
useSWR<LobeSessions>(
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LobeAgentSession } from '@/types/session';
|
|
2
2
|
|
|
3
3
|
export interface SessionState {
|
|
4
4
|
/**
|
|
@@ -6,13 +6,11 @@ export interface SessionState {
|
|
|
6
6
|
* @description 当前正在编辑或查看的会话
|
|
7
7
|
*/
|
|
8
8
|
activeId: string;
|
|
9
|
-
customSessionGroups: CustomSessionGroup[];
|
|
10
9
|
defaultSessions: LobeAgentSession[];
|
|
11
10
|
isSearching: boolean;
|
|
12
11
|
isSessionsFirstFetchFinished: boolean;
|
|
13
12
|
pinnedSessions: LobeAgentSession[];
|
|
14
13
|
searchKeywords: string;
|
|
15
|
-
sessionGroups: LobeSessionGroups;
|
|
16
14
|
sessionSearchKeywords?: string;
|
|
17
15
|
/**
|
|
18
16
|
* it means defaultSessions
|
|
@@ -22,12 +20,10 @@ export interface SessionState {
|
|
|
22
20
|
|
|
23
21
|
export const initialSessionState: SessionState = {
|
|
24
22
|
activeId: 'inbox',
|
|
25
|
-
customSessionGroups: [],
|
|
26
23
|
defaultSessions: [],
|
|
27
24
|
isSearching: false,
|
|
28
25
|
isSessionsFirstFetchFinished: false,
|
|
29
26
|
pinnedSessions: [],
|
|
30
27
|
searchKeywords: '',
|
|
31
|
-
sessionGroups: [],
|
|
32
28
|
sessions: [],
|
|
33
29
|
};
|
|
@@ -1,5 +1,12 @@
|
|
|
1
|
+
import { CustomSessionGroup, LobeSessionGroups } from '@/types/session';
|
|
2
|
+
|
|
1
3
|
export interface SessionGroupState {
|
|
2
4
|
activeGroupId?: string;
|
|
5
|
+
customSessionGroups: CustomSessionGroup[];
|
|
6
|
+
sessionGroups: LobeSessionGroups;
|
|
3
7
|
}
|
|
4
8
|
|
|
5
|
-
export const initSessionGroupState: SessionGroupState = {
|
|
9
|
+
export const initSessionGroupState: SessionGroupState = {
|
|
10
|
+
customSessionGroups: [],
|
|
11
|
+
sessionGroups: [],
|
|
12
|
+
};
|
|
@@ -9,4 +9,10 @@ export default ({ token }: { prefixCls: string; token: Theme }) => css`
|
|
|
9
9
|
border: 1px solid ${token.colorBorder};
|
|
10
10
|
box-shadow: ${token.boxShadow};
|
|
11
11
|
}
|
|
12
|
+
|
|
13
|
+
.${token.prefixCls}-menu-item-selected {
|
|
14
|
+
.${token.prefixCls}-menu-title-content {
|
|
15
|
+
color: ${token.colorText};
|
|
16
|
+
}
|
|
17
|
+
}
|
|
12
18
|
`;
|