@lobehub/chat 1.29.0 → 1.29.2

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.29.2](https://github.com/lobehub/lobe-chat/compare/v1.29.1...v1.29.2)
6
+
7
+ <sup>Released on **2024-11-09**</sup>
8
+
9
+ #### 💄 Styles
10
+
11
+ - **misc**: Allow users to disable SSRF or set a whitelist.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### Styles
19
+
20
+ - **misc**: Allow users to disable SSRF or set a whitelist, closes [#4633](https://github.com/lobehub/lobe-chat/issues/4633) ([7175145](https://github.com/lobehub/lobe-chat/commit/7175145))
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.29.1](https://github.com/lobehub/lobe-chat/compare/v1.29.0...v1.29.1)
31
+
32
+ <sup>Released on **2024-11-09**</sup>
33
+
34
+ #### 🐛 Bug Fixes
35
+
36
+ - **misc**: Fix topic summary field on server db.
37
+
38
+ <br/>
39
+
40
+ <details>
41
+ <summary><kbd>Improvements and Fixes</kbd></summary>
42
+
43
+ #### What's fixed
44
+
45
+ - **misc**: Fix topic summary field on server db, closes [#4655](https://github.com/lobehub/lobe-chat/issues/4655) ([ce10f9a](https://github.com/lobehub/lobe-chat/commit/ce10f9a))
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.29.0](https://github.com/lobehub/lobe-chat/compare/v1.28.6...v1.29.0)
6
56
 
7
57
  <sup>Released on **2024-11-09**</sup>
@@ -93,6 +93,20 @@ For specific content, please refer to the [Feature Flags](/docs/self-hosting/adv
93
93
  try using `host.docker.internal` instead of `localhost`.
94
94
  </Callout>
95
95
 
96
+ ### `SSRF_ALLOW_PRIVATE_IP_ADDRESS`
97
+
98
+ - Type: Optional
99
+ - Description: Allow to connect private IP address. In a trusted environment, it can be set to true to turn off SSRF protection.
100
+ - Default: `0`
101
+ - Example: `1` or `0`
102
+
103
+ ### `SSRF_ALLOW_IP_ADDRESS_LIST`
104
+
105
+ - Type: Optional
106
+ - Description: Allow private IP address list, multiple IP addresses are separated by commas. Only when `SSRF_ALLOW_PRIVATE_IP_ADDRESS` is `0`, it takes effect.
107
+ - Default: -
108
+ - Example: `198.18.1.62,224.0.0.3`
109
+
96
110
  ## Plugin Service
97
111
 
98
112
  ### `PLUGINS_INDEX_URL`
@@ -88,6 +88,20 @@ LobeChat 在部署时提供了一些额外的配置项,你可以使用环境
88
88
  是走到自身容器的 `localhost`,此时请尝试用 `host.docker.internal` 替代 `localhost`
89
89
  </Callout>
90
90
 
91
+ ### `SSRF_ALLOW_PRIVATE_IP_ADDRESS`
92
+
93
+ - 类型:可选
94
+ - 描述:是否允许连接私有IP地址。在可信环境中可以设置为true来关闭SSRF防护。
95
+ - 默认值:`0`
96
+ - 示例:`1` or `0`
97
+
98
+ ### `SSRF_ALLOW_IP_ADDRESS_LIST`
99
+
100
+ - 类型:可选
101
+ - 描述:允许连接的私有IP地址列表,多个IP地址时使用逗号分隔。当 `SSRF_ALLOW_PRIVATE_IP_ADDRESS` 为 `0` 时才会生效。
102
+ - 默认值:-
103
+ - 示例:`198.18.1.62,224.0.0.3`
104
+
91
105
  ## 插件服务
92
106
 
93
107
  ### `PLUGINS_INDEX_URL`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "1.29.0",
3
+ "version": "1.29.2",
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,6 +1,8 @@
1
1
  import { NextResponse } from 'next/server';
2
2
  import fetch from 'node-fetch';
3
- import { useAgent as ssrfAgent } from 'request-filtering-agent';
3
+ import { RequestFilteringAgentOptions, useAgent as ssrfAgent } from 'request-filtering-agent';
4
+
5
+ import { appEnv } from '@/config/app';
4
6
 
5
7
  /**
6
8
  * just for a proxy
@@ -9,7 +11,14 @@ export const POST = async (req: Request) => {
9
11
  const url = await req.text();
10
12
 
11
13
  try {
12
- const res = await fetch(url, { agent: ssrfAgent(url) });
14
+ // https://www.npmjs.com/package/request-filtering-agent
15
+ const options: RequestFilteringAgentOptions = {
16
+ allowIPAddressList: appEnv.SSRF_ALLOW_IP_ADDRESS_LIST?.split(',') || [],
17
+ allowMetaIPAddress: appEnv.SSRF_ALLOW_PRIVATE_IP_ADDRESS,
18
+ allowPrivateIPAddress: appEnv.SSRF_ALLOW_PRIVATE_IP_ADDRESS,
19
+ denyIPAddressList: [],
20
+ };
21
+ const res = await fetch(url, { agent: ssrfAgent(url, options) });
13
22
 
14
23
  return new Response(await res.arrayBuffer(), { headers: { ...res.headers } });
15
24
  } catch (err) {
package/src/config/app.ts CHANGED
@@ -46,6 +46,9 @@ export const getAppConfig = () => {
46
46
  CDN_USE_GLOBAL: z.boolean().optional(),
47
47
  CUSTOM_FONT_FAMILY: z.string().optional(),
48
48
  CUSTOM_FONT_URL: z.string().optional(),
49
+
50
+ SSRF_ALLOW_PRIVATE_IP_ADDRESS: z.boolean().optional(),
51
+ SSRF_ALLOW_IP_ADDRESS_LIST: z.string().optional(),
49
52
  },
50
53
  runtimeEnv: {
51
54
  NEXT_PUBLIC_BASE_PATH: process.env.NEXT_PUBLIC_BASE_PATH || '',
@@ -72,6 +75,9 @@ export const getAppConfig = () => {
72
75
  CUSTOM_FONT_FAMILY: process.env.CUSTOM_FONT_FAMILY,
73
76
  CUSTOM_FONT_URL: process.env.CUSTOM_FONT_URL,
74
77
  CDN_USE_GLOBAL: process.env.CDN_USE_GLOBAL === '1',
78
+
79
+ SSRF_ALLOW_PRIVATE_IP_ADDRESS: process.env.SSRF_ALLOW_PRIVATE_IP_ADDRESS === '1',
80
+ SSRF_ALLOW_IP_ADDRESS_LIST: process.env.SSRF_ALLOW_IP_ADDRESS_LIST,
75
81
  },
76
82
  });
77
83
  };
@@ -35,9 +35,9 @@ export class TopicModel {
35
35
  .select({
36
36
  createdAt: topics.createdAt,
37
37
  favorite: topics.favorite,
38
+ historySummary: topics.historySummary,
38
39
  id: topics.id,
39
40
  metadata: topics.metadata,
40
- summary: topics.historySummary,
41
41
  title: topics.title,
42
42
  updatedAt: topics.updatedAt,
43
43
  })
@@ -49,20 +49,6 @@ export class TopicModel {
49
49
  .limit(pageSize)
50
50
  .offset(offset)
51
51
  );
52
-
53
- // return result.map(({ summary, metadata, ...item }) => {
54
- // const meta = metadata as ChatTopicMetadata;
55
- // return {
56
- // ...item,
57
- // summary: !!summary
58
- // ? ({
59
- // content: summary,
60
- // model: meta?.model,
61
- // provider: meta?.provider,
62
- // } as ChatTopicSummary)
63
- // : undefined,
64
- // };
65
- // });
66
52
  }
67
53
 
68
54
  async findById(id: string) {
@@ -17,6 +17,7 @@ const ReactRenderer = memo<ReactRendererProps>(({ code }) => {
17
17
  <SandpackProvider
18
18
  customSetup={{
19
19
  dependencies: {
20
+ '@ant-design/icons': 'latest',
20
21
  '@lshay/ui': 'latest',
21
22
  '@radix-ui/react-alert-dialog': 'latest',
22
23
  '@radix-ui/react-dialog': 'latest',
@@ -120,6 +120,7 @@ export const topicRouter = router({
120
120
  id: z.string(),
121
121
  value: z.object({
122
122
  favorite: z.boolean().optional(),
123
+ historySummary: z.string().optional(),
123
124
  messages: z.array(z.string()).optional(),
124
125
  metadata: z
125
126
  .object({
@@ -128,7 +129,6 @@ export const topicRouter = router({
128
129
  })
129
130
  .optional(),
130
131
  sessionId: z.string().optional(),
131
- summary: z.string().optional(),
132
132
  title: z.string().optional(),
133
133
  }),
134
134
  }),
@@ -43,8 +43,8 @@ export const chatMemory: StateCreator<
43
43
  });
44
44
 
45
45
  await topicService.updateTopic(topicId, {
46
+ historySummary,
46
47
  metadata: { model, provider },
47
- summary: historySummary,
48
48
  });
49
49
  await get().refreshTopic();
50
50
  await get().refreshMessages();
@@ -33,7 +33,7 @@ const currentActiveTopicSummary = (s: ChatStoreState): ChatTopicSummary | undefi
33
33
  if (!activeTopic) return undefined;
34
34
 
35
35
  return {
36
- content: activeTopic.summary || '',
36
+ content: activeTopic.historySummary || '',
37
37
  model: activeTopic.metadata?.model || '',
38
38
  provider: activeTopic.metadata?.provider || '',
39
39
  };
@@ -37,9 +37,9 @@ export interface ChatTopicSummary {
37
37
 
38
38
  export interface ChatTopic extends Omit<BaseDataModel, 'meta'> {
39
39
  favorite?: boolean;
40
+ historySummary?: string;
40
41
  metadata?: ChatTopicMetadata;
41
42
  sessionId?: string;
42
- summary?: string;
43
43
  title: string;
44
44
  }
45
45