Обзор
Компоненты
- Accordion
- Alert
- Alert Dialog
- Autocomplete
- Auth Surface
- Avatar
- Badge
- Browse Catalog Dialog
- Button
- Card
- Checkbox
- Checkbox Group
- Collapsible
- Combobox
- Command
- Connector Setup Dialog
- Cookie Banner
- Dialog
- Directory Card
- Directory Detail
- Directory Skeleton
- DrawerНовое
- Token Parts Input
- Empty
- Field
- Fieldset
- File Preview Modal
- File Preview Skeleton
- Form
- Frame
- Group
- Icon
- Input
- Input Group
- Kbd
- Label
- Legal Shell
- Menu
- Mermaid Diagram
- Mind Map Diagram
- Not Found Screen
- Onboarding Frame
- Popover
- PDF Thumbnail
- Personalization Landing
- Preview Card
- Pricing Page
- Progress
- Radio Group
- Ring Spinner
- Scroll Area
- Select
- Separator
- Settings Page
- Settings Skills
- Settings Connectors
- Settings Capabilities
- Settings Usage
- Settings Account
- Settings Billing
- Sheet
- Sidebar
- Skeleton
- Skill Create Dialog
- Slider
- Spinner
- Stat
- Switch
- Table
- Tabs
- Textarea
- Toast
- Toggle
- Tooltip
AI-компоненты
- Компоненты AI
- Chat Conversation
- Chat Message
- Chat Response
- Chat Suggestion
- Chat Prompt Input
- Slash Highlighted Textarea
- Chat Search Dialog
- Chat Skill Doc
- Chat Connector Detail
- Chat Attachments
- Chat File Card
- Chat Token Chip
- Chat Code Block
- Chat Image
- Chat Inline Citation
- Chat Sources
- Chat Web Search
- Chat Research
- Chat Source
- Chat Actions
- Chat Context
- Chat Loader
- Chat Compaction
- Chat Timeline
- Chat Snippet
- Chat Terminal
- Chat Stack Trace
- Chat Test Results
- Chat File Tree
- Chat Environment Variables
- Chat Audio Player
- Chat Transcription
- Chat Speech Input
- Chat Mic Selector
- Chat Voice Selector
- Chat Agent
- Chat Persona
- Chat Connection
- Chat Connector Suggestion
- Chat Queue
- Chat Checkpoint
- Chat Confirmation
- Chat Artifact
- Chat JSX Preview
- Chat Schema Display
- Chat Package Info
- Chat Commit
- Chat Plan
- Chat Open In Chat
- Chat Sandbox
- Chat Model Selector
- Chat Canvas
- Chat Node
- Chat Edge
Ресурсы
Chat Transcription
STT-вывод с сегментами по timestamp и click-to-seek подсветкой текущего слова.
Воспроизведение: 0.0 с
"use client";
import { useEffect, useState } from "react";
import {
ChatTranscription,
type ChatTranscriptionSegment,
} from "@/components/ui/chat-transcription";
const segments: ChatTranscriptionSegment[] = [
{ text: "Привет!", startSecond: 0, endSecond: 0.6 },
{ text: "Я", startSecond: 0.7, endSecond: 0.9 },
{ text: "помогу", startSecond: 1.0, endSecond: 1.4 },
{ text: "тебе", startSecond: 1.5, endSecond: 1.8 },
{ text: "разобраться", startSecond: 1.9, endSecond: 2.6 },
{ text: "с", startSecond: 2.7, endSecond: 2.9 },
{ text: "Cache", startSecond: 3.0, endSecond: 3.4 },
{ text: "Components", startSecond: 3.5, endSecond: 4.2 },
{ text: "в", startSecond: 4.3, endSecond: 4.5 },
{ text: "Next.js", startSecond: 4.6, endSecond: 5.2 },
{ text: "16.", startSecond: 5.3, endSecond: 5.7 },
];
export default function Particle() {
const [time, setTime] = useState(0);
useEffect(() => {
const id = setInterval(() => {
setTime((t) => (t > 6 ? 0 : t + 0.1));
}, 100);
return () => clearInterval(id);
}, []);
return (
<div className="flex w-full max-w-2xl flex-col gap-3 p-4">
<p className="text-muted-foreground text-xs uppercase tracking-wide">
Воспроизведение: {time.toFixed(1)} с
</p>
<ChatTranscription
currentTime={time}
onSeek={setTime}
segments={segments}
/>
</div>
);
}
Установка
pnpm dlx shadcn@latest add @oracul/chat-transcription
Использование
import {
ChatTranscription,
type ChatTranscriptionSegment,
} from "@/components/ui/chat-transcription";
const segments: ChatTranscriptionSegment[] = [
{ text: "Hello,", startSecond: 0, endSecond: 0.5 },
{ text: "this", startSecond: 0.6, endSecond: 0.9 },
{ text: "is", startSecond: 1.0, endSecond: 1.2 },
{ text: "Oracul.", startSecond: 1.3, endSecond: 1.9 },
];
<ChatTranscription
currentTime={currentTime}
segments={segments}
onSeek={(t) => audioRef.current?.fastSeek(t)}
/>Поведение
- Активный сегмент (
startSecond <= currentTime < endSecond) подсвечивается жирнымtext-foreground. - Прошедшие —
text-muted-foreground. - Будущие —
text-muted-foreground/60. - Клик по сегменту вызывает
onSeek(startSecond)— удобно подключить к audio player.
Кастомный renderer
<ChatTranscription segments={segments} onSeek={onSeek}>
{(segment, i) => (
<span key={i}>
[{chatTranscriptionFormatTime(segment.startSecond)}] {segment.text}
</span>
)}
</ChatTranscription>Тип
type ChatTranscriptionSegment = {
text: string;
startSecond: number;
endSecond: number;
};Совместим с Experimental_TranscriptionResult["segments"][number] из AI SDK — можно мапить 1:1.
На этой странице