@lobehub/chat 0.18.2 → 0.20.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 (31) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/package.json +1 -1
  3. package/src/locales/default/common.ts +4 -2
  4. package/src/pages/chat/[id]/Config/SideBar.tsx +10 -6
  5. package/src/pages/chat/[id]/Config/Topic.tsx +27 -0
  6. package/src/pages/chat/[id]/Config/TopicItem.tsx +80 -0
  7. package/src/pages/chat/[id]/Conversation/Input/index.tsx +7 -4
  8. package/src/pages/chat/[id]/Header.tsx +14 -10
  9. package/src/pages/chat/layout.tsx +10 -4
  10. package/src/prompts/chat.ts +19 -0
  11. package/src/store/session/selectors.ts +1 -1
  12. package/src/store/session/slices/agentConfig/selectors.ts +4 -0
  13. package/src/store/session/slices/chat/actions/index.ts +21 -0
  14. package/src/store/session/slices/chat/{action.ts → actions/message.ts} +34 -32
  15. package/src/store/session/slices/chat/actions/topic.ts +98 -0
  16. package/src/store/session/slices/chat/index.ts +1 -1
  17. package/src/store/session/slices/chat/initialState.ts +2 -5
  18. package/src/store/session/slices/chat/{messageReducer.test.ts → reducers/message.test.ts} +93 -1
  19. package/src/store/session/slices/chat/{messageReducer.ts → reducers/message.ts} +16 -1
  20. package/src/store/session/slices/chat/reducers/topic.test.ts +179 -0
  21. package/src/store/session/slices/chat/reducers/topic.ts +59 -0
  22. package/src/store/session/slices/chat/selectors/chat.ts +8 -4
  23. package/src/store/session/slices/chat/selectors/index.ts +5 -0
  24. package/src/store/session/slices/chat/selectors/topic.ts +16 -0
  25. package/src/store/session/slices/chat/selectors/utils.test.ts +82 -2
  26. package/src/store/session/slices/chat/selectors/utils.ts +8 -2
  27. package/src/store/session/slices/session/reducers/session.ts +25 -1
  28. package/src/types/chatMessage.ts +4 -2
  29. package/src/types/session.ts +2 -1
  30. package/src/types/topic.ts +8 -0
  31. package/src/pages/chat/[id]/Config/ConfigCell.tsx +0 -68
@@ -1,68 +0,0 @@
1
- import { Icon } from '@lobehub/ui';
2
- import { createStyles } from 'antd-style';
3
- import { LucideChevronRight, LucideIcon } from 'lucide-react';
4
- import { memo } from 'react';
5
- import { Flexbox } from 'react-layout-kit';
6
-
7
- const useStyles = createStyles(({ css, token }) => ({
8
- container: css`
9
- background: ${token.colorFillQuaternary};
10
- border-radius: 6px;
11
- `,
12
- split: css`
13
- border-bottom: 1px solid ${token.colorSplit};
14
- `,
15
- }));
16
- export interface ConfigItem {
17
- icon: LucideIcon;
18
- label: string;
19
- value?: string | number;
20
- }
21
-
22
- export type ConfigCellProps = ConfigItem;
23
-
24
- export const ConfigCell = memo<ConfigCellProps>(({ icon, label, value }) => {
25
- const { styles } = useStyles();
26
- return (
27
- <Flexbox
28
- className={styles.container}
29
- distribution={'space-between'}
30
- horizontal
31
- padding={'10px 12px'}
32
- >
33
- <Flexbox gap={8} horizontal>
34
- <Icon icon={icon} />
35
- <Flexbox>{label}</Flexbox>
36
- </Flexbox>
37
- {value ?? <Icon icon={LucideChevronRight} />}
38
- </Flexbox>
39
- );
40
- });
41
-
42
- export interface CellGroupProps {
43
- items: ConfigItem[];
44
- }
45
-
46
- export const ConfigCellGroup = memo<CellGroupProps>(({ items }) => {
47
- const { styles } = useStyles();
48
-
49
- return (
50
- <Flexbox className={styles.container}>
51
- {items.map(({ label, icon, value }, index) => (
52
- <Flexbox
53
- className={items.length === index + 1 ? undefined : styles.split}
54
- distribution={'space-between'}
55
- horizontal
56
- key={label}
57
- padding={'10px 12px'}
58
- >
59
- <Flexbox gap={8} horizontal>
60
- <Icon icon={icon} />
61
- <Flexbox>{label}</Flexbox>
62
- </Flexbox>
63
- {value ?? <Icon icon={LucideChevronRight} />}
64
- </Flexbox>
65
- ))}
66
- </Flexbox>
67
- );
68
- });