Skip to content

Commit

Permalink
Merge pull request #222 from LihaoWang/leowang/fix-empty-url
Browse files Browse the repository at this point in the history
fix: cannot create new knowledge if no url were provided
  • Loading branch information
sugarforever authored Apr 6, 2024
2 parents 655e9ea + f8c23ce commit 8782240
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions pages/knowledgebases/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@ const onSubmit = async () => {
loading.value = true
const formData = new FormData()
state.urls
.split(' ')
.map((url: string) => url.trim())
.forEach((url: string) => formData.append('urls', url))
if (state.urls.trim().length > 0) {
state.urls
.split(' ')
.map((url: string) => url.trim())
.forEach((url: string) => formData.append('urls', url))
}
Array.from(selectedFiles.value).forEach((file, index) => {
formData.append(`file_${index}`, file)
Expand Down

0 comments on commit 8782240

Please sign in to comment.