@lobehub/chat 0.152.0 → 0.152.1
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/package.json +1 -1
- package/src/app/(main)/market/{_layout/Desktop/AgentDetail.tsx → @detail/_layout/Desktop.tsx} +16 -11
- package/src/app/(main)/market/{(mobile)/features/AgentDetail.tsx → @detail/_layout/Mobile.tsx} +8 -6
- package/src/app/(main)/market/@detail/default.tsx +21 -0
- package/src/app/(main)/market/{features/AgentDetailContent/AgentInfo → @detail/features/AgentDetailContent}/Header.tsx +30 -21
- package/src/app/(main)/market/{features/AgentDetailContent/AgentInfo → @detail/features/AgentDetailContent}/index.tsx +10 -4
- package/src/app/(main)/market/{features/AgentDetailContent/AgentInfo → @detail/features/AgentDetailContent}/style.ts +7 -11
- package/src/app/(main)/market/_layout/Desktop/Header.tsx +3 -6
- package/src/app/(main)/market/_layout/Desktop/Hero.tsx +39 -0
- package/src/app/(main)/market/_layout/Desktop/index.tsx +23 -44
- package/src/app/(main)/market/_layout/Mobile/Header.tsx +2 -2
- package/src/app/(main)/market/_layout/Mobile/index.tsx +15 -9
- package/src/app/(main)/market/_layout/type.ts +6 -0
- package/src/app/(main)/market/features/AgentCard/AgentCardBanner.tsx +10 -9
- package/src/app/(main)/market/features/AgentCard/index.tsx +133 -58
- package/src/app/(main)/market/features/AgentList.tsx +94 -0
- package/src/app/(main)/market/features/AgentSearchBar.tsx +42 -0
- package/src/app/(main)/market/features/ShareAgentButton/Inner.tsx +9 -7
- package/src/app/(main)/market/features/ShareAgentButton/index.tsx +22 -15
- package/src/app/(main)/market/features/TagList.tsx +65 -0
- package/src/app/(main)/market/layout.tsx +11 -0
- package/src/app/(main)/market/loading.tsx +2 -2
- package/src/app/(main)/market/page.tsx +22 -12
- package/src/features/ChatInput/STT/browser.tsx +1 -1
- package/src/features/ChatInput/STT/openai.tsx +1 -1
- package/src/features/Conversation/components/InboxWelcome/AgentsSuggest.tsx +2 -2
- package/src/locales/resources.ts +1 -0
- package/src/server/translation.ts +20 -0
- package/src/services/__tests__/chat.test.ts +1 -1
- package/src/store/market/action.ts +1 -1
- package/src/store/session/slices/session/action.ts +1 -1
- package/src/utils/difference.ts +2 -1
- package/src/app/(main)/market/(desktop)/index.tsx +0 -20
- package/src/app/(main)/market/(mobile)/features/AgentCard.tsx +0 -31
- package/src/app/(main)/market/(mobile)/index.tsx +0 -25
- package/src/app/(main)/market/components/Loading.tsx +0 -13
- package/src/app/(main)/market/features/AgentCard/AgentCardItem.tsx +0 -54
- package/src/app/(main)/market/features/AgentCard/style.ts +0 -33
- package/src/app/(main)/market/features/AgentDetailContent/index.tsx +0 -12
- package/src/app/(main)/market/features/AgentSearchBar/index.tsx +0 -40
- package/src/app/(main)/market/features/PageTitle/index.tsx +0 -13
- package/src/app/(main)/market/features/TagList/Inner.tsx +0 -28
- package/src/app/(main)/market/features/TagList/index.tsx +0 -23
- package/src/app/(main)/market/layout.ts +0 -8
- /package/src/app/(main)/market/{features/AgentDetailContent/AgentInfo → @detail/features/AgentDetailContent}/Comment.tsx +0 -0
- /package/src/app/(main)/market/{features/AgentDetailContent/AgentInfo → @detail/features/AgentDetailContent}/Loading.tsx +0 -0
- /package/src/app/(main)/market/{features/AgentDetailContent/AgentInfo → @detail/features/AgentDetailContent}/TokenTag.tsx +0 -0
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { SpotlightCard, SpotlightCardProps } from '@lobehub/ui';
|
|
4
|
-
import { FC, memo, useEffect } from 'react';
|
|
5
|
-
|
|
6
|
-
import ClientResponsiveContent from '@/components/client/ClientResponsiveContent';
|
|
7
|
-
import { useMarketStore } from '@/store/market';
|
|
8
|
-
|
|
9
|
-
import AgentCard from '../features/AgentCard';
|
|
10
|
-
|
|
11
|
-
const Desktop = memo(() => {
|
|
12
|
-
useEffect(() => {
|
|
13
|
-
// refs: https://github.com/pmndrs/zustand/blob/main/docs/integrations/persisting-store-data.md#hashydrated
|
|
14
|
-
useMarketStore.persist.rehydrate();
|
|
15
|
-
}, []);
|
|
16
|
-
|
|
17
|
-
return <AgentCard CardRender={SpotlightCard as FC<SpotlightCardProps>} />;
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
export default ClientResponsiveContent({ Desktop, Mobile: () => import('../(mobile)') });
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { SpotlightCardProps } from '@lobehub/ui';
|
|
2
|
-
import { createStyles } from 'antd-style';
|
|
3
|
-
import { memo } from 'react';
|
|
4
|
-
import { Flexbox } from 'react-layout-kit';
|
|
5
|
-
|
|
6
|
-
const useStyles = createStyles(({ css, token, isDarkMode }) => ({
|
|
7
|
-
container: css`
|
|
8
|
-
overflow: hidden;
|
|
9
|
-
background: ${token.colorBgContainer};
|
|
10
|
-
border: 1px solid ${isDarkMode ? token.colorFillTertiary : token.colorFillSecondary};
|
|
11
|
-
border-radius: ${token.borderRadiusLG}px;
|
|
12
|
-
`,
|
|
13
|
-
}));
|
|
14
|
-
|
|
15
|
-
const AgentCard = memo<SpotlightCardProps>(({ items, renderItem, gap = 16, ...props }) => {
|
|
16
|
-
const { styles } = useStyles();
|
|
17
|
-
return (
|
|
18
|
-
<Flexbox gap={gap} {...props}>
|
|
19
|
-
{items.map((item, index) => {
|
|
20
|
-
const children = renderItem(item);
|
|
21
|
-
return (
|
|
22
|
-
<div className={styles.container} key={index}>
|
|
23
|
-
{children}
|
|
24
|
-
</div>
|
|
25
|
-
);
|
|
26
|
-
})}
|
|
27
|
-
</Flexbox>
|
|
28
|
-
);
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
export default AgentCard;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import dynamic from 'next/dynamic';
|
|
4
|
-
import { memo, useEffect } from 'react';
|
|
5
|
-
|
|
6
|
-
import { useMarketStore } from '@/store/market';
|
|
7
|
-
|
|
8
|
-
import AgentCard from '../features/AgentCard';
|
|
9
|
-
import CardRender from './features/AgentCard';
|
|
10
|
-
|
|
11
|
-
const DetailModal = dynamic(() => import('./features/AgentDetail'), { ssr: false });
|
|
12
|
-
|
|
13
|
-
export default memo(() => {
|
|
14
|
-
useEffect(() => {
|
|
15
|
-
// refs: https://github.com/pmndrs/zustand/blob/main/docs/integrations/persisting-store-data.md#hashydrated
|
|
16
|
-
useMarketStore.persist.rehydrate();
|
|
17
|
-
}, []);
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
<>
|
|
21
|
-
<AgentCard CardRender={CardRender} mobile />
|
|
22
|
-
<DetailModal />
|
|
23
|
-
</>
|
|
24
|
-
);
|
|
25
|
-
});
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Skeleton } from 'antd';
|
|
2
|
-
import { memo } from 'react';
|
|
3
|
-
import { Flexbox } from 'react-layout-kit';
|
|
4
|
-
|
|
5
|
-
const Loading = memo(() => {
|
|
6
|
-
return (
|
|
7
|
-
<Flexbox>
|
|
8
|
-
<Skeleton paragraph={{ rows: 8 }} />
|
|
9
|
-
</Flexbox>
|
|
10
|
-
);
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
export default Loading;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { Avatar, Tag } from '@lobehub/ui';
|
|
2
|
-
import { useHover } from 'ahooks';
|
|
3
|
-
import { Typography } from 'antd';
|
|
4
|
-
import { useThemeMode } from 'antd-style';
|
|
5
|
-
import { startCase } from 'lodash-es';
|
|
6
|
-
import { memo, useRef } from 'react';
|
|
7
|
-
import { Flexbox } from 'react-layout-kit';
|
|
8
|
-
|
|
9
|
-
import { useMarketStore } from '@/store/market';
|
|
10
|
-
import { AgentsMarketIndexItem } from '@/types/market';
|
|
11
|
-
|
|
12
|
-
import AgentCardBanner from './AgentCardBanner';
|
|
13
|
-
import { useStyles } from './style';
|
|
14
|
-
|
|
15
|
-
const { Paragraph } = Typography;
|
|
16
|
-
|
|
17
|
-
const AgentCardItem = memo<AgentsMarketIndexItem>(({ meta, identifier }) => {
|
|
18
|
-
const ref = useRef(null);
|
|
19
|
-
const isHovering = useHover(ref);
|
|
20
|
-
const onAgentCardClick = useMarketStore((s) => s.activateAgent);
|
|
21
|
-
const { styles, theme } = useStyles();
|
|
22
|
-
const { isDarkMode } = useThemeMode();
|
|
23
|
-
|
|
24
|
-
const { avatar, title, description, tags, backgroundColor } = meta;
|
|
25
|
-
|
|
26
|
-
return (
|
|
27
|
-
<Flexbox className={styles.container} onClick={() => onAgentCardClick(identifier)}>
|
|
28
|
-
<AgentCardBanner meta={meta} style={{ opacity: isDarkMode ? 0.9 : 0.4 }} />
|
|
29
|
-
<Flexbox className={styles.inner} gap={8} ref={ref}>
|
|
30
|
-
<Avatar
|
|
31
|
-
animation={isHovering}
|
|
32
|
-
avatar={avatar}
|
|
33
|
-
background={backgroundColor || theme.colorFillTertiary}
|
|
34
|
-
size={56}
|
|
35
|
-
/>
|
|
36
|
-
<Paragraph className={styles.title} ellipsis={{ rows: 1, tooltip: title }}>
|
|
37
|
-
{title}
|
|
38
|
-
</Paragraph>
|
|
39
|
-
<Paragraph className={styles.desc} ellipsis={{ rows: 2, tooltip: description }}>
|
|
40
|
-
{description}
|
|
41
|
-
</Paragraph>
|
|
42
|
-
<Flexbox gap={6} horizontal style={{ flexWrap: 'wrap' }}>
|
|
43
|
-
{(tags as string[]).filter(Boolean).map((tag: string, index) => (
|
|
44
|
-
<Tag key={index} style={{ margin: 0 }}>
|
|
45
|
-
{startCase(tag).trim()}
|
|
46
|
-
</Tag>
|
|
47
|
-
))}
|
|
48
|
-
</Flexbox>
|
|
49
|
-
</Flexbox>
|
|
50
|
-
</Flexbox>
|
|
51
|
-
);
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
export default AgentCardItem;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { createStyles } from 'antd-style';
|
|
2
|
-
|
|
3
|
-
export const useStyles = createStyles(({ css, token, responsive }) => ({
|
|
4
|
-
container: css`
|
|
5
|
-
position: relative;
|
|
6
|
-
overflow: hidden;
|
|
7
|
-
border-radius: 11px;
|
|
8
|
-
${responsive.mobile} {
|
|
9
|
-
border-radius: unset;
|
|
10
|
-
}
|
|
11
|
-
`,
|
|
12
|
-
desc: css`
|
|
13
|
-
color: ${token.colorTextDescription};
|
|
14
|
-
`,
|
|
15
|
-
inner: css`
|
|
16
|
-
padding: 16px;
|
|
17
|
-
`,
|
|
18
|
-
lazy: css`
|
|
19
|
-
min-height: 232px;
|
|
20
|
-
`,
|
|
21
|
-
subTitle: css`
|
|
22
|
-
font-size: 24px;
|
|
23
|
-
font-weight: 600;
|
|
24
|
-
${responsive.mobile} {
|
|
25
|
-
font-size: 20px;
|
|
26
|
-
}
|
|
27
|
-
`,
|
|
28
|
-
title: css`
|
|
29
|
-
margin-bottom: 0 !important;
|
|
30
|
-
font-size: 16px;
|
|
31
|
-
font-weight: 600;
|
|
32
|
-
`,
|
|
33
|
-
}));
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { SearchBar } from '@lobehub/ui';
|
|
4
|
-
import { memo, useCallback, useState } from 'react';
|
|
5
|
-
import { useTranslation } from 'react-i18next';
|
|
6
|
-
import { Flexbox } from 'react-layout-kit';
|
|
7
|
-
|
|
8
|
-
import { useIsMobile } from '@/hooks/useIsMobile';
|
|
9
|
-
import { useMarketStore } from '@/store/market';
|
|
10
|
-
|
|
11
|
-
const AgentSearchBar = memo<{ mobile?: boolean }>(({ mobile: controlledMobile }) => {
|
|
12
|
-
const { t } = useTranslation('market');
|
|
13
|
-
const [keywords, setKeywords] = useMarketStore((s) => [s.searchKeywords, s.setSearchKeywords]);
|
|
14
|
-
const [value, setValue] = useState(keywords);
|
|
15
|
-
const isMobile = useIsMobile();
|
|
16
|
-
const mobile = controlledMobile ?? isMobile;
|
|
17
|
-
|
|
18
|
-
const handleSearch = useCallback(() => {
|
|
19
|
-
setKeywords(value);
|
|
20
|
-
}, [value, setKeywords]);
|
|
21
|
-
|
|
22
|
-
return (
|
|
23
|
-
<Flexbox flex={'none'} paddingBlock={mobile ? 8 : 0}>
|
|
24
|
-
<SearchBar
|
|
25
|
-
allowClear
|
|
26
|
-
enableShortKey={!mobile}
|
|
27
|
-
onChange={(e) => setValue(e.target.value)}
|
|
28
|
-
onPressEnter={handleSearch}
|
|
29
|
-
onSubmit={handleSearch}
|
|
30
|
-
placeholder={t('search.placeholder')}
|
|
31
|
-
shortKey={'k'}
|
|
32
|
-
spotlight={!mobile}
|
|
33
|
-
type={mobile ? 'block' : 'ghost'}
|
|
34
|
-
value={value}
|
|
35
|
-
/>
|
|
36
|
-
</Flexbox>
|
|
37
|
-
);
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
export default AgentSearchBar;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { memo } from 'react';
|
|
4
|
-
import { useTranslation } from 'react-i18next';
|
|
5
|
-
|
|
6
|
-
import PageTitle from '@/components/PageTitle';
|
|
7
|
-
|
|
8
|
-
const Title = memo(() => {
|
|
9
|
-
const { t } = useTranslation('common');
|
|
10
|
-
|
|
11
|
-
return <PageTitle title={t('tab.market')} />;
|
|
12
|
-
});
|
|
13
|
-
export default Title;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Button } from 'antd';
|
|
2
|
-
import isEqual from 'fast-deep-equal';
|
|
3
|
-
import { startCase } from 'lodash-es';
|
|
4
|
-
import { memo } from 'react';
|
|
5
|
-
|
|
6
|
-
import { agentMarketSelectors, useMarketStore } from '@/store/market';
|
|
7
|
-
|
|
8
|
-
const Inner = memo(() => {
|
|
9
|
-
const agentTagList = useMarketStore(agentMarketSelectors.getAgentTagList, isEqual);
|
|
10
|
-
const [keywords, setSearchKeywords] = useMarketStore((s) => [
|
|
11
|
-
s.searchKeywords,
|
|
12
|
-
s.setSearchKeywords,
|
|
13
|
-
]);
|
|
14
|
-
|
|
15
|
-
return agentTagList.map((item) => (
|
|
16
|
-
<Button
|
|
17
|
-
key={item}
|
|
18
|
-
onClick={() => setSearchKeywords(item)}
|
|
19
|
-
shape={'round'}
|
|
20
|
-
size={'small'}
|
|
21
|
-
type={keywords === item ? 'primary' : 'default'}
|
|
22
|
-
>
|
|
23
|
-
{startCase(item)}
|
|
24
|
-
</Button>
|
|
25
|
-
));
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
export default Inner;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { Skeleton } from 'antd';
|
|
2
|
-
import { Suspense, memo } from 'react';
|
|
3
|
-
import { Flexbox } from 'react-layout-kit';
|
|
4
|
-
|
|
5
|
-
import Inner from './Inner';
|
|
6
|
-
|
|
7
|
-
const TagList = memo(() => {
|
|
8
|
-
return (
|
|
9
|
-
<Flexbox gap={6} horizontal style={{ flexWrap: 'wrap' }}>
|
|
10
|
-
<Suspense
|
|
11
|
-
fallback={Array.from({ length: 5 })
|
|
12
|
-
.fill('')
|
|
13
|
-
.map((_, index) => (
|
|
14
|
-
<Skeleton.Button key={index} shape={'round'} size={'small'} />
|
|
15
|
-
))}
|
|
16
|
-
>
|
|
17
|
-
<Inner />
|
|
18
|
-
</Suspense>
|
|
19
|
-
</Flexbox>
|
|
20
|
-
);
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
export default TagList;
|
|
File without changes
|
|
File without changes
|