feat(@vben/web-antd): 解决word文档无法预览问题

- 修改msg的读取参数
This commit is contained in:
vertoryao 2025-06-13 19:56:52 +08:00
parent e4349221b2
commit 931db0235f
5 changed files with 16 additions and 18 deletions

View File

@ -1,8 +1,8 @@
VITE_BASE=/
# 接口地址
# VITE_GLOB_API_URL=http://dify.vertoryao.xyz/api
VITE_GLOB_API_URL=http://172.16.35.190:9090/api
VITE_GLOB_API_URL=http://dify.vertoryao.xyz/api
# VITE_GLOB_API_URL=http://172.16.35.190:9090/api
# 是否开启压缩,可以设置为 none, brotli, gzip
VITE_COMPRESS=none

View File

@ -10,7 +10,7 @@ import '@vue-office/docx/lib/index.css';
// const url = ref('');
const isLoading = ref(false); //
const docx = ref<any>(`/docx/027c6b7c-fea6-4964-839b-27857c4d3181.docx`);
const docx = ref<any>();
const pptStyle = ref({
height: 'calc(100vh - 100px)',
width: '100%',

View File

@ -231,13 +231,13 @@ const startFetching = async () => {
content: content.value || '',
});
content.value = '';
const { answer } = res;
// const { answer } = res;
conversationId.value = res.conversationId;
const docxInfo = extractDocxInfo(answer);
const docxInfo = extractDocxInfo(res.answer);
if (docxInfo) {
const { filename, url } = docxInfo;
const { id, url } = res.messageFiles[0];
resultItems.value.push({
key: resultItems.value.length + 1,
role: 'ai',
@ -263,7 +263,7 @@ const startFetching = async () => {
onClick: () => {
const link = document.createElement('a');
link.href = url;
link.download = filename;
link.download = id;
document.body.append(link);
link.click();
link.remove();
@ -308,10 +308,8 @@ watch(
footer: msg.footer,
});
} else {
const docxInfo = extractDocxInfo(msg.content);
if (docxInfo) {
const { filename, url } = docxInfo;
if (msg.content.messageFiles.length > 0) {
const { id, url } = msg.content.messageFiles[0];
resultItems.value.push({
key: resultItems.value.length + 1,
role: msg.role,
@ -323,7 +321,7 @@ watch(
size: 'normal',
type: 'primary',
onClick: () => {
openPreviewDrawer('right', { value: filename });
openPreviewDrawer('right', url);
},
},
'文档预览',
@ -337,7 +335,7 @@ watch(
onClick: () => {
const link = document.createElement('a');
link.href = url;
link.download = filename;
link.download = id;
document.body.append(link);
link.click();
link.remove();
@ -351,7 +349,7 @@ watch(
resultItems.value.push({
key: resultItems.value.length + 1,
role: msg.role,
content: msg.content,
content: msg.content.answer,
});
}
}

View File

@ -126,7 +126,7 @@ async function handleClick(item: string) {
itemMessage.value.push({
key: itemMessage.value.length + 1,
role: 'ai',
content: msg.answer,
content: msg,
});
}
});

View File

@ -1,10 +1,10 @@
{
"welcomeBack": "欢迎回来",
"pageTitle": "开箱即用的大型中后台管理系统",
"pageDesc": "工程化、高性能、跨组件库的前端模版",
"pageTitle": " ",
"pageDesc": " ",
"loginSuccess": "登录成功",
"loginSuccessDesc": "欢迎回来",
"loginSubtitle": "请输入您的帐户信息以开始管理您的项目",
"loginSubtitle": "请输入您的帐户信息以开始管理您的工作流",
"selectAccount": "快速选择账号",
"username": "账号",
"password": "密码",