fix: move agent attachment download api (#15146)

### What problem does this PR solve?

move agent attachment download api to the correct route and update
frontend callers

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)

### Notes

- Move the attachment download endpoint from document routes to agent
routes.
- Update frontend download callers to use the agent attachment endpoint.
- Reuse the shared file response header helper instead of duplicating it
in `agent_api.py`.
This commit is contained in:
buua436
2026-05-22 15:22:05 +08:00
committed by GitHub
parent ed04893415
commit 71a52d579c
7 changed files with 150 additions and 159 deletions

View File

@@ -1,6 +1,6 @@
import { Button } from '@/components/ui/button';
import { IDocumentDownloadInfo } from '@/interfaces/database/chat';
import { downloadFile } from '@/services/file-manager-service';
import { downloadAgentFile } from '@/services/file-manager-service';
import { downloadFileFromBlob } from '@/utils/file-util';
import { Download, FileText } from 'lucide-react';
import { useCallback } from 'react';
@@ -20,7 +20,7 @@ export function DocumentDownloadButton({
try {
const ext =
downloadInfo.filename.split('.').pop()?.toLowerCase() || 'bin';
const response = await downloadFile({
const response = await downloadAgentFile({
docId: downloadInfo.doc_id,
ext,
});

View File

@@ -8,7 +8,7 @@ import {
import { useSetModalState } from '@/hooks/common-hooks';
import { IRemoveMessageById } from '@/hooks/logic-hooks';
import { AgentChatContext } from '@/pages/agent/context';
import { downloadFile } from '@/services/file-manager-service';
import { downloadAgentFile } from '@/services/file-manager-service';
import { downloadFileFromBlob } from '@/utils/file-util';
import {
DeleteOutlined,
@@ -125,7 +125,7 @@ export const AssistantGroupButton = ({
value="g"
onClick={async () => {
try {
const response = await downloadFile({
const response = await downloadAgentFile({
docId: attachment.doc_id,
ext: attachment.format,
});