Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

feat: Web <video> and <audio> element support src attribute (#19988)

ruanjiefeng9ebc58b1a20d
diff --git a/web/app/components/base/markdown.tsx b/web/app/components/base/markdown.tsx
index bc6fe0e43a2..4600543ac4b 100644
--- a/web/app/components/base/markdown.tsx
+++ b/web/app/components/base/markdown.tsx
@@ -216,16 +216,24 @@ CodeBlock.displayName = 'CodeBlock'
const VideoBlock: any = memo(({ node }: any) => {
const srcs = node.children.filter((child: any) => 'properties' in child).map((child: any) => (child as any).properties.src)
- if (srcs.length === 0)
+ if (srcs.length === 0) {
+ const src = node.properties?.src
+ if (src)
+ return <VideoGallery key={src} srcs={[src]} />
return null
+ }
return <VideoGallery key={srcs.join()} srcs={srcs} />
})
VideoBlock.displayName = 'VideoBlock'
const AudioBlock: any = memo(({ node }: any) => {
const srcs = node.children.filter((child: any) => 'properties' in child).map((child: any) => (child as any).properties.src)
- if (srcs.length === 0)
+ if (srcs.length === 0) {
+ const src = node.properties?.src
+ if (src)
+ return <AudioGallery key={src} srcs={[src]} />
return null
+ }
return <AudioGallery key={srcs.join()} srcs={srcs} />
})
AudioBlock.displayName = 'AudioBlock'