@lobehub/chat 1.31.5 → 1.31.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 +25 -0
- package/locales/ar/models.json +39 -7
- package/locales/ar/providers.json +4 -0
- package/locales/bg-BG/models.json +38 -6
- package/locales/bg-BG/providers.json +4 -0
- package/locales/de-DE/models.json +39 -7
- package/locales/de-DE/providers.json +4 -0
- package/locales/en-US/models.json +38 -6
- package/locales/en-US/providers.json +4 -0
- package/locales/es-ES/models.json +38 -6
- package/locales/es-ES/providers.json +4 -0
- package/locales/fa-IR/modelProvider.json +12 -0
- package/locales/fa-IR/models.json +39 -7
- package/locales/fa-IR/providers.json +4 -0
- package/locales/fr-FR/models.json +38 -6
- package/locales/fr-FR/providers.json +4 -0
- package/locales/it-IT/models.json +38 -6
- package/locales/it-IT/providers.json +4 -0
- package/locales/ja-JP/models.json +39 -7
- package/locales/ja-JP/providers.json +4 -0
- package/locales/ko-KR/models.json +38 -6
- package/locales/ko-KR/providers.json +4 -0
- package/locales/nl-NL/models.json +38 -6
- package/locales/nl-NL/providers.json +4 -0
- package/locales/pl-PL/models.json +37 -5
- package/locales/pl-PL/providers.json +4 -0
- package/locales/pt-BR/models.json +38 -6
- package/locales/pt-BR/providers.json +4 -0
- package/locales/ru-RU/models.json +38 -6
- package/locales/ru-RU/providers.json +4 -0
- package/locales/tr-TR/models.json +39 -7
- package/locales/tr-TR/providers.json +4 -0
- package/locales/vi-VN/models.json +37 -5
- package/locales/vi-VN/providers.json +4 -0
- package/locales/zh-CN/modelProvider.json +1 -1
- package/locales/zh-CN/models.json +37 -5
- package/locales/zh-CN/providers.json +4 -0
- package/locales/zh-TW/models.json +38 -6
- package/locales/zh-TW/providers.json +4 -0
- package/package.json +1 -1
- package/src/app/(main)/chat/(workspace)/@conversation/default.tsx +2 -2
- package/src/app/(main)/chat/(workspace)/@conversation/features/ChatInput/Desktop/Header/index.tsx +6 -1
- package/src/app/(main)/chat/(workspace)/@conversation/features/ChatInput/Desktop/index.tsx +63 -43
- package/src/app/(main)/chat/(workspace)/@conversation/features/ChatInput/Mobile/index.tsx +19 -1
- package/src/app/(main)/chat/(workspace)/@conversation/features/ChatList/Content.tsx +35 -0
- package/src/app/(main)/chat/(workspace)/@conversation/features/ChatList/index.tsx +28 -0
- package/src/config/modelProviders/cloudflare.ts +1 -0
- package/src/features/ChatInput/ActionBar/config.ts +1 -20
- package/src/features/ChatInput/ActionBar/index.tsx +25 -28
- package/src/features/ChatInput/types.ts +1 -0
- package/src/features/Conversation/components/ChatItem/index.tsx +1 -1
- package/src/features/Conversation/components/VirtualizedList/index.tsx +13 -28
- package/src/features/Conversation/index.ts +2 -0
- package/src/features/Conversation/index.tsx +0 -30
@@ -2,7 +2,6 @@
|
|
2
2
|
|
3
3
|
import { Icon } from '@lobehub/ui';
|
4
4
|
import { useTheme } from 'antd-style';
|
5
|
-
import isEqual from 'fast-deep-equal';
|
6
5
|
import { Loader2Icon } from 'lucide-react';
|
7
6
|
import React, { memo, useCallback, useEffect, useRef, useState } from 'react';
|
8
7
|
import { Center, Flexbox } from 'react-layout-kit';
|
@@ -12,7 +11,6 @@ import { WELCOME_GUIDE_CHAT_ID } from '@/const/session';
|
|
12
11
|
import { isServerMode } from '@/const/version';
|
13
12
|
import { useChatStore } from '@/store/chat';
|
14
13
|
import { chatSelectors } from '@/store/chat/selectors';
|
15
|
-
import { useSessionStore } from '@/store/session';
|
16
14
|
|
17
15
|
import AutoScroll from '../AutoScroll';
|
18
16
|
import Item from '../ChatItem';
|
@@ -20,33 +18,20 @@ import InboxWelcome from '../InboxWelcome';
|
|
20
18
|
import SkeletonList from '../SkeletonList';
|
21
19
|
|
22
20
|
interface VirtualizedListProps {
|
21
|
+
dataSource: string[];
|
23
22
|
mobile?: boolean;
|
24
23
|
}
|
25
|
-
|
24
|
+
|
25
|
+
const VirtualizedList = memo<VirtualizedListProps>(({ mobile, dataSource }) => {
|
26
26
|
const virtuosoRef = useRef<VirtuosoHandle>(null);
|
27
27
|
const [atBottom, setAtBottom] = useState(true);
|
28
28
|
const [isScrolling, setIsScrolling] = useState(false);
|
29
29
|
|
30
30
|
const [id] = useChatStore((s) => [chatSelectors.currentChatKey(s)]);
|
31
|
-
|
32
|
-
|
33
|
-
(s)
|
34
|
-
|
35
|
-
s.useFetchMessages,
|
36
|
-
chatSelectors.currentChatLoadingState(s),
|
37
|
-
chatSelectors.isCurrentChatLoaded(s),
|
38
|
-
],
|
39
|
-
);
|
40
|
-
|
41
|
-
const [sessionId] = useSessionStore((s) => [s.activeId]);
|
42
|
-
useFetchMessages(sessionId, activeTopicId);
|
43
|
-
|
44
|
-
const data = useChatStore((s) => {
|
45
|
-
const showInboxWelcome = chatSelectors.showInboxWelcome(s);
|
46
|
-
return showInboxWelcome
|
47
|
-
? [WELCOME_GUIDE_CHAT_ID]
|
48
|
-
: chatSelectors.currentChatIDsWithGuideMessage(s);
|
49
|
-
}, isEqual);
|
31
|
+
const [isFirstLoading, isCurrentChatLoaded] = useChatStore((s) => [
|
32
|
+
chatSelectors.currentChatLoadingState(s),
|
33
|
+
chatSelectors.isCurrentChatLoaded(s),
|
34
|
+
]);
|
50
35
|
|
51
36
|
useEffect(() => {
|
52
37
|
if (virtuosoRef.current) {
|
@@ -54,13 +39,13 @@ const VirtualizedList = memo<VirtualizedListProps>(({ mobile }) => {
|
|
54
39
|
}
|
55
40
|
}, [id]);
|
56
41
|
|
57
|
-
const prevDataLengthRef = useRef(
|
42
|
+
const prevDataLengthRef = useRef(dataSource.length);
|
58
43
|
|
59
44
|
const getFollowOutput = useCallback(() => {
|
60
|
-
const newFollowOutput =
|
61
|
-
prevDataLengthRef.current =
|
45
|
+
const newFollowOutput = dataSource.length > prevDataLengthRef.current ? 'auto' : false;
|
46
|
+
prevDataLengthRef.current = dataSource.length;
|
62
47
|
return newFollowOutput;
|
63
|
-
}, [
|
48
|
+
}, [dataSource.length]);
|
64
49
|
|
65
50
|
const theme = useTheme();
|
66
51
|
// overscan should be 3 times the height of the window
|
@@ -100,10 +85,10 @@ const VirtualizedList = memo<VirtualizedListProps>(({ mobile }) => {
|
|
100
85
|
atBottomStateChange={setAtBottom}
|
101
86
|
atBottomThreshold={50 * (mobile ? 2 : 1)}
|
102
87
|
computeItemKey={(_, item) => item}
|
103
|
-
data={
|
88
|
+
data={dataSource}
|
104
89
|
followOutput={getFollowOutput}
|
105
90
|
increaseViewportBy={overscan}
|
106
|
-
initialTopMostItemIndex={
|
91
|
+
initialTopMostItemIndex={dataSource?.length - 1}
|
107
92
|
isScrolling={setIsScrolling}
|
108
93
|
itemContent={itemContent}
|
109
94
|
overscan={overscan}
|
@@ -1,30 +0,0 @@
|
|
1
|
-
import { Suspense, lazy } from 'react';
|
2
|
-
import { Flexbox } from 'react-layout-kit';
|
3
|
-
|
4
|
-
import SkeletonList from './components/SkeletonList';
|
5
|
-
|
6
|
-
const ChatList = lazy(() => import('./components/VirtualizedList'));
|
7
|
-
|
8
|
-
interface ConversationProps {
|
9
|
-
mobile?: boolean;
|
10
|
-
}
|
11
|
-
|
12
|
-
const Conversation = ({ mobile }: ConversationProps) => {
|
13
|
-
return (
|
14
|
-
<Flexbox
|
15
|
-
flex={1}
|
16
|
-
style={{
|
17
|
-
overflowX: 'hidden',
|
18
|
-
overflowY: 'auto',
|
19
|
-
position: 'relative',
|
20
|
-
}}
|
21
|
-
width={'100%'}
|
22
|
-
>
|
23
|
-
<Suspense fallback={<SkeletonList mobile={mobile} />}>
|
24
|
-
<ChatList mobile={mobile} />
|
25
|
-
</Suspense>
|
26
|
-
</Flexbox>
|
27
|
-
);
|
28
|
-
};
|
29
|
-
|
30
|
-
export default Conversation;
|