@lobehub/chat 0.107.12 → 0.107.14
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 +79 -0
- package/README.md +35 -5
- package/README.zh-CN.md +35 -5
- package/package.json +1 -2
- package/src/app/chat/(desktop)/features/ChatInput/Footer/LocalFiles.tsx +2 -2
- package/src/app/chat/(mobile)/features/ChatInput/Files.tsx +6 -5
- package/src/app/chat/(mobile)/features/ChatInput/Mobile.tsx +2 -0
- package/src/app/chat/(mobile)/features/ChatInput/index.tsx +0 -2
- package/src/app/chat/features/ChatHeader/ShareButton/Preview.tsx +1 -1
- package/src/app/chat/features/ChatInput/ActionBar/Clear.tsx +1 -0
- package/src/app/chat/features/Conversation/ChatList/Messages/User.tsx +2 -2
- package/src/app/chat/features/Conversation/ChatList/index.tsx +1 -0
- package/src/components/FileList/EditableFileList.tsx +35 -0
- package/src/components/FileList/FileGrid.tsx +36 -0
- package/src/components/FileList/FileItem.tsx +73 -0
- package/src/components/FileList/index.tsx +62 -0
- package/src/components/FileList/style.ts +24 -0
- package/src/features/AgentSetting/AgentPlugin/MarketList.tsx +1 -1
- package/src/layout/AppLayout.desktop.tsx +1 -0
- package/src/layout/GlobalLayout/Locale.tsx +1 -0
- package/src/store/chat/actions/message.test.ts +481 -0
- package/src/store/chat/actions/message.ts +4 -1
- package/src/app/chat/components/FileList/FileItem.style.ts +0 -84
- package/src/app/chat/components/FileList/FileItem.tsx +0 -73
- package/src/app/chat/components/FileList/Lightbox.tsx +0 -46
- package/src/app/chat/components/FileList/index.tsx +0 -60
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { memo, useState } from 'react';
|
|
2
|
-
import { Flexbox } from 'react-layout-kit';
|
|
3
|
-
|
|
4
|
-
import FileItem from './FileItem';
|
|
5
|
-
import Lightbox from './Lightbox';
|
|
6
|
-
|
|
7
|
-
// TODO:后续看情况是否做图片过多的滚动功能
|
|
8
|
-
// const useStyles = createStyles(({ css }) => ({
|
|
9
|
-
// container: css`
|
|
10
|
-
// width: ${IMAGE_SIZE * 5 + 4 * 8 + IMAGE_SIZE / 2}px;
|
|
11
|
-
// overflow-x: scroll;
|
|
12
|
-
// height: ${IMAGE_SIZE + 12}px;
|
|
13
|
-
// `,
|
|
14
|
-
// }));
|
|
15
|
-
|
|
16
|
-
interface FileListProps {
|
|
17
|
-
alwaysShowClose?: boolean;
|
|
18
|
-
editable?: boolean;
|
|
19
|
-
items: string[];
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const FileList = memo<FileListProps>(({ items, editable = true, alwaysShowClose }) => {
|
|
23
|
-
// const { styles } = useStyles();
|
|
24
|
-
|
|
25
|
-
const [showLightbox, setShowLightbox] = useState(false);
|
|
26
|
-
const [currentImageIndex, setCurrentIndex] = useState(0);
|
|
27
|
-
|
|
28
|
-
const gotoPrevious = () => currentImageIndex > 0 && setCurrentIndex(currentImageIndex - 1);
|
|
29
|
-
const gotoNext = () =>
|
|
30
|
-
currentImageIndex + 1 < items.length && setCurrentIndex(currentImageIndex + 1);
|
|
31
|
-
|
|
32
|
-
return (
|
|
33
|
-
<>
|
|
34
|
-
<Flexbox align={'flex-end'} gap={8} horizontal>
|
|
35
|
-
{items.map((i, index) => (
|
|
36
|
-
<FileItem
|
|
37
|
-
alwaysShowClose={alwaysShowClose}
|
|
38
|
-
editable={editable}
|
|
39
|
-
id={i}
|
|
40
|
-
key={i}
|
|
41
|
-
onClick={() => {
|
|
42
|
-
setCurrentIndex(index);
|
|
43
|
-
setShowLightbox(true);
|
|
44
|
-
}}
|
|
45
|
-
/>
|
|
46
|
-
))}
|
|
47
|
-
</Flexbox>
|
|
48
|
-
<Lightbox
|
|
49
|
-
index={currentImageIndex}
|
|
50
|
-
items={items}
|
|
51
|
-
onNext={gotoNext}
|
|
52
|
-
onOpenChange={setShowLightbox}
|
|
53
|
-
onPrev={gotoPrevious}
|
|
54
|
-
open={showLightbox}
|
|
55
|
-
/>
|
|
56
|
-
</>
|
|
57
|
-
);
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
export default FileList;
|