@lobehub/chat 1.47.20 → 1.47.22

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.47.22](https://github.com/lobehub/lobe-chat/compare/v1.47.21...v1.47.22)
6
+
7
+ <sup>Released on **2025-01-24**</sup>
8
+
9
+ #### 🐛 Bug Fixes
10
+
11
+ - **misc**: Fix form input in provider.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### What's fixed
19
+
20
+ - **misc**: Fix form input in provider, closes [#5571](https://github.com/lobehub/lobe-chat/issues/5571) ([07e2396](https://github.com/lobehub/lobe-chat/commit/07e2396))
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.47.21](https://github.com/lobehub/lobe-chat/compare/v1.47.20...v1.47.21)
31
+
32
+ <sup>Released on **2025-01-23**</sup>
33
+
34
+ #### 💄 Styles
35
+
36
+ - **misc**: Add HuggingFace Model: DeepSeek R1.
37
+
38
+ <br/>
39
+
40
+ <details>
41
+ <summary><kbd>Improvements and Fixes</kbd></summary>
42
+
43
+ #### Styles
44
+
45
+ - **misc**: Add HuggingFace Model: DeepSeek R1, closes [#5564](https://github.com/lobehub/lobe-chat/issues/5564) ([66d4edd](https://github.com/lobehub/lobe-chat/commit/66d4edd))
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.47.20](https://github.com/lobehub/lobe-chat/compare/v1.47.19...v1.47.20)
6
56
 
7
57
  <sup>Released on **2025-01-23**</sup>
package/changelog/v1.json CHANGED
@@ -1,4 +1,22 @@
1
1
  [
2
+ {
3
+ "children": {
4
+ "fixes": [
5
+ "Fix form input in provider."
6
+ ]
7
+ },
8
+ "date": "2025-01-24",
9
+ "version": "1.47.22"
10
+ },
11
+ {
12
+ "children": {
13
+ "improvements": [
14
+ "Add HuggingFace Model: DeepSeek R1."
15
+ ]
16
+ },
17
+ "date": "2025-01-23",
18
+ "version": "1.47.21"
19
+ },
2
20
  {
3
21
  "children": {
4
22
  "fixes": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "1.47.20",
3
+ "version": "1.47.22",
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",
@@ -226,7 +226,7 @@
226
226
  "systemjs": "^6.15.1",
227
227
  "ts-md5": "^1.3.1",
228
228
  "ua-parser-js": "^1.0.40",
229
- "unstructured-client": "^0.18.2",
229
+ "unstructured-client": "^0.19.0",
230
230
  "url-join": "^5.0.0",
231
231
  "use-merge-value": "^1.2.0",
232
232
  "utility-types": "^3.11.0",
@@ -253,6 +253,7 @@
253
253
  "@semantic-release/exec": "^6.0.3",
254
254
  "@testing-library/jest-dom": "^6.6.3",
255
255
  "@testing-library/react": "^16.1.0",
256
+ "@testing-library/user-event": "^14.6.1",
256
257
  "@types/chroma-js": "^3.1.0",
257
258
  "@types/crypto-js": "^4.2.2",
258
259
  "@types/debug": "^4.1.12",
@@ -0,0 +1,70 @@
1
+ import { fireEvent, render, screen } from '@testing-library/react';
2
+ import userEvent from '@testing-library/user-event';
3
+ import { beforeEach, describe, expect, test, vi } from 'vitest';
4
+
5
+ import FormInput from './FormInput';
6
+
7
+ describe('FormInput', () => {
8
+ const user = userEvent.setup();
9
+ const onChangeMock = vi.fn();
10
+
11
+ beforeEach(() => {
12
+ onChangeMock.mockClear();
13
+ });
14
+
15
+ test('正确渲染初始值', () => {
16
+ render(<FormInput value="initial value" />);
17
+ const input = screen.getByRole('textbox');
18
+ expect(input).toHaveValue('initial value');
19
+ });
20
+
21
+ test('输入值并在失焦时触发 onChange', async () => {
22
+ render(<FormInput onChange={onChangeMock} />);
23
+ const input = screen.getByRole('textbox');
24
+
25
+ await user.type(input, 'new value');
26
+ expect(input).toHaveValue('new value');
27
+ expect(onChangeMock).not.toHaveBeenCalled();
28
+
29
+ fireEvent.blur(input);
30
+ expect(onChangeMock).toHaveBeenCalledWith('new value');
31
+ });
32
+
33
+ test('按下 Enter 触发 onChange', async () => {
34
+ render(<FormInput onChange={onChangeMock} />);
35
+ const input = screen.getByRole('textbox');
36
+
37
+ await user.type(input, 'test{enter}');
38
+ expect(onChangeMock).toHaveBeenCalledWith('test');
39
+ });
40
+
41
+ test('中文输入时按下 Enter 不触发 onChange', async () => {
42
+ render(<FormInput onChange={onChangeMock} />);
43
+ const input = screen.getByRole('textbox');
44
+
45
+ // 模拟中文输入法开始
46
+ fireEvent.compositionStart(input);
47
+ await user.type(input, 'nihao');
48
+ await user.type(input, '{enter}');
49
+
50
+ // 中文输入法结束前按 Enter 不应触发
51
+ expect(onChangeMock).not.toHaveBeenCalled();
52
+
53
+ // 结束中文输入
54
+ fireEvent.compositionEnd(input);
55
+ await user.type(input, '{enter}');
56
+ expect(onChangeMock).toHaveBeenCalledWith('nihao');
57
+ });
58
+
59
+ test('defaultValue 更新时同步显示新值', async () => {
60
+ const { rerender } = render(<FormInput value="old value" />);
61
+
62
+ // 初始值
63
+ const input = screen.getByRole('textbox');
64
+ expect(input).toHaveValue('old value');
65
+
66
+ // 更新值并重新渲染
67
+ rerender(<FormInput value="new value" />);
68
+ expect(input).toHaveValue('new value');
69
+ });
70
+ });
@@ -1,6 +1,6 @@
1
1
  import { Input } from 'antd';
2
2
  import { InputRef, InputProps as Props } from 'antd/es/input/Input';
3
- import { memo, useRef, useState } from 'react';
3
+ import { memo, useEffect, useRef, useState } from 'react';
4
4
 
5
5
  interface FormInputProps extends Omit<Props, 'onChange'> {
6
6
  onChange?: (value: string) => void;
@@ -12,6 +12,10 @@ const FormInput = memo<FormInputProps>(({ onChange, value: defaultValue, ...prop
12
12
 
13
13
  const [value, setValue] = useState(defaultValue as string);
14
14
 
15
+ useEffect(() => {
16
+ setValue(defaultValue as string);
17
+ }, [defaultValue]);
18
+
15
19
  return (
16
20
  <Input
17
21
  onBlur={() => {
@@ -1,6 +1,6 @@
1
1
  import { Input } from 'antd';
2
2
  import { InputRef, InputProps as Props } from 'antd/es/input/Input';
3
- import { memo, useRef, useState } from 'react';
3
+ import { memo, useEffect, useRef, useState } from 'react';
4
4
 
5
5
  interface FormPasswordProps extends Omit<Props, 'onChange'> {
6
6
  onChange?: (value: string) => void;
@@ -12,6 +12,10 @@ const FormPassword = memo<FormPasswordProps>(({ onChange, value: defaultValue, .
12
12
 
13
13
  const [value, setValue] = useState(defaultValue as string);
14
14
 
15
+ useEffect(() => {
16
+ setValue(defaultValue as string);
17
+ }, [defaultValue]);
18
+
15
19
  return (
16
20
  <Input.Password
17
21
  onBlur={() => {
@@ -5,7 +5,6 @@ const huggingfaceChatModels: AIChatModelCard[] = [
5
5
  contextWindowTokens: 32_768,
6
6
  description: 'Mistral AI的指令调优模型',
7
7
  displayName: 'Mistral 7B Instruct v0.3',
8
- enabled: true,
9
8
  id: 'mistralai/Mistral-7B-Instruct-v0.3',
10
9
  type: 'chat',
11
10
  },
@@ -34,6 +33,7 @@ const huggingfaceChatModels: AIChatModelCard[] = [
34
33
  contextWindowTokens: 32_768,
35
34
  description: 'Qwen QwQ 是由 Qwen 团队开发的实验研究模型,专注于提升AI推理能力。',
36
35
  displayName: 'QwQ 32B Preview',
36
+ enabled: true,
37
37
  id: 'Qwen/QwQ-32B-Preview',
38
38
  type: 'chat',
39
39
  },
@@ -49,6 +49,13 @@ const huggingfaceChatModels: AIChatModelCard[] = [
49
49
  id: 'NousResearch/Hermes-3-Llama-3.1-8B',
50
50
  type: 'chat',
51
51
  },
52
+ {
53
+ contextWindowTokens: 16_384,
54
+ displayName: 'DeepSeek R1',
55
+ enabled: true,
56
+ id: 'deepseek-ai/DeepSeek-R1-Distill-Qwen-32B',
57
+ type: 'chat',
58
+ },
52
59
  ];
53
60
 
54
61
  export const allModels = [...huggingfaceChatModels];
@@ -6,7 +6,6 @@ const HuggingFace: ModelProviderCard = {
6
6
  contextWindowTokens: 32_768,
7
7
  description: 'Mistral AI的指令调优模型',
8
8
  displayName: 'Mistral 7B Instruct v0.3',
9
- enabled: true,
10
9
  id: 'mistralai/Mistral-7B-Instruct-v0.3',
11
10
  },
12
11
  {
@@ -31,6 +30,7 @@ const HuggingFace: ModelProviderCard = {
31
30
  contextWindowTokens: 32_768,
32
31
  description: 'Qwen QwQ 是由 Qwen 团队开发的实验研究模型,专注于提升AI推理能力。',
33
32
  displayName: 'QwQ 32B Preview',
33
+ enabled: true,
34
34
  id: 'Qwen/QwQ-32B-Preview',
35
35
  },
36
36
  {
@@ -43,6 +43,12 @@ const HuggingFace: ModelProviderCard = {
43
43
  displayName: 'Hermes 3 Llama 3.1 8B',
44
44
  id: 'NousResearch/Hermes-3-Llama-3.1-8B',
45
45
  },
46
+ {
47
+ contextWindowTokens: 16_384,
48
+ displayName: 'DeepSeek R1',
49
+ enabled: true,
50
+ id: 'deepseek-ai/DeepSeek-R1-Distill-Qwen-32B',
51
+ },
46
52
  ],
47
53
  checkModel: 'mistralai/Mistral-7B-Instruct-v0.2',
48
54
  description: