mirror of
https://github.com/open-webui/open-webui
synced 2025-06-23 02:16:52 +00:00
Audio token
This commit is contained in:
parent
2b9c466bed
commit
d269c4b8e6
@ -38,6 +38,20 @@
|
|||||||
{:else}
|
{:else}
|
||||||
{token.text}
|
{token.text}
|
||||||
{/if}
|
{/if}
|
||||||
|
{:else if html && html.includes('<audio')}
|
||||||
|
{@const audio = html.match(/<audio[^>]*>([\s\S]*?)<\/audio>/)}
|
||||||
|
{@const audioSrc = audio && audio[1]}
|
||||||
|
{#if audioSrc}
|
||||||
|
<!-- svelte-ignore a11y-media-has-caption -->
|
||||||
|
<audio
|
||||||
|
class="w-full my-2"
|
||||||
|
src={audioSrc.replaceAll('&', '&')}
|
||||||
|
title="Audio player"
|
||||||
|
controls
|
||||||
|
></audio>
|
||||||
|
{:else}
|
||||||
|
{token.text}
|
||||||
|
{/if}
|
||||||
{:else if token.text && token.text.match(/<iframe\s+[^>]*src="https:\/\/www\.youtube\.com\/embed\/([a-zA-Z0-9_-]{11})(?:\?[^"]*)?"[^>]*><\/iframe>/)}
|
{:else if token.text && token.text.match(/<iframe\s+[^>]*src="https:\/\/www\.youtube\.com\/embed\/([a-zA-Z0-9_-]{11})(?:\?[^"]*)?"[^>]*><\/iframe>/)}
|
||||||
{@const match = token.text.match(
|
{@const match = token.text.match(
|
||||||
/<iframe\s+[^>]*src="https:\/\/www\.youtube\.com\/embed\/([a-zA-Z0-9_-]{11})(?:\?[^"]*)?"[^>]*><\/iframe>/
|
/<iframe\s+[^>]*src="https:\/\/www\.youtube\.com\/embed\/([a-zA-Z0-9_-]{11})(?:\?[^"]*)?"[^>]*><\/iframe>/
|
||||||
|
Loading…
Reference in New Issue
Block a user