enh: file item display audio
Some checks are pending
Deploy to HuggingFace Spaces / check-secret (push) Waiting to run
Deploy to HuggingFace Spaces / deploy (push) Blocked by required conditions
Create and publish Docker images with specific build args / build-main-image (linux/amd64) (push) Waiting to run
Create and publish Docker images with specific build args / build-main-image (linux/arm64) (push) Waiting to run
Create and publish Docker images with specific build args / build-cuda-image (linux/amd64) (push) Waiting to run
Create and publish Docker images with specific build args / build-cuda-image (linux/arm64) (push) Waiting to run
Create and publish Docker images with specific build args / build-ollama-image (linux/amd64) (push) Waiting to run
Create and publish Docker images with specific build args / build-ollama-image (linux/arm64) (push) Waiting to run
Create and publish Docker images with specific build args / merge-main-images (push) Blocked by required conditions
Create and publish Docker images with specific build args / merge-cuda-images (push) Blocked by required conditions
Create and publish Docker images with specific build args / merge-ollama-images (push) Blocked by required conditions
Python CI / Format Backend (3.11.x) (push) Waiting to run
Python CI / Format Backend (3.12.x) (push) Waiting to run
Frontend Build / Format & Build Frontend (push) Waiting to run
Frontend Build / Frontend Unit Tests (push) Waiting to run

This commit is contained in:
Timothy Jaeryang Baek 2025-05-04 17:29:59 +04:00
parent 6475ae3b11
commit f2cf21d64c

View File

@ -16,10 +16,21 @@
export let edit = false;
let enableFullContent = false;
let isPdf = false;
let isAudio = false;
$: isPDF =
item?.meta?.content_type === 'application/pdf' ||
(item?.name && item?.name.toLowerCase().endsWith('.pdf'));
$: isAudio =
item?.meta?.content_type.startsWith('audio/') ||
(item?.name && item?.name.toLowerCase().endsWith('.mp3')) ||
(item?.name && item?.name.toLowerCase().endsWith('.wav')) ||
(item?.name && item?.name.toLowerCase().endsWith('.ogg')) ||
(item?.name && item?.name.toLowerCase().endsWith('.m4a'));
onMount(() => {
console.log(item);
if (item?.context === 'full') {
@ -122,6 +133,15 @@
class="w-full h-[70vh] border-0 rounded-lg mt-4"
/>
{:else}
{#if isAudio}
<audio
src={`${WEBUI_API_BASE_URL}/files/${item.id}/content`}
class="w-full border-0 rounded-lg mb-2"
controls
playsinline
/>
{/if}
<div class="max-h-96 overflow-scroll scrollbar-hidden text-xs whitespace-pre-wrap">
{item?.file?.data?.content ?? 'No content'}
</div>