Artifact 329e683219a412f09f30ea2db73cf421928ee5cd467665993def59f14d302da6:
- File
src/tui/tui.h
— part of check-in
[fb82c37817]
at
2026-11-19 14:01:47
on branch models
— Model picker, slash command menu and Pi's model catalog
Models are chosen as in Pi. pic carries a snapshot of Pi's catalog for its providers (653 chat models; tools/model-catalog.sh regenerates it from pi.dev/api/models) and lays fresher per-provider lists from pi.dev over it, cached in ~/.pic/models-store.json with ETags and trusted for four hours, used only when newer than the snapshot. Resolution takes a model's API, endpoint, limits and compat settings from the catalog before the models file. pic models lists the models of providers with a key (--all every one, --json, --refresh); pic models --default saves the model used when none is given.
In the terminal interface, Ctrl+L or /model opens a picker of the models whose provider has a key, filtered by Pi's fuzzy matching as you type, current and default first; Enter uses the model, Ctrl+S also saves it as the default; Ctrl+P cycles. Typing / shows a menu of commands with their arguments (Tab completes, Enter runs) and /model completes model names. New commands show the conversation's details and token counts, copy the last reply (OSC 52 and the system clipboard), export, clone and list the hotkeys. (user: dmestas, size: 866) [annotate] [blame] [check-ins using] [more...]
/* pic's terminal UI (app.c): plain pic in a terminal. Each request runs as a * child `pic --json ask` process and is known only through its JSON events; * the journal stays the record, so a UI fault cannot touch a run. */ #ifndef PIC_TUI_H #define PIC_TUI_H typedef struct { const char *self; /* this executable, for the child processes */ const char *db; /* journal path */ const char *workspace; const char *model; /* provider/model */ const char *default_model; /* the saved default (or pic's own), marked in the picker */ int exec_seconds; long context_window; /* -1: the model's */ const char *resume; /* NULL: a new conversation; "latest" or an id */ } pic_tui_options; /* Runs until the person quits; 0, or 1 when the terminal could not be used. */ int pic_tui_main(const pic_tui_options *o); #endif