@lobehub/chat 1.31.4 → 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 +50 -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/baichuan.ts +30 -2
- package/src/config/modelProviders/cloudflare.ts +1 -0
- package/src/config/modelProviders/deepseek.ts +1 -1
- package/src/config/modelProviders/qwen.ts +19 -19
- package/src/config/modelProviders/siliconcloud.ts +16 -4
- package/src/config/modelProviders/wenxin.ts +13 -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/libs/agent-runtime/ai360/index.test.ts +1 -1
- package/src/libs/agent-runtime/ai360/index.ts +1 -1
- package/src/features/Conversation/index.tsx +0 -30
@@ -118,6 +118,17 @@ const Qwen: ModelProviderCard = {
|
|
118
118
|
},
|
119
119
|
tokens: 131_072,
|
120
120
|
},
|
121
|
+
{
|
122
|
+
description: '通义千问代码模型。',
|
123
|
+
displayName: 'Qwen Coder Plus',
|
124
|
+
id: 'qwen-coder-plus-latest',
|
125
|
+
pricing: {
|
126
|
+
currency: 'CNY',
|
127
|
+
input: 3.5,
|
128
|
+
output: 7,
|
129
|
+
},
|
130
|
+
tokens: 131_072,
|
131
|
+
},
|
121
132
|
{
|
122
133
|
description: '通义千问2.5对外开源的7B规模的模型。',
|
123
134
|
displayName: 'Qwen2.5 7B',
|
@@ -166,17 +177,6 @@ const Qwen: ModelProviderCard = {
|
|
166
177
|
},
|
167
178
|
tokens: 131_072,
|
168
179
|
},
|
169
|
-
{
|
170
|
-
description: 'Qwen-Math 模型具有强大的数学解题能力。',
|
171
|
-
displayName: 'Qwen2.5 Math 1.5B',
|
172
|
-
id: 'qwen2.5-math-1.5b-instruct',
|
173
|
-
pricing: {
|
174
|
-
currency: 'CNY',
|
175
|
-
input: 0,
|
176
|
-
output: 0,
|
177
|
-
},
|
178
|
-
tokens: 4096,
|
179
|
-
},
|
180
180
|
{
|
181
181
|
description: 'Qwen-Math 模型具有强大的数学解题能力。',
|
182
182
|
displayName: 'Qwen2.5 Math 7B',
|
@@ -201,23 +201,23 @@ const Qwen: ModelProviderCard = {
|
|
201
201
|
},
|
202
202
|
{
|
203
203
|
description: '通义千问代码模型开源版。',
|
204
|
-
displayName: 'Qwen2.5 Coder
|
205
|
-
id: 'qwen2.5-coder-
|
204
|
+
displayName: 'Qwen2.5 Coder 7B',
|
205
|
+
id: 'qwen2.5-coder-7b-instruct',
|
206
206
|
pricing: {
|
207
207
|
currency: 'CNY',
|
208
|
-
input:
|
209
|
-
output:
|
208
|
+
input: 1,
|
209
|
+
output: 2,
|
210
210
|
},
|
211
211
|
tokens: 131_072,
|
212
212
|
},
|
213
213
|
{
|
214
214
|
description: '通义千问代码模型开源版。',
|
215
|
-
displayName: 'Qwen2.5 Coder
|
216
|
-
id: 'qwen2.5-coder-
|
215
|
+
displayName: 'Qwen2.5 Coder 32B',
|
216
|
+
id: 'qwen2.5-coder-32b-instruct',
|
217
217
|
pricing: {
|
218
218
|
currency: 'CNY',
|
219
|
-
input:
|
220
|
-
output:
|
219
|
+
input: 3.5,
|
220
|
+
output: 7,
|
221
221
|
},
|
222
222
|
tokens: 131_072,
|
223
223
|
},
|
@@ -3,6 +3,18 @@ import { ModelProviderCard } from '@/types/llm';
|
|
3
3
|
// ref :https://siliconflow.cn/zh-cn/pricing
|
4
4
|
const SiliconCloud: ModelProviderCard = {
|
5
5
|
chatModels: [
|
6
|
+
{
|
7
|
+
description: 'Hunyuan-Large 是业界最大的开源 Transformer 架构 MoE 模型,拥有 3890 亿总参数量和 520 亿激活参数量。',
|
8
|
+
displayName: 'Hunyuan Large',
|
9
|
+
enabled: true,
|
10
|
+
id: 'Tencent/Hunyuan-A52B-Instruct',
|
11
|
+
pricing: {
|
12
|
+
currency: 'CNY',
|
13
|
+
input: 21,
|
14
|
+
output: 21,
|
15
|
+
},
|
16
|
+
tokens: 32_768,
|
17
|
+
},
|
6
18
|
{
|
7
19
|
description: 'DeepSeek V2.5 集合了先前版本的优秀特征,增强了通用和编码能力。',
|
8
20
|
displayName: 'DeepSeek V2.5',
|
@@ -105,12 +117,12 @@ const SiliconCloud: ModelProviderCard = {
|
|
105
117
|
},
|
106
118
|
{
|
107
119
|
description: 'Qwen2.5-Coder 专注于代码编写。',
|
108
|
-
displayName: 'Qwen2.5 Coder
|
109
|
-
id: 'Qwen/Qwen2.5-Coder-
|
120
|
+
displayName: 'Qwen2.5 Coder 32B',
|
121
|
+
id: 'Qwen/Qwen2.5-Coder-32B-Instruct',
|
110
122
|
pricing: {
|
111
123
|
currency: 'CNY',
|
112
|
-
input:
|
113
|
-
output:
|
124
|
+
input: 1.26,
|
125
|
+
output: 1.26,
|
114
126
|
},
|
115
127
|
tokens: 32_768,
|
116
128
|
},
|
@@ -79,6 +79,19 @@ const BaiduWenxin: ModelProviderCard = {
|
|
79
79
|
},
|
80
80
|
tokens: 8192,
|
81
81
|
},
|
82
|
+
{
|
83
|
+
description:
|
84
|
+
'百度自研的旗舰级超大规模⼤语⾔模型,综合效果表现出色,广泛适用于各领域复杂任务场景;支持自动对接百度搜索插件,保障问答信息时效。相较于ERNIE 4.0在性能表现上更优秀',
|
85
|
+
displayName: 'ERNIE 4.0 Turbo 128K',
|
86
|
+
enabled: true,
|
87
|
+
id: 'ERNIE-4.0-Turbo-128K',
|
88
|
+
pricing: {
|
89
|
+
currency: 'CNY',
|
90
|
+
input: 20,
|
91
|
+
output: 60,
|
92
|
+
},
|
93
|
+
tokens: 128_000,
|
94
|
+
},
|
82
95
|
{
|
83
96
|
description:
|
84
97
|
'百度自研的旗舰级超大规模⼤语⾔模型,综合效果表现出色,广泛适用于各领域复杂任务场景;支持自动对接百度搜索插件,保障问答信息时效。相较于ERNIE 4.0在性能表现上更优秀',
|
@@ -20,23 +20,4 @@ export const actionMap = {
|
|
20
20
|
tools: Tools,
|
21
21
|
} as const;
|
22
22
|
|
23
|
-
type
|
24
|
-
|
25
|
-
export type ActionKeys = keyof ActionMap;
|
26
|
-
|
27
|
-
type getActionList = (mobile?: boolean) => ActionKeys[];
|
28
|
-
|
29
|
-
// we can make these action lists configurable in the future
|
30
|
-
export const getLeftActionList: getActionList = (mobile) =>
|
31
|
-
[
|
32
|
-
'model',
|
33
|
-
'fileUpload',
|
34
|
-
'knowledgeBase',
|
35
|
-
'temperature',
|
36
|
-
'history',
|
37
|
-
!mobile && 'stt',
|
38
|
-
'tools',
|
39
|
-
'token',
|
40
|
-
].filter(Boolean) as ActionKeys[];
|
41
|
-
|
42
|
-
export const getRightActionList: getActionList = () => ['clear'].filter(Boolean) as ActionKeys[];
|
23
|
+
export type ActionKeys = keyof typeof actionMap;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { ChatInputActionBar } from '@lobehub/ui';
|
2
|
-
import { ReactNode, memo
|
2
|
+
import { ReactNode, memo } from 'react';
|
3
3
|
|
4
|
-
import { ActionKeys, actionMap
|
4
|
+
import { ActionKeys, actionMap } from './config';
|
5
5
|
|
6
6
|
const RenderActionList = ({ dataSource }: { dataSource: ActionKeys[] }) => (
|
7
7
|
<>
|
@@ -13,10 +13,11 @@ const RenderActionList = ({ dataSource }: { dataSource: ActionKeys[] }) => (
|
|
13
13
|
);
|
14
14
|
|
15
15
|
export interface ActionBarProps {
|
16
|
+
leftActions: ActionKeys[];
|
16
17
|
leftAreaEndRender?: ReactNode;
|
17
18
|
leftAreaStartRender?: ReactNode;
|
18
|
-
mobile?: boolean;
|
19
19
|
padding?: number | string;
|
20
|
+
rightActions: ActionKeys[];
|
20
21
|
rightAreaEndRender?: ReactNode;
|
21
22
|
rightAreaStartRender?: ReactNode;
|
22
23
|
}
|
@@ -24,35 +25,31 @@ export interface ActionBarProps {
|
|
24
25
|
const ActionBar = memo<ActionBarProps>(
|
25
26
|
({
|
26
27
|
padding = '0 16px',
|
27
|
-
mobile,
|
28
28
|
rightAreaStartRender,
|
29
29
|
rightAreaEndRender,
|
30
30
|
leftAreaStartRender,
|
31
31
|
leftAreaEndRender,
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
/>
|
54
|
-
);
|
55
|
-
},
|
32
|
+
leftActions,
|
33
|
+
rightActions,
|
34
|
+
}) => (
|
35
|
+
<ChatInputActionBar
|
36
|
+
leftAddons={
|
37
|
+
<>
|
38
|
+
{leftAreaStartRender}
|
39
|
+
<RenderActionList dataSource={leftActions} />
|
40
|
+
{leftAreaEndRender}
|
41
|
+
</>
|
42
|
+
}
|
43
|
+
padding={padding}
|
44
|
+
rightAddons={
|
45
|
+
<>
|
46
|
+
{rightAreaStartRender}
|
47
|
+
<RenderActionList dataSource={rightActions} />
|
48
|
+
{rightAreaEndRender}
|
49
|
+
</>
|
50
|
+
}
|
51
|
+
/>
|
52
|
+
),
|
56
53
|
);
|
57
54
|
|
58
55
|
export default ActionBar;
|
@@ -0,0 +1 @@
|
|
1
|
+
export type { ActionKeys } from './ActionBar/config';
|
@@ -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}
|
@@ -12,7 +12,7 @@ import * as debugStreamModule from '../utils/debugStream';
|
|
12
12
|
import { LobeAi360AI } from './index';
|
13
13
|
|
14
14
|
const provider = ModelProvider.Ai360;
|
15
|
-
const defaultBaseURL = 'https://
|
15
|
+
const defaultBaseURL = 'https://api.360.cn/v1';
|
16
16
|
|
17
17
|
const bizErrorType = 'ProviderBizError';
|
18
18
|
const invalidErrorType = 'InvalidProviderAPIKey';
|
@@ -2,7 +2,7 @@ import { ModelProvider } from '../types';
|
|
2
2
|
import { LobeOpenAICompatibleFactory } from '../utils/openaiCompatibleFactory';
|
3
3
|
|
4
4
|
export const LobeAi360AI = LobeOpenAICompatibleFactory({
|
5
|
-
baseURL: 'https://
|
5
|
+
baseURL: 'https://api.360.cn/v1',
|
6
6
|
chatCompletion: {
|
7
7
|
handlePayload: (payload) => {
|
8
8
|
return {
|
@@ -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;
|