← Catalog

@celljs/ta-local-models

A pi package for Ta: models that run on this computer, downloaded only once the user turns on a use of them, checked, started when needed and stopped when idle, for other packages to use

Package

Install

Install with PiG

pig install npm:@celljs/ta-local-models

Install with Pi

pi install npm:@celljs/ta-local-models
Review before installing

Packages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.

Pi manifest JSON

The pi field of package.json.

{
  "web": [
    "./web/index.js"
  ],
  "host": "./host/index.mjs",
  "icon": "Cpu",
  "title": {
    "en": "Local models",
    "ja-JP": "ローカルモデル",
    "zh-CN": "本机模型",
    "zh-TW": "本機模型"
  },
  "summary": {
    "en": "Models that run on this computer for what other features need (the decision model of live hands): downloaded only once you turn one on, stopped when unused, cleared in Settings → Storage.",
    "ja-JP": "ほかの機能が使うモデル(リアルタイム操作の判断モデルなど)をこのコンピューターで動かします。オンにしたときだけダウンロードし、使わないと止まり、設定 → ストレージで消せます。",
    "zh-CN": "在这台电脑上运行其他功能要用的模型(如实时操作的决策模型):打开某项后才下载,不用时自动停下,可在设置 → 存储空间里清除。",
    "zh-TW": "在這台電腦上執行其他功能要用的模型(如即時操作的決策模型):開啟某項後才下載,不用時自動停下,可在設定 → 儲存空間裡清除。"
  },
  "permissions": {
    "host": {
      "*": "settings.manage",
      "status": "models.use",
      "needStatus": "models.use"
    }
  }
}

README

Written by the package's publisher, shown as published in version 4.42.0 (README.md). PiG does not review it.

@celljs/ta-local-models

English

Ta 的内置包:本机模型。别的功能要在这台电脑上跑模型时(比如实时操作的决策模型),都交给它:下载、校验、启动、停下、清理只在这一处,用的一方只说要什么。设计见 ta-local-models.md。

  • 按需下载:包登记一项用途(need),列出可用的模型(文件名、大小、SHA-256、下载地址)。用户在 设置 → 本机模型 打开这一项后才下载:先下运行它的程序(llama.cpp 的服务端,按 Mac / Linux / Windows 和 CPU 架构选包),再下模型;断网、合盖、Ta 重启后从断点接着下,每个文件校验 SHA-256,不对就重下。默认按内存挑模型(16 GB 以上用大的),可以改选。
  • 用到才启动:用的一方调 url,模型的服务才在 127.0.0.1 的空闲端口上启动;一段时间没人用就停下,停了很快又要用就把这段时间放长,很久不用就缩短(2–30 分钟,从 5 分钟起)。Ta 重启后还在跑的服务直接接着用。
  • 回收:关掉一项就删掉只有它用的文件;设置 → 存储空间 里能看到占用、一键清除,90 天没用的模型自动清理(天数可改)。
  • 降级:这个包关掉、平台没有对应的包、磁盘不够时,用的一方拿不到地址,照它自己的办法退回(实时操作退到问大模型)。

给别的包用

import { TA_LOCAL_MODELS, type TaLocalNeed } from '@celljs/ta-protocol';

await host.callPackageHost(TA_LOCAL_MODELS, 'need', [need]); // 每次启动时登记
const status = await host.callPackageHost(TA_LOCAL_MODELS, 'needStatus', [need.id]); // state: off | getting | ready | failed
const url = await host.callPackageHost(TA_LOCAL_MODELS, 'url', [need.id]); // http://127.0.0.1:<port>,OpenAI 兼容

运行时目前是 llama.cpp(b12776);加别的运行时只需在 local-runtimes.ts 里加一项。