generated from arvinxx/npm-template
-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
74 additions
and
28 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
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 |
---|---|---|
@@ -1,19 +1,18 @@ | ||
import { chats } from '@/ProChat/mocks/threebody'; | ||
import { ProChat } from '@ant-design/pro-chat'; | ||
import { useTheme } from 'antd-style'; | ||
import { Flexbox } from 'react-layout-kit'; | ||
|
||
export default () => { | ||
const theme = useTheme(); | ||
|
||
return ( | ||
<Flexbox style={{ background: theme.colorBgLayout }}> | ||
<div style={{ background: theme.colorBgLayout }}> | ||
<ProChat | ||
showTitle | ||
userMeta={{ avatar: '🧔', title: '罗辑' }} | ||
assistantMeta={{ avatar: '🛸', title: '三体世界', backgroundColor: 'blue' }} | ||
initialChats={chats.chats} | ||
/> | ||
</Flexbox> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/** | ||
* iframe: 500 | ||
* title: 非流式的请求 | ||
* description: 消息将在等待 5s 后返回 | ||
*/ | ||
import { ProChat } from '@ant-design/pro-chat'; | ||
import { useTheme } from 'antd-style'; | ||
|
||
const delay = (text: string) => | ||
new Promise<string>((resolve) => { | ||
setTimeout(() => { | ||
resolve(text); | ||
}, 5000); | ||
}); | ||
|
||
export default () => { | ||
const theme = useTheme(); | ||
|
||
return ( | ||
<div style={{ background: theme.colorBgLayout, height: '100vh' }}> | ||
<ProChat | ||
request={async (messages) => { | ||
const text = await delay( | ||
`这是一条模拟非流式输出的消息的消息。本次会话传入了${messages.length}条消息`, | ||
); | ||
|
||
return new Response(text); | ||
}} | ||
style={{ height: '100vh' }} | ||
/> | ||
</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
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