Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dify
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ai-tech
dify
Commits
c4352960
Commit
c4352960
authored
Feb 27, 2024
by
Garfield Dai
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'chore/upload-quota' into deploy/dev
parents
dada397a
5992c9cc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
index.tsx
web/app/components/datasets/create/file-uploader/index.tsx
+3
-3
base.ts
web/service/base.ts
+2
-2
No files found.
web/app/components/datasets/create/file-uploader/index.tsx
View file @
c4352960
...
...
@@ -134,7 +134,7 @@ const FileUploader = ({
xhr
:
new
XMLHttpRequest
(),
data
:
formData
,
onprogress
:
onProgress
,
})
}
,
false
,
undefined
,
'?source=datasets'
)
.
then
((
res
:
File
)
=>
{
const
completeFile
=
{
fileID
:
fileItem
.
fileID
,
...
...
@@ -146,8 +146,8 @@ const FileUploader = ({
onFileUpdate
(
completeFile
,
100
,
fileListCopy
)
return
Promise
.
resolve
({
...
completeFile
})
})
.
catch
(()
=>
{
notify
({
type
:
'error'
,
message
:
t
(
'datasetCreation.stepOne.uploader.failed'
)
})
.
catch
((
e
)
=>
{
notify
({
type
:
'error'
,
message
:
e
?.
response
?.
code
===
'forbidden'
?
e
?.
response
?.
message
:
t
(
'datasetCreation.stepOne.uploader.failed'
)
})
onFileUpdate
(
fileItem
,
-
2
,
fileListCopy
)
return
Promise
.
resolve
({
...
fileItem
})
})
...
...
web/service/base.ts
View file @
c4352960
...
...
@@ -308,7 +308,7 @@ const baseFetch = <T>(
])
as
Promise
<
T
>
}
export
const
upload
=
(
options
:
any
,
isPublicAPI
?:
boolean
,
url
?:
string
):
Promise
<
any
>
=>
{
export
const
upload
=
(
options
:
any
,
isPublicAPI
?:
boolean
,
url
?:
string
,
searchParams
?:
string
):
Promise
<
any
>
=>
{
const
urlPrefix
=
isPublicAPI
?
PUBLIC_API_PREFIX
:
API_PREFIX
let
token
=
''
if
(
isPublicAPI
)
{
...
...
@@ -329,7 +329,7 @@ export const upload = (options: any, isPublicAPI?: boolean, url?: string): Promi
}
const
defaultOptions
=
{
method
:
'POST'
,
url
:
url
?
`
${
urlPrefix
}${
url
}
`
:
`
${
urlPrefix
}
/files/upload`
,
url
:
(
url
?
`
${
urlPrefix
}${
url
}
`
:
`
${
urlPrefix
}
/files/upload`
)
+
(
searchParams
||
''
)
,
headers
:
{
Authorization
:
`Bearer
${
token
}
`
,
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment