Merge remote-tracking branch 'origin/new-page-framework' into llm_framework

This commit is contained in:
aries_ckt 2023-06-28 17:47:27 +08:00
commit 22da6e9a41
2 changed files with 10 additions and 10 deletions

View File

@ -347,6 +347,10 @@ const Documents = () => {
message.error('Please select a file') message.error('Please select a file')
return return
} }
const formData = new FormData();
formData.append('doc_name', documentName);
formData.append('doc_file', originFileObj);
formData.append('doc_type', 'DOCUMENT');
const res = await fetch( const res = await fetch(
`http://localhost:8000/knowledge/${spaceName}/document/upload`, `http://localhost:8000/knowledge/${spaceName}/document/upload`,
{ {
@ -354,11 +358,7 @@ const Documents = () => {
headers: { headers: {
'Content-Type': 'multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' 'Content-Type': 'multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW'
}, },
body: JSON.stringify({ body: formData
doc_name: documentName,
doc_file: originFileObj,
doc_type: 'DOCUMENT'
})
} }
) )
const data = await res.json() const data = await res.json()

View File

@ -344,6 +344,10 @@ const Index = () => {
message.error('Please select a file') message.error('Please select a file')
return return
} }
const formData = new FormData();
formData.append('doc_name', documentName);
formData.append('doc_file', originFileObj);
formData.append('doc_type', 'DOCUMENT');
const res = await fetch( const res = await fetch(
`http://localhost:8000/knowledge/${knowledgeSpaceName}/document/upload`, `http://localhost:8000/knowledge/${knowledgeSpaceName}/document/upload`,
{ {
@ -351,11 +355,7 @@ const Index = () => {
headers: { headers: {
'Content-Type': 'multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' 'Content-Type': 'multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW'
}, },
body: JSON.stringify({ body: formData
doc_name: documentName,
doc_file: originFileObj,
doc_type: 'DOCUMENT'
})
} }
) )
const data = await res.json() const data = await res.json()