Dependency-free MoonBit libraries: a guard for LLM-proposed actions, Chinese numeral parsing, bilingual anatomy terminology, and parameterized motion sessions with deterministic pose intents; with a full-body reference application
English summary. lqyq666/bodymate ships four dependency-free MoonBit packages you can moon add individually — agent (a guard that turns untrusted LLM proposals into allowlisted commands with bounded numeric fields, or nothing), zhnum (Chinese numeral parsing, formatting and in-text normalization), anatomy (376 bilingual Human Atlas / BodyParts3D terms with laterality and search) and motion (parameterized motion sessions with deterministic pose intents) — plus an offline full-body Three.js reference application that proves the same MoonBit code drives the browser, a local AI proxy and command-line examples. Published on mooncakes.io; API docs are in the library README.
moon add lqyq666/bodymate| 包 | 解决的问题 | 谁会用 |
|---|---|---|
| lqyq666/bodymate/agent | LLM 输出的执行护栏:宿主声明允许的命令与数值字段,模型提议只能收敛为 None / Command / Lookup,未声明的 id、字段、非有限数值一律丢弃 | 任何用 MoonBit 写 Agent / 工具调用 / 对话式控制的项目 |
| lqyq666/bodymate/zhnum | 中文数字与数量表达:三万五千、三点一四、半、全角数字、百分之八十 → ASCII 数字;单位前取数 | 中文 UI 指令、语音/聊天输入、配置与表单解析 |
| lqyq666/bodymate/anatomy | Human Atlas / BodyParts3D 双语术语库:376 条归一化拉丁名 → 中文,覆盖 415 肌肉与 282 骨/椎间盘/肋/牙/软骨/筋膜,含侧别与检索 | 医学、体育、康复教育与可视化项目 |
| lqyq666/bodymate/motion | 参数化动作会话引擎:类型化参数与限幅、中文指令解析、独立 Session、相位讲解、确定性姿态意图 | 动作教学、动画/仿真状态机、需要可复现姿态帧的工具 |
// agent:模型提议 → 受控动作
let allowed = @agent.parse_allowlist("push_up^handWidth,elbowAngle~squat^stanceWidth")
@agent.guard_command("push_up", [("handWidth", 1.8), ("invented", 7.0)], allowed) // Command("push_up", [("handWidth", 1.8)])
@agent.guard_command("run_marathon", [], allowed) // None
// zhnum:中文数字 → 数字
@zhnum.normalize_numerals("手距一点五倍肩宽,夹角六十度,深度百分之八十") // "手距1.5倍肩宽,夹角60度,深度80%"
@zhnum.quantity_before_unit("夹角六十度", ["度", "°"]) // Some(60.0)
// anatomy:拉丁名 → 中文,含侧别与检索
@anatomy.structure_name_zh("Left femur", @anatomy.kind_from_string("bone")) // "左侧股骨"
@anatomy.search_structures(entries, "腰大肌") // 肌肉优先的匹配列表
// motion:中文指令 → 类型化参数 → 确定性姿态
let parsed = @motion.parse_query("push_up", "手距一点五倍肩宽,夹角六十度", []).unwrap()
@motion.pose_intent("push_up", 0.5, parsed.values) // 同输入同输出moon run moonbit/examples/parameters --target js # 中文参数解析与越界调整
moon run moonbit/examples/sessions --target js # 两个会话独立播放与暂停
moon run moonbit/examples/sampling --target js # 五个相位的确定性姿态采样
moon run moonbit/examples/export --target js # 四库串联:指令 → 护栏 → 命名 → 姿态帧 CSV用户输入 / 模型提议 / 参数控件 / 每帧经过时间
→ MoonBit zhnum:中文数字归一化
→ MoonBit motion:识别 → 参数校验 → 会话状态 → 姿态意图
→ MoonBit agent:模型提议护栏(服务端与浏览器同一份规则)
→ MoonBit anatomy:结构中文名与检索
→ MoonBit core:wire 导出
→ JavaScript 编解码 → Three.js 骨架 / 材质 / DOMnpm ci
npm run build
npm run check
npm start # 启动本地服务并打开页面;端口占用时只打开页面npm run ai:configure-glm
npm run ai:serveInstall
Download zipDependency-free MoonBit libraries: a guard for LLM-proposed actions, Chinese numeral parsing, bilingual anatomy terminology, and parameterized motion sessions with deterministic pose intents; with a full-body reference application