mirror of
https://github.com/open-webui/open-webui
synced 2025-04-02 12:09:06 +00:00
Merge 0ef0eab248
into e0ec2cdeb0
This commit is contained in:
commit
df0e67fbfa
@ -28,6 +28,8 @@
|
||||
{@html html}
|
||||
{:else if token.text.includes(`<iframe src="${WEBUI_BASE_URL}/api/v1/files/`)}
|
||||
{@html `${token.text}`}
|
||||
{:else if token.text.includes(`<iframe ytEmbed`)}
|
||||
{@html `${token.text.replace(`<iframe ytEmbed`, `<iframe`)}`}
|
||||
{:else if token.text.includes(`<source_id`)}
|
||||
<Source {id} {token} onClick={onSourceClick} />
|
||||
{:else}
|
||||
|
@ -274,6 +274,8 @@
|
||||
{@html `${token.text}`}
|
||||
{:else if token.text.includes(`<source_id`)}
|
||||
<Source {id} {token} onClick={onSourceClick} />
|
||||
{:else if token.text.includes(`<iframe ytEmbed`)}
|
||||
{@html `${token.text.replace(`<iframe ytEmbed`, `<iframe`)}`}
|
||||
{:else}
|
||||
{token.text}
|
||||
{/if}
|
||||
|
@ -29,6 +29,14 @@ export const replaceTokens = (content, sourceIds, char, user) => {
|
||||
const tokens = [
|
||||
{ regex: /{{char}}/gi, replacement: char },
|
||||
{ regex: /{{user}}/gi, replacement: user },
|
||||
{
|
||||
regex: /{{(VIDEO_YOUTUBE_ID_[^\s{}]+)}}/gi,
|
||||
replacement: (_, fullMatch) => {
|
||||
const ytId = fullMatch.replace("VIDEO_YOUTUBE_ID_", ""); // Extract only the ID
|
||||
const videoUrl = `https://www.youtube.com/embed/${ytId}`;
|
||||
return `<iframe ytEmbed src="${videoUrl}" width="100%" height="500" frameborder="0" allowfullscreen></iframe>`;
|
||||
}
|
||||
},
|
||||
{
|
||||
regex: /{{VIDEO_FILE_ID_([a-f0-9-]+)}}/gi,
|
||||
replacement: (_, fileId) =>
|
||||
|
Loading…
Reference in New Issue
Block a user