diff --git a/packages/effects/common-ui/src/ui/word/word-work-view.vue b/packages/effects/common-ui/src/ui/word/word-work-view.vue
index b24583b..5f76b38 100644
--- a/packages/effects/common-ui/src/ui/word/word-work-view.vue
+++ b/packages/effects/common-ui/src/ui/word/word-work-view.vue
@@ -134,47 +134,53 @@ const startFetching = async () => {
if (answer && isDocxURL(answer)) {
filename.value = extractDocxFilename(answer);
+ resultItems.value.push({
+ key: resultItems.value.length + 1,
+ role: 'ai',
+ content: '文档已生成',
+ footer: h(Flex, null, [
+ h(
+ Button,
+ {
+ size: 'nomarl',
+ type: 'primary',
+ onClick: () => {
+ openPreviewDrawer('right', filename);
+ },
+ },
+ '文档预览',
+ ),
+ h(
+ Button,
+ {
+ size: 'nomarl',
+ type: 'primary',
+ style: {
+ marginLeft: '10px',
+ },
+ onClick: () => {
+ // 创建隐藏的 标签用于触发下载
+ const link = document.createElement('a');
+ link.href = answer; // 设置下载链接
+ link.download = filename; // 设置下载文件名
+ document.body.append(link); // 将 标签添加到页面中
+ link.click(); // 触发点击事件开始下载
+ link.remove(); // 下载完成后移除 标签
+ },
+ },
+ '文档下载',
+ ),
+ ]),
+ });
+ } else {
+ resultItems.value.push({
+ key: resultItems.value.length + 1,
+ role: 'ai',
+ content: res.answer,
+ });
}
fetchResult.value = `/static/${filename.value}`;
- resultItems.value.push({
- key: resultItems.value.length + 1,
- role: 'ai',
- content: res.answer,
- footer: h(Flex, null, [
- h(
- Button,
- {
- size: 'nomarl',
- type: 'primary',
- onClick: () => {
- openPreviewDrawer('right', filename);
- },
- },
- '文档预览',
- ),
- h(
- Button,
- {
- size: 'nomarl',
- type: 'primary',
- style: {
- marginLeft: '10px',
- },
- onClick: () => {
- // 创建隐藏的 标签用于触发下载
- const link = document.createElement('a');
- link.href = answer; // 设置下载链接
- link.download = filename; // 设置下载文件名
- document.body.append(link); // 将 标签添加到页面中
- link.click(); // 触发点击事件开始下载
- link.remove(); // 下载完成后移除 标签
- },
- },
- '文档下载',
- ),
- ]),
- });
// resultItems.value.push({
// key: resultItems.value.length + 1,
// role: 'ai',