generated from arvinxx/npm-template
-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* ✨ feat: add chat item actions render * ✨ feat: ci pass
- Loading branch information
1 parent
56880dd
commit a33b39a
Showing
9 changed files
with
98 additions
and
15 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
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
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,43 @@ | ||
/** | ||
* compact: true | ||
*/ | ||
import { ProChat } from '@ant-design/pro-chat'; | ||
import { useTheme } from 'antd-style'; | ||
|
||
import { Button } from 'antd'; | ||
import { MockResponse } from '../mocks/streamResponse'; | ||
|
||
export default () => { | ||
const theme = useTheme(); | ||
|
||
return ( | ||
<div style={{ background: theme.colorBgLayout }}> | ||
<ProChat | ||
chatItemRenderConfig={{ | ||
actionsRender: (props, dom, actionsProps) => { | ||
if (props?.editing) { | ||
return null; | ||
} | ||
return ( | ||
<Button | ||
type="default" | ||
onClick={() => { | ||
actionsProps?.onStartEdit(); | ||
}} | ||
> | ||
Start Editing | ||
</Button> | ||
); | ||
}, | ||
}} | ||
request={async (messages) => { | ||
const mockedData: string = `这是一段模拟的流式字符串数据。本次会话传入了${messages.length}条消息`; | ||
|
||
const mockResponse = new MockResponse(mockedData); | ||
|
||
return mockResponse.getResponse(); | ||
}} | ||
/> | ||
</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