Something went wrong. Try again.
a tiny pet with a GPT-2 brain, living in your browser
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546import { dreamThing, L, tags } from "../core.ts";import { WANT_ICON } from "./config.ts";export { cleanText, isSilent } from "../core.ts";
// How the chat shows the pet's tags: small "tool" chips, or a short action// for a silent line. Parsing and the closed lists come from the shared rules.export function chipsFor(text: string) { const chips: [string | null, string, string?][] = []; for (const { name, arg: a, result } of tags(text)) { const arg = a ?? "", r = result ?? ""; if (name === "clock") chips.push(["checked the clock", r]); else if (name === "look") chips.push(["looked around", r]); else if (name === "recall") chips.push([`tried to remember "${arg}"`, r]); else if (name === "yesterday") chips.push(["read yesterday's diary", r]); else if (name === "remember") chips.push(["saved a memory", arg]); else if (name === "gift") chips.push(["gave you a gift", arg, arg]); else if (name === "want") chips.push(["wants", arg, WANT_ICON[arg]]); else if (name === "diary") chips.push(["jotted in the diary", arg]); else if (name === "dream" && L.DREAMS.includes(arg)) chips.push([`dreams of ${dreamThing(arg)}`, "", arg]); else if (name === "sleep") chips.push(["fell asleep", ""]); else if (name === "yes") chips.push(["said yes", ""]); else if (name === "no") chips.push(["said no", ""]); else if (name === "emote" || name === "walk") chips.push([null, name === "walk" ? `walk-${arg}` : arg]); } return chips;}export const ACT_WORD: Record<string, string> = { happy: "bounces", love: "is in love", sad: "sniffles", sleepy: "yawns", wave: "waves", dance: "dances", spin: "spins", blush: "blushes", grumpy: "grumbles", wow: "gasps", giggle: "giggles", cry: "cries", "walk-left": "toddles left", "walk-right": "toddles right",};