@lobehub/chat 1.138.0 → 1.138.2
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/changelog/v1.json +18 -0
- package/docs/self-hosting/environment-variables/auth.mdx +17 -0
- package/locales/ar/chat.json +1 -1
- package/locales/ar/common.json +1 -1
- package/locales/ar/models.json +35 -8
- package/locales/ar/plugin.json +1 -1
- package/locales/ar/welcome.json +1 -1
- package/locales/bg-BG/chat.json +1 -1
- package/locales/bg-BG/common.json +1 -1
- package/locales/bg-BG/models.json +35 -8
- package/locales/bg-BG/plugin.json +1 -1
- package/locales/bg-BG/welcome.json +1 -1
- package/locales/de-DE/chat.json +1 -1
- package/locales/de-DE/common.json +1 -1
- package/locales/de-DE/models.json +35 -8
- package/locales/de-DE/plugin.json +1 -1
- package/locales/de-DE/welcome.json +1 -1
- package/locales/en-US/chat.json +1 -1
- package/locales/en-US/common.json +1 -1
- package/locales/en-US/models.json +35 -8
- package/locales/en-US/plugin.json +1 -1
- package/locales/en-US/welcome.json +1 -1
- package/locales/es-ES/chat.json +1 -1
- package/locales/es-ES/common.json +1 -1
- package/locales/es-ES/models.json +35 -8
- package/locales/es-ES/plugin.json +1 -1
- package/locales/es-ES/welcome.json +1 -1
- package/locales/fa-IR/chat.json +1 -1
- package/locales/fa-IR/common.json +1 -1
- package/locales/fa-IR/models.json +35 -8
- package/locales/fa-IR/plugin.json +1 -1
- package/locales/fa-IR/welcome.json +1 -1
- package/locales/fr-FR/chat.json +1 -1
- package/locales/fr-FR/common.json +1 -1
- package/locales/fr-FR/models.json +35 -8
- package/locales/fr-FR/plugin.json +1 -1
- package/locales/fr-FR/welcome.json +1 -1
- package/locales/it-IT/chat.json +1 -1
- package/locales/it-IT/common.json +1 -1
- package/locales/it-IT/models.json +35 -8
- package/locales/it-IT/plugin.json +1 -1
- package/locales/it-IT/welcome.json +1 -1
- package/locales/ja-JP/chat.json +1 -1
- package/locales/ja-JP/common.json +1 -1
- package/locales/ja-JP/models.json +35 -8
- package/locales/ja-JP/plugin.json +1 -1
- package/locales/ja-JP/welcome.json +1 -1
- package/locales/ko-KR/chat.json +1 -1
- package/locales/ko-KR/common.json +1 -1
- package/locales/ko-KR/models.json +35 -8
- package/locales/ko-KR/plugin.json +1 -1
- package/locales/ko-KR/welcome.json +1 -1
- package/locales/nl-NL/chat.json +1 -1
- package/locales/nl-NL/common.json +1 -1
- package/locales/nl-NL/models.json +35 -8
- package/locales/nl-NL/plugin.json +1 -1
- package/locales/nl-NL/welcome.json +1 -1
- package/locales/pl-PL/chat.json +1 -1
- package/locales/pl-PL/common.json +1 -1
- package/locales/pl-PL/models.json +35 -8
- package/locales/pl-PL/plugin.json +1 -1
- package/locales/pl-PL/welcome.json +1 -1
- package/locales/pt-BR/chat.json +1 -1
- package/locales/pt-BR/common.json +1 -1
- package/locales/pt-BR/models.json +35 -8
- package/locales/pt-BR/plugin.json +1 -1
- package/locales/pt-BR/welcome.json +1 -1
- package/locales/ru-RU/chat.json +1 -1
- package/locales/ru-RU/common.json +1 -1
- package/locales/ru-RU/models.json +35 -8
- package/locales/ru-RU/plugin.json +1 -1
- package/locales/ru-RU/welcome.json +1 -1
- package/locales/tr-TR/chat.json +1 -1
- package/locales/tr-TR/common.json +1 -1
- package/locales/tr-TR/models.json +35 -8
- package/locales/tr-TR/plugin.json +1 -1
- package/locales/tr-TR/welcome.json +1 -1
- package/locales/vi-VN/chat.json +1 -1
- package/locales/vi-VN/common.json +1 -1
- package/locales/vi-VN/models.json +35 -8
- package/locales/vi-VN/plugin.json +1 -1
- package/locales/vi-VN/welcome.json +1 -1
- package/locales/zh-CN/common.json +1 -1
- package/locales/zh-CN/models.json +35 -8
- package/locales/zh-CN/plugin.json +1 -1
- package/locales/zh-CN/welcome.json +1 -1
- package/locales/zh-TW/chat.json +1 -1
- package/locales/zh-TW/common.json +1 -1
- package/locales/zh-TW/models.json +35 -8
- package/locales/zh-TW/plugin.json +1 -1
- package/locales/zh-TW/welcome.json +1 -1
- package/package.json +1 -1
- package/packages/const/src/branding.ts +2 -2
- package/packages/const/src/index.ts +1 -0
- package/packages/const/src/version.ts +1 -1
- package/packages/model-bank/src/aiModels/ollamacloud.ts +12 -2
- package/packages/model-bank/src/aiModels/qwen.ts +124 -0
- package/packages/model-bank/src/aiModels/siliconcloud.ts +42 -0
- package/packages/model-bank/src/aiModels/vercelaigateway.ts +2 -4
- package/packages/types/src/aiChat.ts +1 -1
- package/src/app/[variants]/(auth)/next-auth/signin/AuthSignInBox.tsx +4 -4
- package/src/app/[variants]/(main)/chat/(workspace)/@conversation/features/ChatList/WelcomeChatItem/{OpeningQuestions.tsx → AgentWelcome/OpeningQuestions.tsx} +2 -2
- package/src/app/[variants]/(main)/chat/(workspace)/@conversation/features/ChatList/WelcomeChatItem/{InboxWelcome → AgentWelcome}/index.tsx +38 -17
- package/src/app/[variants]/(main)/chat/(workspace)/@conversation/features/ChatList/WelcomeChatItem/index.tsx +2 -2
- package/src/app/[variants]/(main)/discover/(detail)/assistant/[...slugs]/page.tsx +1 -1
- package/src/app/[variants]/(main)/discover/(detail)/mcp/[slug]/page.tsx +1 -1
- package/src/config/modelProviders/lobehub.ts +1 -1
- package/src/libs/next-auth/sso-providers/feishu.ts +83 -0
- package/src/libs/next-auth/sso-providers/index.ts +2 -0
- package/src/locales/default/common.ts +1 -1
- package/src/locales/default/plugin.ts +1 -1
- package/src/locales/default/welcome.ts +1 -1
- package/src/server/ld.ts +1 -1
- package/src/server/routers/lambda/aiChat.test.ts +2 -2
- package/src/server/routers/lambda/aiChat.ts +4 -4
- package/src/store/chat/slices/aiChat/actions/__tests__/generateAIChatV2.test.ts +76 -5
- package/src/store/chat/slices/aiChat/actions/generateAIChatV2.ts +15 -6
- package/src/app/[variants]/(main)/chat/(workspace)/@conversation/features/ChatList/WelcomeChatItem/InboxWelcome/AgentsSuggest.tsx +0 -114
- package/src/app/[variants]/(main)/chat/(workspace)/@conversation/features/ChatList/WelcomeChatItem/InboxWelcome/QuestionSuggest.tsx +0 -104
- package/src/app/[variants]/(main)/chat/(workspace)/@conversation/features/ChatList/WelcomeChatItem/WelcomeMessage.tsx +0 -65
- /package/src/app/[variants]/(main)/chat/(workspace)/@conversation/features/ChatList/WelcomeChatItem/{InboxWelcome → AgentWelcome}/AddButton.tsx +0 -0
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { ActionIcon, Avatar, Block, Grid, Text } from '@lobehub/ui';
|
|
4
|
-
import { Skeleton } from 'antd';
|
|
5
|
-
import { createStyles } from 'antd-style';
|
|
6
|
-
import { RefreshCw } from 'lucide-react';
|
|
7
|
-
import Link from 'next/link';
|
|
8
|
-
import { memo, useState } from 'react';
|
|
9
|
-
import { useTranslation } from 'react-i18next';
|
|
10
|
-
import { Flexbox } from 'react-layout-kit';
|
|
11
|
-
import urlJoin from 'url-join';
|
|
12
|
-
|
|
13
|
-
import { useDiscoverStore } from '@/store/discover';
|
|
14
|
-
import { DiscoverAssistantItem } from '@/types/discover';
|
|
15
|
-
|
|
16
|
-
const useStyles = createStyles(({ css, token, responsive }) => ({
|
|
17
|
-
card: css`
|
|
18
|
-
position: relative;
|
|
19
|
-
|
|
20
|
-
overflow: hidden;
|
|
21
|
-
|
|
22
|
-
height: 100%;
|
|
23
|
-
min-height: 110px;
|
|
24
|
-
padding: 16px;
|
|
25
|
-
border-radius: ${token.borderRadiusLG}px;
|
|
26
|
-
|
|
27
|
-
background: ${token.colorBgContainer};
|
|
28
|
-
|
|
29
|
-
${responsive.mobile} {
|
|
30
|
-
min-height: 72px;
|
|
31
|
-
}
|
|
32
|
-
`,
|
|
33
|
-
cardDesc: css`
|
|
34
|
-
margin-block: 0 !important;
|
|
35
|
-
color: ${token.colorTextDescription};
|
|
36
|
-
`,
|
|
37
|
-
cardTitle: css`
|
|
38
|
-
margin-block: 0 !important;
|
|
39
|
-
font-size: 16px;
|
|
40
|
-
font-weight: bold;
|
|
41
|
-
`,
|
|
42
|
-
icon: css`
|
|
43
|
-
color: ${token.colorTextSecondary};
|
|
44
|
-
`,
|
|
45
|
-
title: css`
|
|
46
|
-
color: ${token.colorTextDescription};
|
|
47
|
-
`,
|
|
48
|
-
}));
|
|
49
|
-
|
|
50
|
-
const AgentsSuggest = memo<{ mobile?: boolean }>(({ mobile }) => {
|
|
51
|
-
const { t } = useTranslation('welcome');
|
|
52
|
-
const [page, setPage] = useState(1);
|
|
53
|
-
const useAssistantList = useDiscoverStore((s) => s.useAssistantList);
|
|
54
|
-
|
|
55
|
-
const { data: assistantList, isLoading } = useAssistantList({
|
|
56
|
-
page,
|
|
57
|
-
pageSize: mobile ? 2 : 4,
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
const { styles } = useStyles();
|
|
61
|
-
|
|
62
|
-
const loadingCards = Array.from({ length: mobile ? 2 : 4 }).map((_, index) => (
|
|
63
|
-
<Block className={styles.card} key={index}>
|
|
64
|
-
<Skeleton active avatar paragraph={{ rows: 2 }} title={false} />
|
|
65
|
-
</Block>
|
|
66
|
-
));
|
|
67
|
-
|
|
68
|
-
const handleRefresh = () => {
|
|
69
|
-
if (!assistantList) return;
|
|
70
|
-
setPage(page + 1);
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
// if no assistant data, just hide the component
|
|
74
|
-
if (!isLoading && !assistantList?.items?.length) return null;
|
|
75
|
-
|
|
76
|
-
return (
|
|
77
|
-
<Flexbox gap={8} width={'100%'}>
|
|
78
|
-
<Flexbox align={'center'} horizontal justify={'space-between'}>
|
|
79
|
-
<div className={styles.title}>{t('guide.agents.title')}</div>
|
|
80
|
-
<ActionIcon
|
|
81
|
-
icon={RefreshCw}
|
|
82
|
-
onClick={handleRefresh}
|
|
83
|
-
size={{ blockSize: 24, size: 14 }}
|
|
84
|
-
title={t('guide.agents.replaceBtn')}
|
|
85
|
-
/>
|
|
86
|
-
</Flexbox>
|
|
87
|
-
<Grid gap={8} rows={2}>
|
|
88
|
-
{isLoading || !assistantList
|
|
89
|
-
? loadingCards
|
|
90
|
-
: assistantList.items.map((item: DiscoverAssistantItem) => (
|
|
91
|
-
<Link
|
|
92
|
-
href={urlJoin('/discover/assistant', item.identifier)}
|
|
93
|
-
key={item.identifier}
|
|
94
|
-
prefetch={false}
|
|
95
|
-
>
|
|
96
|
-
<Block className={styles.card} clickable gap={12} horizontal variant={'outlined'}>
|
|
97
|
-
<Avatar avatar={item.avatar} style={{ flex: 'none' }} />
|
|
98
|
-
<Flexbox gap={2} style={{ overflow: 'hidden', width: '100%' }}>
|
|
99
|
-
<Text className={styles.cardTitle} ellipsis={{ rows: 1 }}>
|
|
100
|
-
{item.title}
|
|
101
|
-
</Text>
|
|
102
|
-
<Text className={styles.cardDesc} ellipsis={{ rows: mobile ? 1 : 2 }}>
|
|
103
|
-
{item.description}
|
|
104
|
-
</Text>
|
|
105
|
-
</Flexbox>
|
|
106
|
-
</Block>
|
|
107
|
-
</Link>
|
|
108
|
-
))}
|
|
109
|
-
</Grid>
|
|
110
|
-
</Flexbox>
|
|
111
|
-
);
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
export default AgentsSuggest;
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { ActionIcon, Block } from '@lobehub/ui';
|
|
4
|
-
import { createStyles } from 'antd-style';
|
|
5
|
-
import { shuffle } from 'lodash-es';
|
|
6
|
-
import { ArrowRight } from 'lucide-react';
|
|
7
|
-
import Link from 'next/link';
|
|
8
|
-
import { memo } from 'react';
|
|
9
|
-
import { useTranslation } from 'react-i18next';
|
|
10
|
-
import { Flexbox } from 'react-layout-kit';
|
|
11
|
-
|
|
12
|
-
import { BRANDING_NAME } from '@/const/branding';
|
|
13
|
-
import { USAGE_DOCUMENTS } from '@/const/url';
|
|
14
|
-
import { useChatStore } from '@/store/chat';
|
|
15
|
-
|
|
16
|
-
import { useSend } from '../../../ChatInput/useSend';
|
|
17
|
-
|
|
18
|
-
const useStyles = createStyles(({ css, token, responsive }) => ({
|
|
19
|
-
card: css`
|
|
20
|
-
padding-block: 12px;
|
|
21
|
-
padding-inline: 24px;
|
|
22
|
-
border-radius: 48px;
|
|
23
|
-
|
|
24
|
-
color: ${token.colorText};
|
|
25
|
-
|
|
26
|
-
background: ${token.colorBgContainer};
|
|
27
|
-
|
|
28
|
-
${responsive.mobile} {
|
|
29
|
-
padding-block: 8px;
|
|
30
|
-
padding-inline: 16px;
|
|
31
|
-
}
|
|
32
|
-
`,
|
|
33
|
-
icon: css`
|
|
34
|
-
color: ${token.colorTextSecondary};
|
|
35
|
-
`,
|
|
36
|
-
title: css`
|
|
37
|
-
color: ${token.colorTextDescription};
|
|
38
|
-
`,
|
|
39
|
-
}));
|
|
40
|
-
|
|
41
|
-
const qa = shuffle([
|
|
42
|
-
'q01',
|
|
43
|
-
'q02',
|
|
44
|
-
'q03',
|
|
45
|
-
'q04',
|
|
46
|
-
'q05',
|
|
47
|
-
'q06',
|
|
48
|
-
'q07',
|
|
49
|
-
'q08',
|
|
50
|
-
'q09',
|
|
51
|
-
'q10',
|
|
52
|
-
'q11',
|
|
53
|
-
'q12',
|
|
54
|
-
'q13',
|
|
55
|
-
'q14',
|
|
56
|
-
'q15',
|
|
57
|
-
]);
|
|
58
|
-
|
|
59
|
-
const QuestionSuggest = memo<{ mobile?: boolean }>(({ mobile }) => {
|
|
60
|
-
const [updateInputMessage] = useChatStore((s) => [s.updateInputMessage]);
|
|
61
|
-
|
|
62
|
-
const { t } = useTranslation('welcome');
|
|
63
|
-
const { styles } = useStyles();
|
|
64
|
-
const { send: sendMessage } = useSend();
|
|
65
|
-
|
|
66
|
-
return (
|
|
67
|
-
<Flexbox gap={8} width={'100%'}>
|
|
68
|
-
<Flexbox align={'center'} horizontal justify={'space-between'}>
|
|
69
|
-
<div className={styles.title}>{t('guide.questions.title')}</div>
|
|
70
|
-
<Link href={USAGE_DOCUMENTS} target={'_blank'}>
|
|
71
|
-
<ActionIcon
|
|
72
|
-
icon={ArrowRight}
|
|
73
|
-
size={{ blockSize: 24, size: 16 }}
|
|
74
|
-
title={t('guide.questions.moreBtn')}
|
|
75
|
-
/>
|
|
76
|
-
</Link>
|
|
77
|
-
</Flexbox>
|
|
78
|
-
<Flexbox gap={8} horizontal wrap={'wrap'}>
|
|
79
|
-
{qa.slice(0, mobile ? 2 : 5).map((item) => {
|
|
80
|
-
const text = t(`guide.qa.${item}` as any, { appName: BRANDING_NAME });
|
|
81
|
-
return (
|
|
82
|
-
<Block
|
|
83
|
-
align={'center'}
|
|
84
|
-
className={styles.card}
|
|
85
|
-
clickable
|
|
86
|
-
gap={8}
|
|
87
|
-
horizontal
|
|
88
|
-
key={item}
|
|
89
|
-
onClick={() => {
|
|
90
|
-
updateInputMessage(text);
|
|
91
|
-
sendMessage({ isWelcomeQuestion: true });
|
|
92
|
-
}}
|
|
93
|
-
variant={'outlined'}
|
|
94
|
-
>
|
|
95
|
-
{t(text)}
|
|
96
|
-
</Block>
|
|
97
|
-
);
|
|
98
|
-
})}
|
|
99
|
-
</Flexbox>
|
|
100
|
-
</Flexbox>
|
|
101
|
-
);
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
export default QuestionSuggest;
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import isEqual from 'fast-deep-equal';
|
|
2
|
-
import qs from 'query-string';
|
|
3
|
-
import React, { useMemo } from 'react';
|
|
4
|
-
import { useTranslation } from 'react-i18next';
|
|
5
|
-
import { Flexbox } from 'react-layout-kit';
|
|
6
|
-
|
|
7
|
-
import { ChatItem } from '@/features/ChatItem';
|
|
8
|
-
import { useAgentStore } from '@/store/agent';
|
|
9
|
-
import { agentChatConfigSelectors, agentSelectors } from '@/store/agent/selectors';
|
|
10
|
-
import { useChatStore } from '@/store/chat';
|
|
11
|
-
import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig';
|
|
12
|
-
import { useSessionStore } from '@/store/session';
|
|
13
|
-
import { sessionMetaSelectors } from '@/store/session/selectors';
|
|
14
|
-
|
|
15
|
-
import OpeningQuestions from './OpeningQuestions';
|
|
16
|
-
|
|
17
|
-
const WelcomeMessage = () => {
|
|
18
|
-
const mobile = useServerConfigStore((s) => s.isMobile);
|
|
19
|
-
const { t } = useTranslation('chat');
|
|
20
|
-
const type = useAgentStore(agentChatConfigSelectors.displayMode);
|
|
21
|
-
const openingMessage = useAgentStore(agentSelectors.openingMessage);
|
|
22
|
-
const openingQuestions = useAgentStore(agentSelectors.openingQuestions);
|
|
23
|
-
|
|
24
|
-
const meta = useSessionStore(sessionMetaSelectors.currentAgentMeta, isEqual);
|
|
25
|
-
const { isAgentEditable } = useServerConfigStore(featureFlagsSelectors);
|
|
26
|
-
const activeId = useChatStore((s) => s.activeId);
|
|
27
|
-
|
|
28
|
-
const agentSystemRoleMsg = t('agentDefaultMessageWithSystemRole', {
|
|
29
|
-
name: meta.title || t('defaultAgent'),
|
|
30
|
-
systemRole: meta.description,
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
const agentMsg = t(isAgentEditable ? 'agentDefaultMessage' : 'agentDefaultMessageWithoutEdit', {
|
|
34
|
-
name: meta.title || t('defaultAgent'),
|
|
35
|
-
url: qs.stringifyUrl({
|
|
36
|
-
query: mobile ? { session: activeId, showMobileWorkspace: mobile } : { session: activeId },
|
|
37
|
-
url: '/chat/settings',
|
|
38
|
-
}),
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
const message = useMemo(() => {
|
|
42
|
-
if (openingMessage) return openingMessage;
|
|
43
|
-
return !!meta.description ? agentSystemRoleMsg : agentMsg;
|
|
44
|
-
}, [openingMessage, agentSystemRoleMsg, agentMsg, meta.description]);
|
|
45
|
-
|
|
46
|
-
const chatItem = (
|
|
47
|
-
<ChatItem
|
|
48
|
-
avatar={meta}
|
|
49
|
-
editing={false}
|
|
50
|
-
message={message}
|
|
51
|
-
placement={'left'}
|
|
52
|
-
variant={type === 'chat' ? 'bubble' : 'docs'}
|
|
53
|
-
/>
|
|
54
|
-
);
|
|
55
|
-
|
|
56
|
-
return openingQuestions.length > 0 ? (
|
|
57
|
-
<Flexbox>
|
|
58
|
-
{chatItem}
|
|
59
|
-
<OpeningQuestions mobile={mobile} questions={openingQuestions} />
|
|
60
|
-
</Flexbox>
|
|
61
|
-
) : (
|
|
62
|
-
chatItem
|
|
63
|
-
);
|
|
64
|
-
};
|
|
65
|
-
export default WelcomeMessage;
|