Skip to content

Add capability to change model and thinking level#7

Open
jetmiky wants to merge 20 commits into
badlogic:mainfrom
jetmiky:main
Open

Add capability to change model and thinking level#7
jetmiky wants to merge 20 commits into
badlogic:mainfrom
jetmiky:main

Conversation

@jetmiky

@jetmiky jetmiky commented May 13, 2026

Copy link
Copy Markdown

Add capability to:

  • Change model within current provider /model <model-id> (example: /model gpt-5.4)
  • Change thinking level /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!

jetmiky added 18 commits May 12, 2026 08:04
- 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
jetmiky added 2 commits June 28, 2026 03:18
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant