feat: add /btw side-question support for Gemini and Codex providers#171
Merged
Zhang-Henry merged 2 commits intomainfrom Apr 13, 2026
Merged
feat: add /btw side-question support for Gemini and Codex providers#171Zhang-Henry merged 2 commits intomainfrom
Zhang-Henry merged 2 commits intomainfrom
Conversation
Previously /btw was Claude-only. This extends the ephemeral side-question overlay to Gemini (via direct generateContent API) and Codex (via OpenAI Chat Completions API), both tool-free and session-independent. - Extract shared BTW_SYSTEM_PROMPT and helpers into server/utils/btw.js - Add runGeminiBtw() using non-streaming Gemini REST API - Add runCodexBtw() bypassing Codex SDK with direct OpenAI API call - Create unified POST /api/btw route with provider dispatch - Update frontend to send provider field and select correct model - Keep legacy /api/claude/btw endpoint for backward compatibility Made-with: Cursor
Lets users point /btw (and other Gemini REST calls) at a self-hosted or proxy endpoint instead of the hardcoded Google base URL.
everett4320
added a commit
to everett4320/LingZhi-Lab
that referenced
this pull request
Apr 14, 2026
…res) Merge upstream/main into topic/upstream/pr170-review-fixes to unblock the PR merge. Conflicts arose from two upstream PRs landing on main after our branch diverged: - OpenLAIR#171 feat/btw-gemini-codex: added /btw side-question support for Gemini and Codex; resolved by keeping btw handler block from main before our existing builtin command handler in useChatComposerState.ts, and adding the btw/CODEX_MODELS imports alongside our buildCodexSessionCreatedEvent import in openai-codex.js. - OpenLAIR#173 feat/file-preview-reader-modes: auto-merged cleanly. All 149 tests pass. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
/btwephemeral side-question overlay from Claude-only to also support Gemini and Codex providersgenerateContentREST API directly withsystemInstructionand notoolsfieldBTW_SYSTEM_PROMPT, constants, andbuildBtwUserMessage()intoserver/utils/btw.jsfor all three providersPOST /api/btwendpoint withproviderdispatch, keeping the legacy/api/claude/btwfor backward compatibilityChanged files
server/utils/btw.jsserver/routes/btw.js/api/btwroute with provider dispatchserver/claude-sdk.jsrunClaudeBtw()to use shared moduleserver/gemini-api.jsrunGeminiBtw()via Gemini REST APIserver/openai-codex.jsrunCodexBtw()via OpenAI Chat Completions APIserver/index.js/api/btwrouteserver/routes/commands.js/btwdescription (removed "Claude only")useChatComposerState.tsproviderfield, select correct modelTest plan
/btw <question>with Claude provider — should work as before/btw <question>with Gemini provider — answer appears in overlay/btw <question>with Codex provider — answer appears in overlay/btwwith unsupported provider (e.g. openrouter) — shows informative error message/btwwhile a main session is streaming — overlay should work concurrently/api/claude/btwendpoint still worksMade with Cursor