2023-07-11 19:46:11 +08:00
|
|
|
import { Avatar } from '@lobehub/ui';
|
|
|
|
|
import { createStyles } from 'antd-style';
|
|
|
|
|
import isEqual from 'fast-deep-equal';
|
|
|
|
|
import { LucideBrain, LucideThermometer, WholeWord } from 'lucide-react';
|
|
|
|
|
import { memo } from 'react';
|
|
|
|
|
import { Center, Flexbox } from 'react-layout-kit';
|
|
|
|
|
import { shallow } from 'zustand/shallow';
|
|
|
|
|
|
2023-07-15 15:48:20 +08:00
|
|
|
import { agentSelectors, sessionSelectors, useChatStore } from '@/store/session';
|
|
|
|
|
|
2023-07-11 19:46:11 +08:00
|
|
|
import { ConfigCell, ConfigCellGroup } from './ConfigCell';
|
|
|
|
|
|
|
|
|
|
const useStyles = createStyles(({ css, token }) => ({
|
|
|
|
|
desc: css`
|
|
|
|
|
color: ${token.colorText};
|
|
|
|
|
`,
|
|
|
|
|
model: css`
|
|
|
|
|
color: ${token.colorTextTertiary};
|
|
|
|
|
`,
|
2023-07-15 15:48:20 +08:00
|
|
|
title: css`
|
|
|
|
|
font-size: ${token.fontSizeHeading4}px;
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
`,
|
2023-07-11 19:46:11 +08:00
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
const ReadMode = memo(() => {
|
|
|
|
|
const { styles } = useStyles();
|
|
|
|
|
const session = useChatStore(sessionSelectors.currentSessionSafe, isEqual);
|
|
|
|
|
const avatar = useChatStore(agentSelectors.currentAgentAvatar, shallow);
|
|
|
|
|
const title = useChatStore(agentSelectors.currentAgentTitle, shallow);
|
|
|
|
|
const model = useChatStore(agentSelectors.currentAgentModel, shallow);
|
|
|
|
|
|
|
|
|
|
return (
|
2023-07-15 15:48:20 +08:00
|
|
|
<Center gap={12} padding={'32px 16px'} style={{ marginTop: 8 }}>
|
|
|
|
|
<Avatar avatar={avatar} size={100} />
|
2023-07-11 19:46:11 +08:00
|
|
|
<Flexbox className={styles.title}>{title || '默认对话'}</Flexbox>
|
|
|
|
|
<Flexbox className={styles.model}>{model}</Flexbox>
|
|
|
|
|
<Flexbox className={styles.desc}>{session.meta.description}</Flexbox>
|
|
|
|
|
|
2023-07-15 15:48:20 +08:00
|
|
|
<Flexbox flex={1} gap={12} width={'100%'}>
|
2023-07-11 19:46:11 +08:00
|
|
|
<ConfigCell icon={LucideBrain} label={'提示词'} />
|
|
|
|
|
|
|
|
|
|
<ConfigCellGroup
|
|
|
|
|
items={[
|
|
|
|
|
{
|
|
|
|
|
icon: LucideThermometer,
|
|
|
|
|
label: '温度',
|
|
|
|
|
value: session.config.params.temperature,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
icon: WholeWord,
|
|
|
|
|
label: '会话最大长度',
|
|
|
|
|
value: session.config.params.max_tokens,
|
|
|
|
|
},
|
|
|
|
|
]}
|
|
|
|
|
/>
|
|
|
|
|
</Flexbox>
|
|
|
|
|
</Center>
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export default ReadMode;
|