From ea32f3658be6ade8893adbea84fcf79bf34cbd20 Mon Sep 17 00:00:00 2001 From: Shinji-Li <1349021570@qq.com> Date: Fri, 9 Aug 2024 17:49:31 +0800 Subject: [PATCH] :pencil2: fix: ci update fixed (#299) --- package.json | 2 +- .../__test__/__snapshots__/demo.test.tsx.snap | 763 +++--------------- src/ProChat/__test__/index.test.tsx | 5 + src/ProChat/demos/actions.tsx | 47 +- 4 files changed, 165 insertions(+), 652 deletions(-) diff --git a/package.json b/package.json index dcd1de90..9be6e4b7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ant-design/pro-chat", - "version": "1.15.0", + "version": "1.15.2", "description": "a solution for ai chat", "keywords": [ "ai", diff --git a/src/ProChat/__test__/__snapshots__/demo.test.tsx.snap b/src/ProChat/__test__/__snapshots__/demo.test.tsx.snap index 592f7308..3f1cf1b3 100644 --- a/src/ProChat/__test__/__snapshots__/demo.test.tsx.snap +++ b/src/ProChat/__test__/__snapshots__/demo.test.tsx.snap @@ -22,8 +22,8 @@ exports[` > renders actions.tsx correctly 1`] = ` style="margin-top: 24px;" >
> renders actions.tsx correctly 1`] = ` class="acss-1vwqsas" style="font-size: 23.040000000000003px; height: 25.6px; width: 25.6px;" > - 🤖 + 😀
> renders actions.tsx correctly 1`] = ` class="zcss-1hxup8p" >

- 让我们开始对话吧 + test

@@ -82,9 +82,120 @@ exports[` > renders actions.tsx correctly 1`] = ` />
> renders actions.tsx correctly 1`] = ` class="layoutkit-flexbox css-19iopuf acss-1ckeg12 ant-pro-chat-input-area" >
- - 人工服务 -
-
> renders error.tsx correctly 1`] = ` style="height: 1px; width: 100%;" />
-
> renders error.tsx correctly 1`] = ` style="height: 1px; width: 100%;" />
- -
-
-
-
-
> renders helloMessage.tsx correctly 1`] = ` style="height: 1px; width: 100%;" />
-
> renders i18n.tsx correctly 1`] = ` style="height: 1px; width: 100%;" />
-
> renders listener.tsx correctly 1`] = ` style="height: 1px; width: 100%;" />
-
> renders loading.tsx correctly 1`] = ` style="height: 1px; width: 100%;" />
-
> renders modal.tsx correctly 1`] = ` style="height: 1px; width: 100%;" />
-
> renders no-stream.tsx correctly 1`] = ` style="height: 1px; width: 100%;" />
-
> renders request.tsx correctly 1`] = ` style="height: 1px; width: 100%;" />
-
> renders sse.tsx correctly 1`] = ` style="height: 1px; width: 100%;" />
-
> renders sse-trans.tsx correctly 1`] = ` style="height: 1px; width: 100%;" />
-
{ it('actions custom configure', async () => { const app = render( { const btns = app.baseElement.querySelectorAll('.anticon'); + console.log('btn', btns); + await fireEvent.click(btns.item(2)); waitFor(() => { const regenerate = app.queryByText('重新生成'); diff --git a/src/ProChat/demos/actions.tsx b/src/ProChat/demos/actions.tsx index 2d620328..9c88ed18 100644 --- a/src/ProChat/demos/actions.tsx +++ b/src/ProChat/demos/actions.tsx @@ -12,26 +12,37 @@ export default () => { return (
{ - return [ - { - window.open('https://github.com/ant-design/pro-chat'); - }} - > - 人工服务 - , - ...defaultDoms, - ]; - }, - flexConfig: { - gap: 24, - direction: 'horizontal', - justify: 'space-between', + chatItemRenderConfig={{ + actionsProps: { + user: { + actions: ['regenerate', 'edit'], + moreActions: ['del', 'copy'], + }, }, }} + chats={[ + { id: '1', content: 'test', role: 'user', createAt: Date.now(), updateAt: Date.now() }, + ]} + // actions={{ + // render: (defaultDoms) => { + // return [ + // { + // window.open('https://github.com/ant-design/pro-chat'); + // }} + // > + // 人工服务 + // , + // ...defaultDoms, + // ]; + // }, + // flexConfig: { + // gap: 24, + // direction: 'horizontal', + // justify: 'space-between', + // }, + // }} request={async (messages) => { const mockedData: string = `这是一段模拟的流式字符串数据。本次会话传入了${messages.length}条消息`;