From b40c76d3f3c6d5520943ce863aacee733d6482ba Mon Sep 17 00:00:00 2001 From: shaohuzhang1 <80892890+shaohuzhang1@users.noreply.github.com> Date: Tue, 8 Jul 2025 10:52:27 +0800 Subject: [PATCH] fix: PDF Preview (#3504) --- apps/oss/serializers/file.py | 2 +- .../component/knowledge-source-component/index.vue | 10 ++++++---- ui/src/utils/common.ts | 6 ++++++ 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/apps/oss/serializers/file.py b/apps/oss/serializers/file.py index c3584caee..ad083b0a7 100644 --- a/apps/oss/serializers/file.py +++ b/apps/oss/serializers/file.py @@ -96,7 +96,7 @@ class FileSerializer(serializers.Serializer): content_type = mime_types.get(file_type, 'application/octet-stream') headers = { 'Content-Type': content_type, - 'Content-Disposition': f'attachment; filename="{file.file_name}"' + 'Content-Disposition': f'{"inline" if file_type == "pdf" else "attachment"}; filename="{file.file_name}"' } return HttpResponse( file.get_bytes(), diff --git a/ui/src/components/ai-chat/component/knowledge-source-component/index.vue b/ui/src/components/ai-chat/component/knowledge-source-component/index.vue index a1760ebde..00e268770 100644 --- a/ui/src/components/ai-chat/component/knowledge-source-component/index.vue +++ b/ui/src/components/ai-chat/component/knowledge-source-component/index.vue @@ -20,14 +20,14 @@
{{ item && item?.document_name }}