mirror of
https://github.com/open-webui/open-webui
synced 2025-06-26 18:26:48 +00:00
refac
This commit is contained in:
parent
c846a550fa
commit
c5636ff68c
@ -154,6 +154,14 @@
|
|||||||
keys: ['name', 'description']
|
keys: ['name', 'description']
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const decodeString = (str: string) => {
|
||||||
|
try {
|
||||||
|
return decodeURIComponent(str);
|
||||||
|
} catch (e) {
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if filteredItems.length > 0 || prompt.split(' ')?.at(0)?.substring(1).startsWith('http')}
|
{#if filteredItems.length > 0 || prompt.split(' ')?.at(0)?.substring(1).startsWith('http')}
|
||||||
@ -210,7 +218,7 @@
|
|||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<div class="line-clamp-1">
|
<div class="line-clamp-1">
|
||||||
{decodeURIComponent(item?.name)}
|
{decodeString(item?.name)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -87,6 +87,14 @@
|
|||||||
showRelevance = calculateShowRelevance(citations);
|
showRelevance = calculateShowRelevance(citations);
|
||||||
showPercentage = shouldShowPercentage(citations);
|
showPercentage = shouldShowPercentage(citations);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const decodeString = (str: string) => {
|
||||||
|
try {
|
||||||
|
return decodeURIComponent(str);
|
||||||
|
} catch (e) {
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<CitationsModal
|
<CitationsModal
|
||||||
@ -117,7 +125,7 @@
|
|||||||
<div
|
<div
|
||||||
class="flex-1 mx-1 truncate text-black/60 hover:text-black dark:text-white/60 dark:hover:text-white transition"
|
class="flex-1 mx-1 truncate text-black/60 hover:text-black dark:text-white/60 dark:hover:text-white transition"
|
||||||
>
|
>
|
||||||
{decodeURIComponent(citation.source.name)}
|
{decodeString(citation.source.name)}
|
||||||
</div>
|
</div>
|
||||||
</button>
|
</button>
|
||||||
{/each}
|
{/each}
|
||||||
@ -157,7 +165,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
<div class="flex-1 mx-1 truncate">
|
<div class="flex-1 mx-1 truncate">
|
||||||
{decodeURIComponent(citation.source.name)}
|
{decodeString(citation.source.name)}
|
||||||
</div>
|
</div>
|
||||||
</button>
|
</button>
|
||||||
{/each}
|
{/each}
|
||||||
@ -194,7 +202,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
<div class="flex-1 mx-1 truncate">
|
<div class="flex-1 mx-1 truncate">
|
||||||
{decodeURIComponent(citation.source.name)}
|
{decodeString(citation.source.name)}
|
||||||
</div>
|
</div>
|
||||||
</button>
|
</button>
|
||||||
{/each}
|
{/each}
|
||||||
|
@ -45,6 +45,14 @@
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const decodeString = (str: string) => {
|
||||||
|
try {
|
||||||
|
return decodeURIComponent(str);
|
||||||
|
} catch (e) {
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Modal size="lg" bind:show>
|
<Modal size="lg" bind:show>
|
||||||
@ -99,7 +107,7 @@
|
|||||||
: `#`}
|
: `#`}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
>
|
>
|
||||||
{decodeURIComponent(document?.metadata?.name ?? document.source.name)}
|
{decodeString(document?.metadata?.name ?? document.source.name)}
|
||||||
</a>
|
</a>
|
||||||
{#if document?.metadata?.page}
|
{#if document?.metadata?.page}
|
||||||
<span class="text-xs text-gray-500 dark:text-gray-400">
|
<span class="text-xs text-gray-500 dark:text-gray-400">
|
||||||
|
@ -28,6 +28,14 @@
|
|||||||
import { deleteFileById } from '$lib/apis/files';
|
import { deleteFileById } from '$lib/apis/files';
|
||||||
|
|
||||||
let showModal = false;
|
let showModal = false;
|
||||||
|
|
||||||
|
const decodeString = (str: string) => {
|
||||||
|
try {
|
||||||
|
return decodeURIComponent(str);
|
||||||
|
} catch (e) {
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if item}
|
{#if item}
|
||||||
@ -82,7 +90,7 @@
|
|||||||
{#if !small}
|
{#if !small}
|
||||||
<div class="flex flex-col justify-center -space-y-0.5 px-2.5 w-full">
|
<div class="flex flex-col justify-center -space-y-0.5 px-2.5 w-full">
|
||||||
<div class=" dark:text-gray-100 text-sm font-medium line-clamp-1 mb-1">
|
<div class=" dark:text-gray-100 text-sm font-medium line-clamp-1 mb-1">
|
||||||
{decodeURIComponent(name)}
|
{decodeString(name)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class=" flex justify-between text-gray-500 text-xs line-clamp-1">
|
<div class=" flex justify-between text-gray-500 text-xs line-clamp-1">
|
||||||
@ -101,11 +109,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{:else}
|
{:else}
|
||||||
<Tooltip
|
<Tooltip content={decodeString(name)} className="flex flex-col w-full" placement="top-start">
|
||||||
content={decodeURIComponent(name)}
|
|
||||||
className="flex flex-col w-full"
|
|
||||||
placement="top-start"
|
|
||||||
>
|
|
||||||
<div class="flex flex-col justify-center -space-y-0.5 px-2.5 w-full">
|
<div class="flex flex-col justify-center -space-y-0.5 px-2.5 w-full">
|
||||||
<div class=" dark:text-gray-100 text-sm flex justify-between items-center">
|
<div class=" dark:text-gray-100 text-sm flex justify-between items-center">
|
||||||
{#if loading}
|
{#if loading}
|
||||||
@ -113,7 +117,7 @@
|
|||||||
<Spinner className="size-4" />
|
<Spinner className="size-4" />
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
<div class="font-medium line-clamp-1 flex-1">{decodeURIComponent(name)}</div>
|
<div class="font-medium line-clamp-1 flex-1">{decodeString(name)}</div>
|
||||||
<div class="text-gray-500 text-xs capitalize shrink-0">{formatFileSize(size)}</div>
|
<div class="text-gray-500 text-xs capitalize shrink-0">{formatFileSize(size)}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -547,6 +547,14 @@
|
|||||||
dropZone?.removeEventListener('drop', onDrop);
|
dropZone?.removeEventListener('drop', onDrop);
|
||||||
dropZone?.removeEventListener('dragleave', onDragLeave);
|
dropZone?.removeEventListener('dragleave', onDragLeave);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const decodeString = (str: string) => {
|
||||||
|
try {
|
||||||
|
return decodeURIComponent(str);
|
||||||
|
} catch (e) {
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if dragged}
|
{#if dragged}
|
||||||
@ -698,7 +706,7 @@
|
|||||||
href={selectedFile.id ? `/api/v1/files/${selectedFile.id}/content` : '#'}
|
href={selectedFile.id ? `/api/v1/files/${selectedFile.id}/content` : '#'}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
>
|
>
|
||||||
{decodeURIComponent(selectedFile?.meta?.name)}
|
{decodeString(selectedFile?.meta?.name)}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user