This commit is contained in:
Timothy Jaeryang Baek
2025-12-21 18:08:36 +04:00
parent 7746e9f4b8
commit c96549eaa7
7 changed files with 170 additions and 71 deletions
+3 -9
View File
@@ -779,9 +779,6 @@
urls = [urls];
}
// deduplicate URLs
urls = [...new Set(urls)];
// Create file items first
const fileItems = urls.map((url) => ({
type: 'text',
@@ -796,7 +793,6 @@
// Display all items at once
files = [...files, ...fileItems];
// Process sequentially (NOT parallel)
for (const fileItem of fileItems) {
try {
const res = isYoutubeUrl(fileItem.url)
@@ -811,14 +807,12 @@
...fileItem.file
};
}
files = [...files];
} catch (e) {
fileItem.status = 'error';
fileItem.error = String(e);
files = files.filter((f) => f.name !== url);
toast.error(`${e}`);
}
// Force UI reactivity after each file finishes
files = [...files];
}
};
@@ -93,6 +93,7 @@
const i18n = getContext('i18n');
export let onUpload: Function = (e) => {};
export let onChange: Function = () => {};
export let createMessagePair: Function;
@@ -15,12 +15,14 @@
let url = '';
const submitHandler = () => {
const urls = url
let urls = url
.split('\n')
.map((u) => u.trim())
.filter((u) => u !== '')
.filter((u) => isValidHttpUrl(u));
urls = [...new Set(urls)];
if (urls.length === 0) {
toast.error($i18n.t('Please enter a valid URL.'));
return;