fix: Address PR #206 review feedback for OpenAI thinking mode#207
fix: Address PR #206 review feedback for OpenAI thinking mode#207guunergooner wants to merge 2 commits intoclaude-code-best:mainfrom
Conversation
Support DeepSeek reasoning models (deepseek-reasoner and DeepSeek-V3.2) in OpenAI-compatible API layer with automatic thinking mode detection. Key changes: - Add `isOpenAIThinkingEnabled()` for auto-detecting thinking-capable models - Inject thinking parameters in request body (both official API and vLLM formats) - Preserve reasoning_content in message conversion for tool call iterations - Strip reasoning_content from previous turns to save bandwidth - Add comprehensive test coverage for thinking mode detection Thinking mode is enabled when: 1. OPENAI_ENABLE_THINKING=1 is set (explicit enable), OR 2. Model name contains "deepseek-reasoner" or "deepseek-v3.2" (auto-detect) Signed-off-by: guunergooner <tongchao0923@gmail.com>
…ing mode - Fix afterEach env var leak: use delete instead of assigning undefined - Fix turn boundary detection: treat multimodal inputs (e.g. images) as new turns, not just text content - Extract buildOpenAIRequestBody() for testability, replace constant- assertion tests with real function output verification Signed-off-by: guunergooner <tongchao0923@gmail.com>
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughThis PR adds "thinking" mode support for OpenAI, particularly for DeepSeek reasoner models. It introduces helper functions to detect thinking enablement via environment variables or model name patterns, extends message conversion logic to preserve Anthropic Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
Changes merged into #206 as a single commit. |
Summary
Fixes review feedback from #206:
deleteinstead of assigningundefinedwhen original env var was undefined, preventing state leak between testsreasoning_contentnot being stripped for multimodal-only turnsbuildOpenAIRequestBody()fromqueryModelOpenAIfor testability; replace constant-assertion tests with real function output verificationTest plan
thinking.test.ts: 36 tests pass (was 20, now covers request body params)convertMessages.test.ts: 22 tests passSigned-off-by: guunergooner tongchao0923@gmail.com
🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Tests