generated from arvinxx/npm-template
-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ feat: assistantMeta 和 userMeta支持自定义类名
- Loading branch information
1 parent
a6290b5
commit edaad13
Showing
9 changed files
with
118 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/** | ||
* compact: true | ||
*/ | ||
import { example } from '@/ProChat/mocks/customeClassName'; | ||
import { ProChat } from '@ant-design/pro-chat'; | ||
import { useTheme } from 'antd-style'; | ||
|
||
export default () => { | ||
const theme = useTheme(); | ||
|
||
return ( | ||
<div style={{ background: theme.colorBgLayout }}> | ||
<style> | ||
{` | ||
.my-pro-chat-user { | ||
background-color: #fff; | ||
} | ||
.my-pro-chat-assistant { | ||
background-color: #000; | ||
} | ||
`} | ||
</style> | ||
<ProChat | ||
showTitle | ||
userMeta={{ | ||
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg', | ||
title: 'Ant Design', | ||
className: 'my-pro-chat-user', | ||
}} | ||
assistantMeta={{ | ||
avatar: '🛸', | ||
title: '自定义类名', | ||
backgroundColor: '#67dedd', | ||
className: 'my-pro-chat-assistant', | ||
}} | ||
initialChats={Object.values(example.chats)} | ||
/> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
export const example = { | ||
chats: [ | ||
{ | ||
content: '我想添加自定义类名', | ||
createAt: 1697862242452, | ||
id: 'ZGxiX2p4', | ||
role: 'user', | ||
updateAt: 1697862243540, | ||
}, | ||
{ | ||
content: ` | ||
如下 | ||
\`\`\`javascript | ||
userMeta={{ | ||
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg', | ||
title: 'Ant Design', | ||
className: 'my-pro-chat-user', | ||
}} | ||
\`\`\` | ||
\`\`\`javascript | ||
assistantMeta={{ | ||
avatar: '🛸', | ||
title: '自定义类名', | ||
backgroundColor: '#67dedd', | ||
className: 'my-pro-chat-assistant', | ||
}} | ||
\`\`\` | ||
`, | ||
createAt: 1697862247302, | ||
id: 'Sb5pAzLL', | ||
parentId: 'ZGxiX2p4', | ||
role: 'assistant', | ||
updateAt: 1697862249387, | ||
model: 'gpt-3.5-turbo', | ||
}, | ||
], | ||
config: { | ||
model: 'gpt-3.5-turbo', | ||
params: { | ||
frequency_penalty: 0, | ||
presence_penalty: 0, | ||
temperature: 0.6, | ||
top_p: 1, | ||
}, | ||
systemRole: '', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters