From f8c23ce66c11e98aa0c6625a44cff828ef2d115c Mon Sep 17 00:00:00 2001 From: leowang Date: Sat, 6 Apr 2024 21:05:10 +0800 Subject: [PATCH] fix: empty url --- pages/knowledgebases/index.vue | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pages/knowledgebases/index.vue b/pages/knowledgebases/index.vue index ea1f099..d915d0b 100644 --- a/pages/knowledgebases/index.vue +++ b/pages/knowledgebases/index.vue @@ -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)