Add capability to change model and thinking level#7
Open
jetmiky wants to merge 20 commits into
Open
Conversation
- Parse Telegram commands via tokenized first-token matching\n- Add /model <model-id> with idle guard and same-provider lookup\n- Add /thinking <off|minimal|low|medium|high|xhigh> with clamp-aware reply\n- Return helpful error for unknown slash commands\n- Update /help and /start command list
Add /model and /thinking usage plus full command list and unknown-command behavior.
- Implement /new [name] Telegram command to create a fresh pi session - Persist reconnect request in session setup and complete reconnect on session_start - Auto-set optional session name (80-char truncation with notice) - Include session name + thinking level in Telegram /status - Update /help and README command docs - Prevent polling shutdown deadlock during in-loop session replacement - Add regression tests for /new parsing and lifecycle guards
- /git status: runs git status --short --branch in current Pi cwd - /git log: runs git log --oneline --decorate -20 - /git nb <branch>: validates branch name then runs git switch -c - /git nb requires Pi idle; status and log allowed while busy - Replies truncated at 4096 chars with [output truncated] note - All git execution uses execFile with args array (no shell) - /help and BotFather /setcommands include /git
…odel switching Allow /model to accept an optional provider prefix so users can switch both provider and model in one command: /model gpt-5.4 medium → current provider, thinking medium /model xiaomi/abc → provider xiaomi, preserve thinking /model openrouter/openai/gpt-4o high → provider openrouter, model openai/gpt-4o Provider resolution rules: - No slash: exact model id lookup under current provider - Slash with known provider prefix: split on first slash, exact match - Slash with unknown provider prefix: treat whole input as model id under current provider (supports OpenRouter-style IDs) - Provider matching is case-insensitive; model id matching is exact - No fuzzy matching Changes: - Export parseTelegramModelCommand, rename modelId→modelSpecifier - Add resolveTelegramModelCommandTarget with provider resolution logic - Update formatTelegramActiveModelReply to show provider/model + thinking - Update /model handler to use resolver - Update help text and BotFather command descriptions
The /help and /start replies now wrap the BotFather /setcommands block in HTML <pre> tags with parse_mode: "HTML", making the commands block render as a copyable code block in Telegram clients. Also ensures /start always includes the BotFather commands block on subsequent uses (not just first pairing), matching /help behavior.
- Convert AI markdown output to Telegram HTML (bold, italic, code, links, headings, lists) - Implement tag-balanced chunking for messages exceeding 4096 characters - Rich text formatting is enabled by default (set richText: false to disable) - Fall back to plain text if Telegram rejects HTML parse - Degrade unsupported features (tables → plain text, headings → bold) - Preserve code block language attributes when splitting across chunks
pi-telegram is archived and no longer maintained. Development continues as Pigram (npm: @jetmiky/pigram, github.com/jetmiky/pigram), a clean-architecture rewrite that migrates existing telegram.json automatically. Add a prominent banner at the top of the README pointing users to the new project.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add capability to:
/model <model-id>(example: /model gpt-5.4)/thinking <off|minimal|low|medium|high|xhigh>(example: /thinking medium)Also updated package dependencies.
I really found this useful in my daily coding use as people of Pi.
Thanks Mario!