Spaces:
Paused
Paused
Download apps/bot/src/team/render.ts from Simzy/big-brain-ape-bot: direct link, hf CLI and curl.
- Browser
- Download file 635 Bytes
-
https://huggingface.co/spaces/Simzy/big-brain-ape-bot/resolve/main/apps/bot/src/team/render.ts
- Command line
-
hf download hf://spaces/Simzy/big-brain-ape-bot/apps/bot/src/team/render.ts
-
curl -L -o render.ts https://huggingface.co/spaces/Simzy/big-brain-ape-bot/resolve/main/apps/bot/src/team/render.ts
635 Bytes
| import { BOSS, PERSONAS, type SpecialistId } from "./personas.js"; | |
| export type Speaker = "boss" | SpecialistId; | |
| export interface Line { | |
| speaker: Speaker; | |
| text: string; | |
| } | |
| export function renderDesk(lines: Line[]): string { | |
| return lines | |
| .map((line) => { | |
| const who = | |
| line.speaker === "boss" | |
| ? BOSS | |
| : PERSONAS[line.speaker]; | |
| return `${who.emoji} <b>${escapeHtml(who.name)}</b>\n${escapeHtml(line.text)}`; | |
| }) | |
| .join("\n\n"); | |
| } | |
| export function escapeHtml(value: string): string { | |
| return value | |
| .replace(/&/g, "&") | |
| .replace(/</g, "<") | |
| .replace(/>/g, ">"); | |
| } | |