docs: Fix TrackStopped typo in SimpleChatbot

This commit is contained in:
James Hush
2025-04-14 15:12:17 +08:00
parent bd3d30111a
commit dae3b927e1

View File

@@ -1,13 +1,13 @@
import { useRef, useCallback } from 'react'; import { useRef, useCallback } from "react";
import { import {
Participant, Participant,
RTVIEvent, RTVIEvent,
TransportState, TransportState,
TranscriptData, TranscriptData,
BotLLMTextData, BotLLMTextData,
} from '@pipecat-ai/client-js'; } from "@pipecat-ai/client-js";
import { useRTVIClient, useRTVIClientEvent } from '@pipecat-ai/client-react'; import { useRTVIClient, useRTVIClientEvent } from "@pipecat-ai/client-react";
import './DebugDisplay.css'; import "./DebugDisplay.css";
export function DebugDisplay() { export function DebugDisplay() {
const debugLogRef = useRef<HTMLDivElement>(null); const debugLogRef = useRef<HTMLDivElement>(null);
@@ -16,14 +16,14 @@ export function DebugDisplay() {
const log = useCallback((message: string) => { const log = useCallback((message: string) => {
if (!debugLogRef.current) return; if (!debugLogRef.current) return;
const entry = document.createElement('div'); const entry = document.createElement("div");
entry.textContent = `${new Date().toISOString()} - ${message}`; entry.textContent = `${new Date().toISOString()} - ${message}`;
// Add styling based on message type // Add styling based on message type
if (message.startsWith('User: ')) { if (message.startsWith("User: ")) {
entry.style.color = '#2196F3'; // blue for user entry.style.color = "#2196F3"; // blue for user
} else if (message.startsWith('Bot: ')) { } else if (message.startsWith("Bot: ")) {
entry.style.color = '#4CAF50'; // green for bot entry.style.color = "#4CAF50"; // green for bot
} }
debugLogRef.current.appendChild(entry); debugLogRef.current.appendChild(entry);
@@ -68,7 +68,7 @@ export function DebugDisplay() {
useCallback( useCallback(
(track: MediaStreamTrack, participant?: Participant) => { (track: MediaStreamTrack, participant?: Participant) => {
log( log(
`Track started: ${track.kind} from ${participant?.name || 'unknown'}` `Track started: ${track.kind} from ${participant?.name || "unknown"}`
); );
}, },
[log] [log]
@@ -76,11 +76,11 @@ export function DebugDisplay() {
); );
useRTVIClientEvent( useRTVIClientEvent(
RTVIEvent.TrackedStopped, RTVIEvent.TrackStopped,
useCallback( useCallback(
(track: MediaStreamTrack, participant?: Participant) => { (track: MediaStreamTrack, participant?: Participant) => {
log( log(
`Track stopped: ${track.kind} from ${participant?.name || 'unknown'}` `Track stopped: ${track.kind} from ${participant?.name || "unknown"}`
); );
}, },
[log] [log]