Skip to content

Commit 0c278c2

Browse files
committed
feat(workflow-layout): 文本生成应用新增快捷复制按钮, Close #368
1 parent a071580 commit 0c278c2

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

packages/react-app/src/layout/workflow-layout.tsx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { CopyOutlined } from '@ant-design/icons'
12
import { XStream } from '@ant-design/x'
23
import {
34
DifyApi,
@@ -10,7 +11,7 @@ import {
1011
} from '@dify-chat/api'
1112
import { AppModeEnums, useAppContext } from '@dify-chat/core'
1213
import { copyToClipboard } from '@toolkit-fe/clipboard'
13-
import { Button, Empty, Form, message, Tabs } from 'antd'
14+
import { Button, Empty, Form, message, Tabs, Tooltip } from 'antd'
1415
import { useState } from 'react'
1516

1617
import {
@@ -302,13 +303,24 @@ export default function WorkflowLayout(props: IWorkflowLayoutProps) {
302303

303304
{/* 文本生成结果渲染 */}
304305
{appMode === AppModeEnums.TEXT_GENERATOR && (
305-
<div className="md:flex-1 px-4 pt-6 overflow-x-hidden overflow-y-auto bg-theme-bg">
306+
<div className="md:flex-1 px-4 pt-6 relative overflow-x-hidden overflow-y-auto bg-theme-bg">
306307
{textGenerateStatus === 'init' ? (
307308
<div className="w-full h-full flex items-center justify-center">
308309
<Empty description={`点击 "运行" 试试看, AI 会给你带来意想不到的惊喜。 `} />
309310
</div>
310311
) : (
311-
<MarkdownRenderer markdownText={text} />
312+
<>
313+
<MarkdownRenderer markdownText={text} />
314+
<Tooltip title="复制内容">
315+
<CopyOutlined
316+
className="absolute top-6 right-6 cursor-pointer"
317+
onClick={async () => {
318+
await copyToClipboard(text)
319+
message.success('已复制到剪贴板')
320+
}}
321+
/>
322+
</Tooltip>
323+
</>
312324
)}
313325
</div>
314326
)}

0 commit comments

Comments
 (0)