Commit d33135e5 by weiw

fix:处理文件下载预览的功能

parent 934f1a45
......@@ -25,8 +25,9 @@ export const ChatAnswerAttachment: React.FC<ChatAnswerAttachmentProps> = ({ answ
window.open(attachment.content.url)
}
const handleClickDocLink = async (documentStoreKey: string) => {
const res = await fetchGetDocumentLink(documentStoreKey)
const handleClickDocLink = async (doc: any) => {
const docId = `${doc.knowledgeName}/${doc.documentStoreKey}`
const res = await fetchGetDocumentLink(docId)
if (res.data) {
window.open(res.data.docUrl)
}
......@@ -59,7 +60,7 @@ export const ChatAnswerAttachment: React.FC<ChatAnswerAttachmentProps> = ({ answ
</p>
<div className="flex flex-col gap-[9px]">
{ attachment.content.docList.map(doc => (
<Link className="cursor-pointer" onPress={() => handleClickDocLink(doc.documentStoreKey)} size="sm" key={doc.documentStoreKey} isExternal showAnchorIcon underline="hover">
<Link className="cursor-pointer" onPress={() => handleClickDocLink(doc)} size="sm" key={doc.documentStoreKey} isExternal showAnchorIcon underline="hover">
{doc.documentAlias}
</Link>
))}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment