Download app/src/pi/capabilities.mjs from Mike0021/MiniCPM5-2B-WebGPU-Pi-HTTP: direct link, hf CLI and curl.
- Browser
- Download file 1.39 kB
-
https://huggingface.co/spaces/Mike0021/MiniCPM5-2B-WebGPU-Pi-HTTP/resolve/main/app/src/pi/capabilities.mjs
- Command line
-
hf download hf://spaces/Mike0021/MiniCPM5-2B-WebGPU-Pi-HTTP/app/src/pi/capabilities.mjs
-
curl -L -o capabilities.mjs https://huggingface.co/spaces/Mike0021/MiniCPM5-2B-WebGPU-Pi-HTTP/resolve/main/app/src/pi/capabilities.mjs
1.39 kB
| // xterm.js renders text/ANSI; this app does not install Kitty/iTerm image addons. | |
| // Pi's native image module also probes tmux via child_process. Keep that host | |
| // dependency out of the browser and advertise only capabilities we implement. | |
| let capabilities = { images: null, trueColor: true, hyperlinks: true }; | |
| let dimensions = { widthPx: 8, heightPx: 16 }; | |
| export const getCapabilities = () => capabilities; | |
| export const setCapabilities = value => { capabilities = { ...value, images: null }; }; | |
| export const getCellDimensions = () => dimensions; | |
| export const setCellDimensions = value => { dimensions = value; }; | |
| export const isImageLine = () => false; | |
| export const getKittyImagePlacement = () => undefined; | |
| export const getKittyImageMetadata = () => undefined; | |
| export const cropKittyImageLine = line => line; | |
| export const deleteKittyImage = () => ''; | |
| export const deleteAllKittyImages = () => ''; | |
| export const deleteAllKittyPlacements = () => ''; | |
| export function hyperlink(text, url) { | |
| // Generated text may contain arbitrary URLs. Only explicit user clicks open | |
| // HTTP(S) links, and no terminal control bytes may enter their OSC envelope. | |
| try { | |
| const parsed = new URL(url); | |
| if (!['https:', 'http:'].includes(parsed.protocol) || /[\x00-\x20\x7f-\x9f]/.test(url)) return text; | |
| return `\x1b]8;;${parsed.href}\x07${text}\x1b]8;;\x07`; | |
| } catch { return text; } | |
| } | |