mirror of
https://github.com/simstudioai/sim.git
synced 2026-01-10 23:48:09 -05:00
* feat(chat-stream): updated workflow id execute route to support streaming via API * enable streaming via api * added only text stream option * cleanup deployed preview componnet * updated selectedOutputIds to selectedOutput * updated TS and Python SDKs with async, rate limits, usage, and streaming API routes * stream non-streaming blocks when streaming is specified * fix(chat-panel): add onBlockComplete handler to chat panel to stream back blocks as they complete * update docs * cleanup * ack PR comments * updated next config * removed getAssetUrl in favor of local assets * resolve merge conflicts * remove extra logic to create sensitive result * simplify internal auth * remove vercel blob from CSP + next config
58 lines
1.3 KiB
TypeScript
58 lines
1.3 KiB
TypeScript
'use client'
|
|
|
|
import { useState } from 'react'
|
|
import { getAssetUrl } from '@/lib/utils'
|
|
import { Lightbox } from './lightbox'
|
|
|
|
interface VideoProps {
|
|
src: string
|
|
className?: string
|
|
autoPlay?: boolean
|
|
loop?: boolean
|
|
muted?: boolean
|
|
playsInline?: boolean
|
|
enableLightbox?: boolean
|
|
}
|
|
|
|
export function Video({
|
|
src,
|
|
className = 'w-full rounded-xl border border-border shadow-sm overflow-hidden outline-none focus:outline-none',
|
|
autoPlay = true,
|
|
loop = true,
|
|
muted = true,
|
|
playsInline = true,
|
|
enableLightbox = true,
|
|
}: VideoProps) {
|
|
const [isLightboxOpen, setIsLightboxOpen] = useState(false)
|
|
|
|
const handleVideoClick = () => {
|
|
if (enableLightbox) {
|
|
setIsLightboxOpen(true)
|
|
}
|
|
}
|
|
|
|
return (
|
|
<>
|
|
<video
|
|
autoPlay={autoPlay}
|
|
loop={loop}
|
|
muted={muted}
|
|
playsInline={playsInline}
|
|
className={`${className} ${enableLightbox ? 'cursor-pointer transition-opacity hover:opacity-90' : ''}`}
|
|
src={getAssetUrl(src)}
|
|
onClick={handleVideoClick}
|
|
/>
|
|
|
|
{enableLightbox && (
|
|
<Lightbox
|
|
isOpen={isLightboxOpen}
|
|
onClose={() => setIsLightboxOpen(false)}
|
|
src={src}
|
|
alt={`Video: ${src}`}
|
|
type='video'
|
|
/>
|
|
)}
|
|
</>
|
|
)
|
|
}
|