@lobehub/chat 0.118.0 → 0.118.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 +25 -0
- package/package.json +1 -1
- package/src/tools/dalle/Render/index.tsx +7 -9
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog
|
|
4
4
|
|
|
5
|
+
### [Version 0.118.1](https://github.com/lobehub/lobe-chat/compare/v0.118.0...v0.118.1)
|
|
6
|
+
|
|
7
|
+
<sup>Released on **2023-12-30**</sup>
|
|
8
|
+
|
|
9
|
+
#### 🐛 Bug Fixes
|
|
10
|
+
|
|
11
|
+
- **misc**: Fix dalle image download error.
|
|
12
|
+
|
|
13
|
+
<br/>
|
|
14
|
+
|
|
15
|
+
<details>
|
|
16
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
17
|
+
|
|
18
|
+
#### What's fixed
|
|
19
|
+
|
|
20
|
+
- **misc**: Fix dalle image download error, closes [#868](https://github.com/lobehub/lobe-chat/issues/868) ([5b6d11f](https://github.com/lobehub/lobe-chat/commit/5b6d11f))
|
|
21
|
+
|
|
22
|
+
</details>
|
|
23
|
+
|
|
24
|
+
<div align="right">
|
|
25
|
+
|
|
26
|
+
[](#readme-top)
|
|
27
|
+
|
|
28
|
+
</div>
|
|
29
|
+
|
|
5
30
|
## [Version 0.118.0](https://github.com/lobehub/lobe-chat/compare/v0.117.5...v0.118.0)
|
|
6
31
|
|
|
7
32
|
<sup>Released on **2023-12-29**</sup>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/chat",
|
|
3
|
-
"version": "0.118.
|
|
3
|
+
"version": "0.118.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",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ActionIcon, ImageGallery } from '@lobehub/ui';
|
|
2
2
|
import { Download } from 'lucide-react';
|
|
3
|
-
import { memo,
|
|
3
|
+
import { memo, useRef } from 'react';
|
|
4
4
|
import { Flexbox } from 'react-layout-kit';
|
|
5
5
|
|
|
6
6
|
import GalleyGrid from '@/components/GalleyGrid';
|
|
@@ -11,17 +11,17 @@ import { DallEImageItem } from '@/types/tool/dalle';
|
|
|
11
11
|
import ImageItem from './Item';
|
|
12
12
|
|
|
13
13
|
const DallE = memo<BuiltinRenderProps<DallEImageItem[]>>(({ content, messageId }) => {
|
|
14
|
-
const
|
|
14
|
+
const currentRef = useRef(0);
|
|
15
15
|
|
|
16
16
|
const handleDownload = async () => {
|
|
17
17
|
// 1. Retrieve the blob URL of an image by its imageId
|
|
18
|
-
const id = content[current]?.imageId;
|
|
18
|
+
const id = content[currentRef.current]?.imageId;
|
|
19
19
|
if (!id) return;
|
|
20
|
-
const { url } = await fileService.getFile(id);
|
|
20
|
+
const { url, name } = await fileService.getFile(id);
|
|
21
21
|
// 2. Download the image
|
|
22
22
|
const link = document.createElement('a');
|
|
23
23
|
link.href = url;
|
|
24
|
-
link.download =
|
|
24
|
+
link.download = name; // 设置下载的文件名
|
|
25
25
|
link.click();
|
|
26
26
|
};
|
|
27
27
|
|
|
@@ -33,13 +33,11 @@ const DallE = memo<BuiltinRenderProps<DallEImageItem[]>>(({ content, messageId }
|
|
|
33
33
|
preview={{
|
|
34
34
|
// 切换图片时设置
|
|
35
35
|
onChange: (current: number) => {
|
|
36
|
-
|
|
36
|
+
currentRef.current = current;
|
|
37
37
|
},
|
|
38
38
|
// 点击预览显示时设置
|
|
39
39
|
onVisibleChange: (visible: boolean, _prevVisible: boolean, current: number) => {
|
|
40
|
-
|
|
41
|
-
setCurrent(current);
|
|
42
|
-
}
|
|
40
|
+
currentRef.current = current;
|
|
43
41
|
},
|
|
44
42
|
toolbarAddon: <ActionIcon color={'#fff'} icon={Download} onClick={handleDownload} />,
|
|
45
43
|
}}
|