🤖 Open-source, local-first alternative to Grok Bot, OpenAI dots and Claude Duet. Your own AI bots on any model: GPT, Claude, Gemini, Grok, DeepSeek, Kimi, GLM and 70+ more through one Modelflare key. Reach them in the app, WeChat or Feishu; they remember you, work in the background, run commands and use your computer. Pay per use.
Python ai-agentai-assistantchatbotclaudecomputer-usedeepseekdesktop-appdshelectronfeishugeminigptgrokllmlocal-firstmodelflaremulti-modelopenai-compatiblepersonal-ai-agentwechat
---
// 毛绒机器人头像:结构与 App 的 BotAvatar(ui/components/avatar.js)一致,样式在 styles/bots.css。
// 看指针、戳一戳由 lib/eyes.ts 驱动;无 JS 时是静态的第一帧。
import "../styles/bots.css";
import { BOT_CHARS, type CharKey } from "../lib/bots";
// 其余 data-* 原样挂到根元素上(循环示意的时间线用 data-states / data-shots / data-say-at,见 scripts/tour.ts)
interface Props { char: CharKey; size?: number; lively?: boolean; pokeable?: boolean; state?: "idle" | "listening" | "working"; class?: string; seed?: number; [data: `data-${string}`]: string }
const { char, size = 48, lively = false, pokeable = false, state = "idle", class: cls, seed, ...rest } = Astro.props;
const c = BOT_CHARS[char];
const p = (pt: [number, number]) => `${pt[0]}% ${pt[1]}%`;
const style = [
`--s:${size}px`,
`--bf-sprite:url("/bots/${char}.webp")`,
`--bf-sprite-avif:url("/bots/${char}.avif")`, // 支持 AVIF 的浏览器用它(styles/bots.css 的 image-set)
`--o-el:${p(c.earL)}`, `--o-er:${p(c.earR)}`, `--o-top:${p(c.top)}`,
`--tip-x:${c.tip[0]}%`, `--tip-y:${c.tip[1]}%`,
`--bf-seed:${(seed ?? (char.charCodeAt(0) * 37 + char.length * 101) % 1000 / 1000).toFixed(3)}`,
].join(";");
// 只有哒哒、晶晶有发光层(styles/bots.css),别的角色不输出空节点
const glow = char === "red" || char === "purple";
const parts = ["ear-l", "ear-r", "top"];
---
<div class:list={["bot-face", { lively, pokeable, sm: size < 36 }, cls]} style={style} data-char={char} data-state={state} data-eyes="open" aria-hidden="true" {...rest}>
{lively && <i class="bf-shadow"></i>}
<i class="bf-aura"></i>
<div class="bf-body">
<div class="bf-shot">
<div class="bf-look">
{parts.map((k) => <i class={`bf-part bf-${k}`}><i class="bf-pin"><b class="bf-img"></b>{glow && <b class="bf-glow"></b>}</i></i>)}
<i class="bf-part bf-head"><b class="bf-img"></b>{glow && <b class="bf-glow"></b>}</i>
{c.lens && c.lens.slice(0, 2).map((l) => <i class="bf-lens" style={`left:${(l as number[])[0]}%;top:${(l as number[])[1]}%;--lens:${c.lens![2] * 2}%`}></i>)}
{c.eyes.map((e) => <i class="bf-blush" style={`left:${(e[0] + (e[0] < 50 ? -5.6 : 5.6)).toFixed(2)}%;top:${(e[1] + 6.2).toFixed(2)}%`}></i>)}
<svg class="bf-eyes" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
<g class="bf-gaze"><g class="bf-glance">
{c.eyes.map((e, i) => (
<g transform={`translate(${e[0]} ${e[1]})${i ? " scale(-1 1)" : ""}`}>
{/* 其余表情由 lib/eyes.ts 补上,原因见 lib/eye-shapes.ts */}
<g class="bf-lid"><circle class="e e-open" r={c.r} /></g>
</g>
))}
</g></g>
</svg>
</div>
</div>
</div>
</div>