@lobehub/chat 0.74.0 → 0.75.0

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 (99) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/README.md +26 -5
  3. package/README.zh-CN.md +25 -4
  4. package/locales/en_US/market.json +12 -0
  5. package/locales/en_US/plugin.json +11 -2
  6. package/locales/en_US/setting.json +3 -1
  7. package/locales/ru_RU/market.json +12 -0
  8. package/locales/ru_RU/plugin.json +44 -49
  9. package/locales/ru_RU/setting.json +3 -1
  10. package/locales/zh_CN/common.json +1 -1
  11. package/locales/zh_CN/market.json +12 -0
  12. package/locales/zh_CN/plugin.json +19 -5
  13. package/locales/zh_CN/setting.json +62 -14
  14. package/package.json +5 -4
  15. package/scripts/i18nWorkflow/const.ts +19 -0
  16. package/scripts/i18nWorkflow/genDefaultLocale.ts +19 -0
  17. package/scripts/i18nWorkflow/genDiff.ts +50 -0
  18. package/scripts/i18nWorkflow/genResources.ts +26 -0
  19. package/scripts/i18nWorkflow/index.ts +15 -0
  20. package/scripts/i18nWorkflow/utils.ts +85 -0
  21. package/src/const/layoutTokens.ts +3 -1
  22. package/src/const/market.ts +15 -0
  23. package/src/const/url.ts +29 -4
  24. package/src/features/AgentSetting/AgentConfig/index.tsx +1 -2
  25. package/src/features/AgentSetting/AgentPlugin/MarketSettingModal.tsx +1 -1
  26. package/src/features/AgentSetting/store/initialState.ts +1 -1
  27. package/src/features/MobileTabBar/index.tsx +2 -2
  28. package/src/features/SideBar/TopActions.tsx +2 -2
  29. package/src/locales/default/market.ts +12 -0
  30. package/src/locales/resources/en_US.ts +2 -0
  31. package/src/locales/resources/ru_RU.ts +2 -0
  32. package/src/locales/resources/zh_CN.ts +2 -0
  33. package/src/pages/chat/features/Conversation/Input/{Action.tsx → ActionBar/ActionLeft.tsx} +2 -2
  34. package/src/pages/chat/features/Conversation/Input/ActionBar/ActionRight.tsx +36 -0
  35. package/src/pages/chat/features/Conversation/Input/Desktop.tsx +40 -0
  36. package/src/pages/chat/features/Conversation/Input/Footer/SaveTopic.tsx +27 -0
  37. package/src/pages/chat/features/Conversation/Input/Footer/index.tsx +35 -0
  38. package/src/pages/chat/features/Conversation/Input/Mobile.tsx +12 -0
  39. package/src/pages/chat/features/Conversation/Input/index.tsx +20 -38
  40. package/src/pages/chat/features/SessionList/Header/Desktop.tsx +6 -13
  41. package/src/pages/chat/features/SessionList/Header/Mobile.tsx +1 -1
  42. package/src/pages/chat/features/SessionList/List/AddButton.tsx +1 -1
  43. package/src/pages/chat/features/SessionList/List/Item/index.tsx +4 -3
  44. package/src/pages/chat/features/SessionList/List/index.tsx +1 -3
  45. package/src/pages/chat/features/SessionList/Mobile.tsx +2 -12
  46. package/src/pages/chat/features/SessionSearchBar/index.tsx +26 -0
  47. package/src/pages/chat/features/Sidebar/Topic/index.tsx +18 -6
  48. package/src/pages/chat/features/Sidebar/TopicSearchBar/index.tsx +24 -0
  49. package/src/pages/chat/features/Sidebar/index.tsx +2 -9
  50. package/src/pages/market/features/AgentCard/AgentCardBanner.tsx +64 -0
  51. package/src/pages/market/features/AgentCard/AgentCardItem.tsx +57 -0
  52. package/src/pages/market/features/AgentCard/Loading.tsx +13 -0
  53. package/src/pages/market/features/AgentCard/index.tsx +37 -0
  54. package/src/pages/market/features/AgentCard/style.ts +22 -0
  55. package/src/pages/market/features/AgentSearchBar/index.tsx +26 -0
  56. package/src/pages/market/features/Header/Desktop.tsx +15 -4
  57. package/src/pages/market/features/Header/Mobile.tsx +7 -24
  58. package/src/pages/market/features/SideBar/AgentInfo/Comment.tsx +16 -0
  59. package/src/pages/market/features/SideBar/AgentInfo/Header.tsx +68 -0
  60. package/src/pages/market/features/SideBar/AgentInfo/Loading.tsx +61 -0
  61. package/src/pages/market/features/SideBar/AgentInfo/TokenTag.tsx +25 -0
  62. package/src/pages/market/features/SideBar/AgentInfo/index.tsx +68 -0
  63. package/src/pages/market/features/SideBar/AgentInfo/style.ts +46 -0
  64. package/src/pages/market/features/SideBar/Desktop.tsx +70 -0
  65. package/src/pages/market/features/SideBar/Mobile.tsx +36 -0
  66. package/src/pages/market/features/SideBar/index.tsx +23 -0
  67. package/src/pages/market/features/TagList/index.tsx +29 -0
  68. package/src/pages/market/index.page.tsx +11 -2
  69. package/src/pages/market/layout.mobile.tsx +8 -7
  70. package/src/pages/market/layout.tsx +39 -1
  71. package/src/pages/settings/features/Header/Desktop.tsx +2 -4
  72. package/src/pages/settings/features/Header/Mobile.tsx +1 -1
  73. package/src/pages/settings/features/Settings/Common.tsx +1 -2
  74. package/src/pages/settings/features/Settings/index.tsx +17 -4
  75. package/src/services/agentMarket.ts +21 -0
  76. package/src/store/global/initialState.ts +1 -2
  77. package/src/store/market/action.ts +57 -0
  78. package/src/store/market/index.ts +3 -0
  79. package/src/store/market/initialState.ts +17 -0
  80. package/src/store/market/selectors.ts +36 -0
  81. package/src/store/market/store.ts +51 -0
  82. package/src/store/session/slices/session/action.ts +5 -3
  83. package/src/store/session/slices/session/initialState.ts +2 -0
  84. package/src/store/session/slices/session/reducers/session.test.ts +4 -4
  85. package/src/types/market.ts +19 -0
  86. package/src/types/meta.ts +1 -1
  87. package/src/utils/filter.ts +1 -1
  88. package/src/utils/findDuplicates.ts +22 -0
  89. package/scripts/genDefaultLocale.ts +0 -18
  90. package/scripts/genResources.ts +0 -51
  91. package/scripts/toc.ts +0 -7
  92. package/src/components/Empty/index.tsx +0 -63
  93. package/src/components/Empty/style.ts +0 -31
  94. package/src/components/SelectWithImg/index.tsx +0 -97
  95. package/src/components/SelectWithImg/styles.ts +0 -43
  96. package/src/pages/chat/features/Conversation/Input/ActionRight.tsx +0 -31
  97. package/src/pages/chat/features/Conversation/Input/Footer.tsx +0 -49
  98. /package/src/components/{ManifestPreviewer.tsx → ManifestPreviewer/index.tsx} +0 -0
  99. /package/src/pages/chat/features/Conversation/Input/{Token.tsx → ActionBar/Token.tsx} +0 -0
@@ -1,97 +0,0 @@
1
- import { Icon, IconProps } from '@lobehub/ui';
2
- import { SelectProps } from 'antd';
3
- import { type CSSProperties, ReactNode, memo } from 'react';
4
- import { Flexbox } from 'react-layout-kit';
5
- import useControlledState from 'use-merge-value';
6
-
7
- import { useStyles } from './styles';
8
-
9
- export interface SelectWithImgOptionItem {
10
- icon?: IconProps['icon'];
11
- img: string;
12
- label: ReactNode;
13
- value: string;
14
- }
15
-
16
- export interface SelectWithImgProps {
17
- className?: string;
18
- classNames?: {
19
- img?: string;
20
- };
21
- defaultValue?: SelectProps['defaultValue'];
22
- height: number;
23
- onChange?: (value: this['value']) => void;
24
- options?: SelectWithImgOptionItem[];
25
- style?: CSSProperties;
26
-
27
- styles?: {
28
- img?: CSSProperties;
29
- };
30
- value?: SelectProps['value'];
31
- width: number;
32
- }
33
-
34
- const SelectWithImg = memo<SelectWithImgProps>(
35
- ({
36
- className,
37
- style,
38
- value,
39
- defaultValue,
40
- onChange,
41
- options,
42
- width,
43
- height,
44
- styles: outStyles = {},
45
- classNames = {},
46
- }) => {
47
- const [currentValue, setCurrentValue] = useControlledState<string>(defaultValue, {
48
- defaultValue,
49
- onChange,
50
- value,
51
- });
52
-
53
- const { styles, cx } = useStyles();
54
-
55
- return (
56
- <Flexbox className={className} gap={16} horizontal style={style}>
57
- {options?.map((item) => {
58
- const isActive = item.value === currentValue;
59
- return (
60
- <Flexbox
61
- align={'center'}
62
- className={cx(styles.container, isActive && styles.active)}
63
- gap={4}
64
- key={item.value}
65
- onClick={() => setCurrentValue(item.value)}
66
- >
67
- <div
68
- className={cx(styles.imgCtn, isActive && styles.imgActive, classNames.img)}
69
- style={{
70
- ...outStyles.img,
71
- height,
72
- width,
73
- }}
74
- >
75
- <div
76
- className={styles.img}
77
- style={{
78
- backgroundImage: `url(${item.img})`,
79
- backgroundSize: 'contain',
80
- height,
81
- width,
82
- }}
83
- />
84
- </div>
85
- <Flexbox align={'center'} gap={4} horizontal>
86
- {item.icon && <Icon icon={item.icon} />}
87
- {item.label}
88
- </Flexbox>
89
- </Flexbox>
90
- );
91
- })}
92
- </Flexbox>
93
- );
94
- },
95
- );
96
-
97
- export default SelectWithImg;
@@ -1,43 +0,0 @@
1
- import { createStyles } from 'antd-style';
2
-
3
- export const useStyles = createStyles(({ css, token, cx }) => {
4
- const hover = css`
5
- &:hover {
6
- border-color: ${token.colorText};
7
- box-shadow: 0 0 0 2px ${token.colorText};
8
- }
9
- `;
10
-
11
- const img = cx(
12
- css`
13
- border-radius: ${token.borderRadius}px;
14
- box-shadow: inset 0 0 0 2px ${token.colorSplit};
15
- transition: all 100ms ${token.motionEaseOut};
16
- `,
17
- hover,
18
- );
19
-
20
- return {
21
- active: css`
22
- color: ${token.colorText};
23
- `,
24
- container: css`
25
- cursor: pointer;
26
- color: ${token.colorTextDescription};
27
- `,
28
- img,
29
- imgActive: css`
30
- box-shadow: 0 0 0 2px ${token.colorTextTertiary};
31
-
32
- .${img} {
33
- box-shadow: none;
34
- }
35
- `,
36
- imgCtn: css`
37
- background: ${token.colorFillTertiary};
38
- border-radius: ${token.borderRadius}px;
39
-
40
- ${hover}
41
- `,
42
- };
43
- });
@@ -1,31 +0,0 @@
1
- import { ActionIcon } from '@lobehub/ui';
2
- import { Popconfirm } from 'antd';
3
- import { Eraser } from 'lucide-react';
4
- import { memo } from 'react';
5
- import { useTranslation } from 'react-i18next';
6
-
7
- import { useSessionStore } from '@/store/session';
8
-
9
- const ActionsRight = memo(() => {
10
- const { t } = useTranslation('setting');
11
- const [clearMessage] = useSessionStore((s) => [s.clearMessage, s.updateAgentConfig]);
12
-
13
- return (
14
- <Popconfirm
15
- cancelText={t('cancel', { ns: 'common' })}
16
- okButtonProps={{ danger: true }}
17
- okText={t('ok', { ns: 'common' })}
18
- onConfirm={() => clearMessage()}
19
- placement={'topRight'}
20
- title={t('confirmClearCurrentMessages', { ns: 'common' })}
21
- >
22
- <ActionIcon
23
- icon={Eraser}
24
- placement={'bottom'}
25
- title={t('clearCurrentMessages', { ns: 'common' })}
26
- />
27
- </Popconfirm>
28
- );
29
- });
30
-
31
- export default ActionsRight;
@@ -1,49 +0,0 @@
1
- import { Icon, Tooltip } from '@lobehub/ui';
2
- import { Button } from 'antd';
3
- import { useTheme } from 'antd-style';
4
- import { ArrowBigUp, CornerDownLeft, LucideGalleryVerticalEnd } from 'lucide-react';
5
- import { memo } from 'react';
6
- import { useTranslation } from 'react-i18next';
7
- import { Flexbox } from 'react-layout-kit';
8
-
9
- export interface FooterProps {
10
- hasTopic: boolean;
11
- saveToTopic: () => void;
12
- }
13
-
14
- const Footer = memo<FooterProps>(({ hasTopic, saveToTopic }) => {
15
- const theme = useTheme();
16
- const { t } = useTranslation('common');
17
-
18
- const saveTopic = hasTopic ? null : (
19
- <Tooltip title={t('topic.saveCurrentMessages')}>
20
- <Button icon={<Icon icon={LucideGalleryVerticalEnd} />} onClick={saveToTopic} />
21
- </Tooltip>
22
- );
23
-
24
- const footerTooltip = (
25
- <Flexbox
26
- gap={4}
27
- horizontal
28
- style={{ color: theme.colorTextDescription, fontSize: 12, marginRight: 12 }}
29
- >
30
- <Icon icon={CornerDownLeft} />
31
- <span>{t('send')}</span>
32
- <span>/</span>
33
- <Flexbox horizontal>
34
- <Icon icon={ArrowBigUp} />
35
- <Icon icon={CornerDownLeft} />
36
- </Flexbox>
37
- <span>{t('warp')}</span>
38
- </Flexbox>
39
- );
40
-
41
- return (
42
- <>
43
- {footerTooltip}
44
- {saveTopic}
45
- </>
46
- );
47
- });
48
-
49
- export default Footer;