@lobehub/chat 0.107.11 → 0.107.13

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.
Files changed (41) hide show
  1. package/.github/FUNDING.yml +13 -0
  2. package/CHANGELOG.md +79 -0
  3. package/README.md +33 -3
  4. package/README.zh-CN.md +33 -3
  5. package/package.json +1 -2
  6. package/src/app/chat/(desktop)/features/ChatInput/DragUpload.tsx +1 -1
  7. package/src/app/chat/(desktop)/features/ChatInput/Footer/LocalFiles.tsx +3 -3
  8. package/src/app/chat/(mobile)/features/ChatInput/Files.tsx +7 -6
  9. package/src/app/chat/(mobile)/features/ChatInput/Mobile.tsx +2 -0
  10. package/src/app/chat/(mobile)/features/ChatInput/index.tsx +0 -2
  11. package/src/app/chat/features/ChatHeader/ShareButton/Preview.tsx +1 -1
  12. package/src/app/chat/features/ChatInput/ActionBar/Clear.tsx +1 -1
  13. package/src/app/chat/features/ChatInput/ActionBar/FileUpload.tsx +1 -1
  14. package/src/app/chat/features/ChatInput/useSend.ts +2 -2
  15. package/src/app/chat/features/Conversation/ChatList/Messages/User.tsx +2 -2
  16. package/src/app/settings/common/Common.tsx +1 -1
  17. package/src/components/FileList/EditableFileList.tsx +35 -0
  18. package/src/components/FileList/FileGrid.tsx +36 -0
  19. package/src/components/FileList/FileItem.tsx +73 -0
  20. package/src/components/FileList/index.tsx +62 -0
  21. package/src/components/FileList/style.ts +24 -0
  22. package/src/features/AgentSetting/AgentPlugin/MarketList.tsx +1 -1
  23. package/src/layout/AppLayout.desktop.tsx +1 -0
  24. package/src/layout/GlobalLayout/Locale.tsx +1 -0
  25. package/src/services/chat.ts +1 -1
  26. package/src/store/chat/actions/message.test.ts +481 -0
  27. package/src/store/chat/actions/message.ts +4 -1
  28. package/src/store/chat/actions/topic.ts +1 -0
  29. package/src/app/chat/components/FileList/FileItem.style.ts +0 -84
  30. package/src/app/chat/components/FileList/FileItem.tsx +0 -73
  31. package/src/app/chat/components/FileList/Lightbox.tsx +0 -46
  32. package/src/app/chat/components/FileList/index.tsx +0 -60
  33. /package/src/store/{files → file}/index.ts +0 -0
  34. /package/src/store/{files → file}/initialState.ts +0 -0
  35. /package/src/store/{files → file}/selectors.test.ts +0 -0
  36. /package/src/store/{files → file}/selectors.ts +0 -0
  37. /package/src/store/{files → file}/slices/images/action.test.ts +0 -0
  38. /package/src/store/{files → file}/slices/images/action.ts +0 -0
  39. /package/src/store/{files → file}/slices/images/index.ts +0 -0
  40. /package/src/store/{files → file}/slices/images/initialState.ts +0 -0
  41. /package/src/store/{files → file}/store.ts +0 -0
@@ -1,46 +0,0 @@
1
- import { createStyles } from 'antd-style';
2
- import { memo } from 'react';
3
- import Lightbox from 'react-spring-lightbox';
4
-
5
- import { filesSelectors, useFileStore } from '@/store/files';
6
-
7
- const useStyles = createStyles(({ css, token }) => ({
8
- wrapper: css`
9
- background: ${token.colorBgMask};
10
- backdrop-filter: blur(4px);
11
- `,
12
- }));
13
-
14
- interface LightBoxProps {
15
- index: number;
16
- items: string[];
17
- onNext: () => void;
18
- onOpenChange: (open: boolean) => void;
19
- onPrev: () => void;
20
- open: boolean;
21
- }
22
-
23
- const LightBox = memo<LightBoxProps>(({ onOpenChange, open, items, index, onNext, onPrev }) => {
24
- const { styles } = useStyles();
25
-
26
- const list = useFileStore(filesSelectors.getImageDetailByList(items));
27
- return (
28
- <Lightbox
29
- className={styles.wrapper}
30
- currentIndex={index}
31
- images={list.map((i) => ({
32
- alt: i.name,
33
- loading: 'lazy',
34
- src: i.url,
35
- }))}
36
- isOpen={open}
37
- onClose={() => {
38
- onOpenChange(false);
39
- }}
40
- onNext={onNext}
41
- onPrev={onPrev}
42
- />
43
- );
44
- });
45
-
46
- export default LightBox;
@@ -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;
File without changes
File without changes
File without changes
File without changes
File without changes