@lobehub/chat 0.115.4 โ 0.115.6
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 0.115.6](https://github.com/lobehub/lobe-chat/compare/v0.115.5...v0.115.6)
|
|
6
|
+
|
|
7
|
+
<sup>Released on **2023-12-23**</sup>
|
|
8
|
+
|
|
9
|
+
#### ๐ Bug Fixes
|
|
10
|
+
|
|
11
|
+
- **misc**: Fix maxTokens params still work when disable enableMaxTokens.
|
|
12
|
+
|
|
13
|
+
<br/>
|
|
14
|
+
|
|
15
|
+
<details>
|
|
16
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
17
|
+
|
|
18
|
+
#### What's fixed
|
|
19
|
+
|
|
20
|
+
- **misc**: Fix maxTokens params still work when disable enableMaxTokens, closes [#779](https://github.com/lobehub/lobe-chat/issues/779) ([20956ea](https://github.com/lobehub/lobe-chat/commit/20956ea))
|
|
21
|
+
|
|
22
|
+
</details>
|
|
23
|
+
|
|
24
|
+
<div align="right">
|
|
25
|
+
|
|
26
|
+
[](#readme-top)
|
|
27
|
+
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
### [Version 0.115.5](https://github.com/lobehub/lobe-chat/compare/v0.115.4...v0.115.5)
|
|
31
|
+
|
|
32
|
+
<sup>Released on **2023-12-23**</sup>
|
|
33
|
+
|
|
34
|
+
#### ๐ Bug Fixes
|
|
35
|
+
|
|
36
|
+
- **misc**: Fix image display error.
|
|
37
|
+
|
|
38
|
+
<br/>
|
|
39
|
+
|
|
40
|
+
<details>
|
|
41
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
42
|
+
|
|
43
|
+
#### What's fixed
|
|
44
|
+
|
|
45
|
+
- **misc**: Fix image display error, closes [#777](https://github.com/lobehub/lobe-chat/issues/777) ([08659d6](https://github.com/lobehub/lobe-chat/commit/08659d6))
|
|
46
|
+
|
|
47
|
+
</details>
|
|
48
|
+
|
|
49
|
+
<div align="right">
|
|
50
|
+
|
|
51
|
+
[](#readme-top)
|
|
52
|
+
|
|
53
|
+
</div>
|
|
54
|
+
|
|
5
55
|
### [Version 0.115.4](https://github.com/lobehub/lobe-chat/compare/v0.115.3...v0.115.4)
|
|
6
56
|
|
|
7
57
|
<sup>Released on **2023-12-23**</sup>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/chat",
|
|
3
|
-
"version": "0.115.
|
|
3
|
+
"version": "0.115.6",
|
|
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,5 +1,5 @@
|
|
|
1
1
|
import { ImageGallery } from '@lobehub/ui';
|
|
2
|
-
import { memo } from 'react';
|
|
2
|
+
import { memo, useMemo } from 'react';
|
|
3
3
|
|
|
4
4
|
import GalleyGrid from '@/components/GalleyGrid';
|
|
5
5
|
|
|
@@ -10,9 +10,11 @@ interface FileListProps {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
const FileList = memo<FileListProps>(({ items }) => {
|
|
13
|
+
const data = useMemo(() => items.map((id) => ({ id })), [items]);
|
|
14
|
+
|
|
13
15
|
return (
|
|
14
16
|
<ImageGallery>
|
|
15
|
-
<GalleyGrid items={
|
|
17
|
+
<GalleyGrid items={data} renderItem={ImageFileItem} />
|
|
16
18
|
</ImageGallery>
|
|
17
19
|
);
|
|
18
20
|
});
|
|
@@ -63,54 +63,45 @@ afterEach(() => {
|
|
|
63
63
|
});
|
|
64
64
|
|
|
65
65
|
describe('chatMessage actions', () => {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
await act(async () => {
|
|
72
|
-
await result.current.clearMessage();
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
expect(clearSpy).toHaveBeenCalled();
|
|
76
|
-
expect(result.current.refreshMessages).toHaveBeenCalled();
|
|
77
|
-
expect(result.current.refreshTopic).toHaveBeenCalled();
|
|
78
|
-
expect(switchTopicSpy).toHaveBeenCalled();
|
|
79
|
-
});
|
|
66
|
+
describe('deleteMessage', () => {
|
|
67
|
+
it('deleteMessage should remove a message by id', async () => {
|
|
68
|
+
const { result } = renderHook(() => useChatStore());
|
|
69
|
+
const messageId = 'message-id';
|
|
70
|
+
const deleteSpy = vi.spyOn(result.current, 'deleteMessage');
|
|
80
71
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
const deleteSpy = vi.spyOn(result.current, 'deleteMessage');
|
|
72
|
+
await act(async () => {
|
|
73
|
+
await result.current.deleteMessage(messageId);
|
|
74
|
+
});
|
|
85
75
|
|
|
86
|
-
|
|
87
|
-
|
|
76
|
+
expect(deleteSpy).toHaveBeenCalledWith(messageId);
|
|
77
|
+
expect(result.current.refreshMessages).toHaveBeenCalled();
|
|
88
78
|
});
|
|
89
|
-
|
|
90
|
-
expect(deleteSpy).toHaveBeenCalledWith(messageId);
|
|
91
|
-
expect(result.current.refreshMessages).toHaveBeenCalled();
|
|
92
79
|
});
|
|
93
80
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
81
|
+
describe('clearAllMessages', () => {
|
|
82
|
+
it('clearAllMessages should remove all messages', async () => {
|
|
83
|
+
const { result } = renderHook(() => useChatStore());
|
|
84
|
+
const clearAllSpy = vi.spyOn(result.current, 'clearAllMessages');
|
|
97
85
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
86
|
+
await act(async () => {
|
|
87
|
+
await result.current.clearAllMessages();
|
|
88
|
+
});
|
|
101
89
|
|
|
102
|
-
|
|
103
|
-
|
|
90
|
+
expect(clearAllSpy).toHaveBeenCalled();
|
|
91
|
+
expect(result.current.refreshMessages).toHaveBeenCalled();
|
|
92
|
+
});
|
|
104
93
|
});
|
|
105
94
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
95
|
+
describe('updateInputMessage', () => {
|
|
96
|
+
it('updateInputMessage should update the input message state', () => {
|
|
97
|
+
const { result } = renderHook(() => useChatStore());
|
|
98
|
+
const newInputMessage = 'Updated message';
|
|
99
|
+
act(() => {
|
|
100
|
+
result.current.updateInputMessage(newInputMessage);
|
|
101
|
+
});
|
|
112
102
|
|
|
113
|
-
|
|
103
|
+
expect(result.current.inputMessage).toEqual(newInputMessage);
|
|
104
|
+
});
|
|
114
105
|
});
|
|
115
106
|
|
|
116
107
|
describe('clearMessage', () => {
|
|
@@ -122,6 +113,20 @@ describe('chatMessage actions', () => {
|
|
|
122
113
|
afterEach(() => {
|
|
123
114
|
vi.restoreAllMocks(); // ๆขๅคๆๆๆจกๆ
|
|
124
115
|
});
|
|
116
|
+
it('clearMessage should remove messages from the active session and topic', async () => {
|
|
117
|
+
const { result } = renderHook(() => useChatStore());
|
|
118
|
+
const clearSpy = vi.spyOn(result.current, 'clearMessage');
|
|
119
|
+
const switchTopicSpy = vi.spyOn(result.current, 'switchTopic');
|
|
120
|
+
|
|
121
|
+
await act(async () => {
|
|
122
|
+
await result.current.clearMessage();
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
expect(clearSpy).toHaveBeenCalled();
|
|
126
|
+
expect(result.current.refreshMessages).toHaveBeenCalled();
|
|
127
|
+
expect(result.current.refreshTopic).toHaveBeenCalled();
|
|
128
|
+
expect(switchTopicSpy).toHaveBeenCalled();
|
|
129
|
+
});
|
|
125
130
|
|
|
126
131
|
it('should remove messages from the active session and topic, then refresh topics and messages', async () => {
|
|
127
132
|
const { result } = renderHook(() => useChatStore());
|
|
@@ -335,7 +335,10 @@ export const chatMessage: StateCreator<
|
|
|
335
335
|
preprocessMsgs.unshift({ content: config.systemRole, role: 'system' } as ChatMessage);
|
|
336
336
|
}
|
|
337
337
|
|
|
338
|
-
// 4. handle
|
|
338
|
+
// 4. handle max_tokens
|
|
339
|
+
config.params.max_tokens = config.enableMaxTokens ? config.params.max_tokens : undefined;
|
|
340
|
+
|
|
341
|
+
// 5. handle config for the vision model
|
|
339
342
|
// Due to vision model's default max_tokens is very small
|
|
340
343
|
// we need to set the max_tokens a larger one.
|
|
341
344
|
if (VISION_MODEL_WHITE_LIST.includes(config.model)) {
|