diff --git a/datacenter/app/datastores/documents/page.tsx b/datacenter/app/datastores/documents/page.tsx index e64bcb1b5..511f848c8 100644 --- a/datacenter/app/datastores/documents/page.tsx +++ b/datacenter/app/datastores/documents/page.tsx @@ -347,6 +347,10 @@ const Documents = () => { message.error('Please select a file') return } + const formData = new FormData(); + formData.append('doc_name', documentName); + formData.append('doc_file', originFileObj); + formData.append('doc_type', 'DOCUMENT'); const res = await fetch( `http://localhost:8000/knowledge/${spaceName}/document/upload`, { @@ -354,11 +358,7 @@ const Documents = () => { headers: { 'Content-Type': 'multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' }, - body: JSON.stringify({ - doc_name: documentName, - doc_file: originFileObj, - doc_type: 'DOCUMENT' - }) + body: formData } ) const data = await res.json() diff --git a/datacenter/app/datastores/page.tsx b/datacenter/app/datastores/page.tsx index 69913be2d..ceea11a0a 100644 --- a/datacenter/app/datastores/page.tsx +++ b/datacenter/app/datastores/page.tsx @@ -344,6 +344,10 @@ const Index = () => { message.error('Please select a file') return } + const formData = new FormData(); + formData.append('doc_name', documentName); + formData.append('doc_file', originFileObj); + formData.append('doc_type', 'DOCUMENT'); const res = await fetch( `http://localhost:8000/knowledge/${knowledgeSpaceName}/document/upload`, { @@ -351,11 +355,7 @@ const Index = () => { headers: { 'Content-Type': 'multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' }, - body: JSON.stringify({ - doc_name: documentName, - doc_file: originFileObj, - doc_type: 'DOCUMENT' - }) + body: formData } ) const data = await res.json()