mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-08-15 22:18:00 +00:00
8 lines
223 B
TypeScript
8 lines
223 B
TypeScript
export function truncateText(
|
|
text: string | null | undefined,
|
|
maxLength: number = 50
|
|
): string {
|
|
if (!text) return "N/A";
|
|
if (text.length <= maxLength) return text;
|
|
return text.substring(0, maxLength) + "...";
|
|
}
|