mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-11 20:05:19 +00:00
Update KnowledgeBase.svelte
This commit is contained in:
parent
e093310787
commit
6e2333ccf7
1 changed files with 6 additions and 3 deletions
|
|
@ -240,14 +240,17 @@
|
|||
const content = res.file.data.content;
|
||||
const filename = res.filename || url;
|
||||
|
||||
const file = new File([content], filename, { type: 'text/plain' });
|
||||
const uploadedFile = await uploadFile(localStorage.token, file);
|
||||
// Create a safe filename for the File object to avoid filesystem issues
|
||||
const safeFilename = `web_content_${uuidv4()}.txt`;
|
||||
|
||||
const file = new File([content], safeFilename, { type: 'text/plain' });
|
||||
const uploadedFile = await uploadFile(localStorage.token, file, { name: filename });
|
||||
|
||||
if (uploadedFile) {
|
||||
knowledge.files = knowledge.files.map((item) => {
|
||||
if (item.itemId === tempItemId) {
|
||||
item.id = uploadedFile.id;
|
||||
item.name = uploadedFile.filename;
|
||||
item.name = filename; // Use the URL/filename as the title
|
||||
item.size = uploadedFile.size;
|
||||
item.status = 'uploaded';
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue