feat(@vben/web-antd): 解决word文档无法预览问题
- 修改msg的读取参数
This commit is contained in:
parent
e4349221b2
commit
931db0235f
@ -1,8 +1,8 @@
|
|||||||
VITE_BASE=/
|
VITE_BASE=/
|
||||||
|
|
||||||
# 接口地址
|
# 接口地址
|
||||||
# VITE_GLOB_API_URL=http://dify.vertoryao.xyz/api
|
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://172.16.35.190:9090/api
|
||||||
|
|
||||||
# 是否开启压缩,可以设置为 none, brotli, gzip
|
# 是否开启压缩,可以设置为 none, brotli, gzip
|
||||||
VITE_COMPRESS=none
|
VITE_COMPRESS=none
|
||||||
|
@ -10,7 +10,7 @@ import '@vue-office/docx/lib/index.css';
|
|||||||
|
|
||||||
// const url = ref('');
|
// const url = ref('');
|
||||||
const isLoading = ref(false); // 新增:加载状态变量
|
const isLoading = ref(false); // 新增:加载状态变量
|
||||||
const docx = ref<any>(`/docx/027c6b7c-fea6-4964-839b-27857c4d3181.docx`);
|
const docx = ref<any>();
|
||||||
const pptStyle = ref({
|
const pptStyle = ref({
|
||||||
height: 'calc(100vh - 100px)',
|
height: 'calc(100vh - 100px)',
|
||||||
width: '100%',
|
width: '100%',
|
||||||
|
@ -231,13 +231,13 @@ const startFetching = async () => {
|
|||||||
content: content.value || '',
|
content: content.value || '',
|
||||||
});
|
});
|
||||||
content.value = '';
|
content.value = '';
|
||||||
const { answer } = res;
|
// const { answer } = res;
|
||||||
conversationId.value = res.conversationId;
|
conversationId.value = res.conversationId;
|
||||||
|
|
||||||
const docxInfo = extractDocxInfo(answer);
|
const docxInfo = extractDocxInfo(res.answer);
|
||||||
|
|
||||||
if (docxInfo) {
|
if (docxInfo) {
|
||||||
const { filename, url } = docxInfo;
|
const { id, url } = res.messageFiles[0];
|
||||||
resultItems.value.push({
|
resultItems.value.push({
|
||||||
key: resultItems.value.length + 1,
|
key: resultItems.value.length + 1,
|
||||||
role: 'ai',
|
role: 'ai',
|
||||||
@ -263,7 +263,7 @@ const startFetching = async () => {
|
|||||||
onClick: () => {
|
onClick: () => {
|
||||||
const link = document.createElement('a');
|
const link = document.createElement('a');
|
||||||
link.href = url;
|
link.href = url;
|
||||||
link.download = filename;
|
link.download = id;
|
||||||
document.body.append(link);
|
document.body.append(link);
|
||||||
link.click();
|
link.click();
|
||||||
link.remove();
|
link.remove();
|
||||||
@ -308,10 +308,8 @@ watch(
|
|||||||
footer: msg.footer,
|
footer: msg.footer,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
const docxInfo = extractDocxInfo(msg.content);
|
if (msg.content.messageFiles.length > 0) {
|
||||||
|
const { id, url } = msg.content.messageFiles[0];
|
||||||
if (docxInfo) {
|
|
||||||
const { filename, url } = docxInfo;
|
|
||||||
resultItems.value.push({
|
resultItems.value.push({
|
||||||
key: resultItems.value.length + 1,
|
key: resultItems.value.length + 1,
|
||||||
role: msg.role,
|
role: msg.role,
|
||||||
@ -323,7 +321,7 @@ watch(
|
|||||||
size: 'normal',
|
size: 'normal',
|
||||||
type: 'primary',
|
type: 'primary',
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
openPreviewDrawer('right', { value: filename });
|
openPreviewDrawer('right', url);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'文档预览',
|
'文档预览',
|
||||||
@ -337,7 +335,7 @@ watch(
|
|||||||
onClick: () => {
|
onClick: () => {
|
||||||
const link = document.createElement('a');
|
const link = document.createElement('a');
|
||||||
link.href = url;
|
link.href = url;
|
||||||
link.download = filename;
|
link.download = id;
|
||||||
document.body.append(link);
|
document.body.append(link);
|
||||||
link.click();
|
link.click();
|
||||||
link.remove();
|
link.remove();
|
||||||
@ -351,7 +349,7 @@ watch(
|
|||||||
resultItems.value.push({
|
resultItems.value.push({
|
||||||
key: resultItems.value.length + 1,
|
key: resultItems.value.length + 1,
|
||||||
role: msg.role,
|
role: msg.role,
|
||||||
content: msg.content,
|
content: msg.content.answer,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -126,7 +126,7 @@ async function handleClick(item: string) {
|
|||||||
itemMessage.value.push({
|
itemMessage.value.push({
|
||||||
key: itemMessage.value.length + 1,
|
key: itemMessage.value.length + 1,
|
||||||
role: 'ai',
|
role: 'ai',
|
||||||
content: msg.answer,
|
content: msg,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
{
|
{
|
||||||
"welcomeBack": "欢迎回来",
|
"welcomeBack": "欢迎回来",
|
||||||
"pageTitle": "开箱即用的大型中后台管理系统",
|
"pageTitle": " ",
|
||||||
"pageDesc": "工程化、高性能、跨组件库的前端模版",
|
"pageDesc": " ",
|
||||||
"loginSuccess": "登录成功",
|
"loginSuccess": "登录成功",
|
||||||
"loginSuccessDesc": "欢迎回来",
|
"loginSuccessDesc": "欢迎回来",
|
||||||
"loginSubtitle": "请输入您的帐户信息以开始管理您的项目",
|
"loginSubtitle": "请输入您的帐户信息以开始管理您的工作流",
|
||||||
"selectAccount": "快速选择账号",
|
"selectAccount": "快速选择账号",
|
||||||
"username": "账号",
|
"username": "账号",
|
||||||
"password": "密码",
|
"password": "密码",
|
||||||
|
Loading…
Reference in New Issue
Block a user