@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.
- package/CHANGELOG.md +59 -0
- package/package.json +1 -1
- package/src/locales/default/common.ts +4 -2
- package/src/pages/chat/[id]/Config/SideBar.tsx +10 -6
- package/src/pages/chat/[id]/Config/Topic.tsx +27 -0
- package/src/pages/chat/[id]/Config/TopicItem.tsx +80 -0
- package/src/pages/chat/[id]/Conversation/Input/index.tsx +7 -4
- package/src/pages/chat/[id]/Header.tsx +14 -10
- package/src/pages/chat/layout.tsx +10 -4
- package/src/prompts/chat.ts +19 -0
- package/src/store/session/selectors.ts +1 -1
- package/src/store/session/slices/agentConfig/selectors.ts +4 -0
- package/src/store/session/slices/chat/actions/index.ts +21 -0
- package/src/store/session/slices/chat/{action.ts → actions/message.ts} +34 -32
- package/src/store/session/slices/chat/actions/topic.ts +98 -0
- package/src/store/session/slices/chat/index.ts +1 -1
- package/src/store/session/slices/chat/initialState.ts +2 -5
- package/src/store/session/slices/chat/{messageReducer.test.ts → reducers/message.test.ts} +93 -1
- package/src/store/session/slices/chat/{messageReducer.ts → reducers/message.ts} +16 -1
- package/src/store/session/slices/chat/reducers/topic.test.ts +179 -0
- package/src/store/session/slices/chat/reducers/topic.ts +59 -0
- package/src/store/session/slices/chat/selectors/chat.ts +8 -4
- package/src/store/session/slices/chat/selectors/index.ts +5 -0
- package/src/store/session/slices/chat/selectors/topic.ts +16 -0
- package/src/store/session/slices/chat/selectors/utils.test.ts +82 -2
- package/src/store/session/slices/chat/selectors/utils.ts +8 -2
- package/src/store/session/slices/session/reducers/session.ts +25 -1
- package/src/types/chatMessage.ts +4 -2
- package/src/types/session.ts +2 -1
- package/src/types/topic.ts +8 -0
- 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
|
-
});
|