ChatMessageTiming

Feedback & Status

메시지 생성 소요·속도를 값만 그리는 계측 표시.

Usage

첫 토큰·전체 소요·속도·청크 수를 이미 계산해 가진 채 보여줄 때 사용한다.

import

import

import { ChatMessageTiming } from '@mildang/design-system/unofficial/Chat';

API Reference

ChatMessageTiming Props

Prop

Type

Default

totalMs
필수

number

지정 안 함

chunks

number

지정 안 함

firstTokenMs

number

지정 안 함

labels

Partial<ChatMessageTimingLabels>

지정 안 함

tokensPerSecond

number

지정 안 함

같은 패밀리

@mildang/design-system/unofficial/Chat 에서 같이 내보내는 컴포넌트다.

예제

전체 계측값

import { ChatMessageTiming } from '@mildang/design-system/unofficial/Chat';
import type { ComponentProps } from 'react';
type Props = ComponentProps<typeof ChatMessageTiming>;
const DEFAULT_ARGS: Props = { firstTokenMs: 312, totalMs: 4820, tokensPerSecond: 42.7, chunks: 128 };
export default function MessageTimingFullExample(props: Partial<Props> = {}) { return <ChatMessageTiming {...DEFAULT_ARGS} {...props} />; }

전체 소요 시간만

import { ChatMessageTiming } from '@mildang/design-system/unofficial/Chat';
import type { ComponentProps } from 'react';
type Props = ComponentProps<typeof ChatMessageTiming>;
const DEFAULT_ARGS: Props = { totalMs: 940 };
export default function MessageTimingTotalOnlyExample(props: Partial<Props> = {}) { return <ChatMessageTiming {...DEFAULT_ARGS} {...props} />; }

1초 미만

import { ChatMessageTiming } from '@mildang/design-system/unofficial/Chat';
import type { ComponentProps } from 'react';
type Props = ComponentProps<typeof ChatMessageTiming>;
const DEFAULT_ARGS: Props = { firstTokenMs: 88, totalMs: 640, tokensPerSecond: 96.2 };
export default function MessageTimingSubSecondExample(props: Partial<Props> = {}) { return <ChatMessageTiming {...DEFAULT_ARGS} {...props} />; }

영문 레이블

import { ChatMessageTiming } from '@mildang/design-system/unofficial/Chat';
import type { ComponentProps } from 'react';
type Props = ComponentProps<typeof ChatMessageTiming>;
const DEFAULT_ARGS: Props = { firstTokenMs: 312, totalMs: 4820, tokensPerSecond: 42.7, chunks: 128, labels: { firstToken: 'First token', total: 'Total', speed: 'Speed', chunks: 'Chunks', duration: (ms: number) => (ms < 1000 ? `${Math.round(ms)}ms` : `${(ms / 1000).toFixed(1)}s`), count: (chunks: number) => `${chunks}` } };
export default function MessageTimingEnglishLabelsExample(props: Partial<Props> = {}) { return <ChatMessageTiming {...DEFAULT_ARGS} {...props} />; }