Skip to content

fix(aiService): improve deepseek-reasoner compatibility#75

Merged
AmintaCCCP merged 1 commit intomainfrom
fix-deepseek-reasoner-compat
Apr 10, 2026
Merged

fix(aiService): improve deepseek-reasoner compatibility#75
AmintaCCCP merged 1 commit intomainfrom
fix-deepseek-reasoner-compat

Conversation

@AmintaCCCP
Copy link
Copy Markdown
Owner

@AmintaCCCP AmintaCCCP commented Apr 10, 2026

Closes

Fixes #70

Overview

This PR fixes compatibility issues when using DeepSeek's official deepseek-reasoner model through the OpenAI-compatible chat completions path.

Changes

  • detect deepseek-reasoner specifically in the OpenAI-compatible branch
  • omit unsupported temperature for that model
  • omit OpenAI-specific reasoning payload for that model
  • keep all existing behavior unchanged for other model channels

Why this is safe

This change is scoped only to apiType === "openai" with model name exactly deepseek-reasoner. It does not affect:

  • other OpenAI-compatible models
  • openai-responses
  • Claude
  • Gemini

Validation

  • local frontend build passed with npm run build

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 10, 2026

📝 Walkthrough

Walkthrough

This PR fixes a compatibility issue with DeepSeek's deepseek-reasoner model by adding detection logic and conditionally omitting request fields (temperature and reasoning) that are incompatible with this specific model variant.

Changes

Cohort / File(s) Summary
DeepSeek Reasoner Model Compatibility
src/services/aiService.ts
Added private helper method isDeepSeekReasonerModel() to detect when the model is deepseek-reasoner. Modified OpenAI chat-completions request construction to conditionally omit temperature and reasoning fields when this model is detected, addressing API compatibility constraints.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Possibly related PRs

Poem

🐰 A reasoner model, deep and wise,
Needed special care to recognize,
We hopped in fast, conditions tight,
Trimmed fields away—now working right! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: improving deepseek-reasoner compatibility in the aiService, which matches the core objective of fixing compatibility issues with DeepSeek's deepseek-reasoner model.
Linked Issues check ✅ Passed The code changes directly address issue #70 by detecting the deepseek-reasoner model and omitting unsupported parameters (temperature and reasoning), ensuring proper compatibility with DeepSeek's API requirements.
Out of Scope Changes check ✅ Passed All changes are strictly scoped to deepseek-reasoner compatibility via the OpenAI-compatible path, with no modifications to other model channels, maintaining existing behavior for Claude, Gemini, and other OpenAI-compatible models.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-deepseek-reasoner-compat

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/services/aiService.ts (1)

72-88: Add regression tests for request-body shape in this branch.

Please add a focused test asserting that temperature and reasoning are omitted for deepseek-reasoner, and still present for non-DeepSeek models. This will protect this compatibility fix from future regressions.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/services/aiService.ts` around lines 72 - 88, Add focused unit tests for
the request body shape produced by the code that builds requestBody in
aiService.ts: call the method (or class) that constructs the request body
(exercise isDeepSeekReasonerModel() via setting this.config.model or mocking it)
for both apiType branches ('openai-responses' and others) and assert that when
model is a deepseek-reasoner variant temperature and reasoning are omitted from
the resulting request object, and that for a non-DeepSeek model both temperature
and reasoning are present with the expected values; target the functions
isDeepSeekReasonerModel() and the requestBody construction logic so the tests
fail on regressions and mock options.temperature/options.maxTokens/reasoning as
needed.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/services/aiService.ts`:
- Around line 72-88: Add focused unit tests for the request body shape produced
by the code that builds requestBody in aiService.ts: call the method (or class)
that constructs the request body (exercise isDeepSeekReasonerModel() via setting
this.config.model or mocking it) for both apiType branches ('openai-responses'
and others) and assert that when model is a deepseek-reasoner variant
temperature and reasoning are omitted from the resulting request object, and
that for a non-DeepSeek model both temperature and reasoning are present with
the expected values; target the functions isDeepSeekReasonerModel() and the
requestBody construction logic so the tests fail on regressions and mock
options.temperature/options.maxTokens/reasoning as needed.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 45d88cd0-9304-446b-b2cc-bed477c050ea

📥 Commits

Reviewing files that changed from the base of the PR and between ee1b9c6 and 6e7aed5.

📒 Files selected for processing (1)
  • src/services/aiService.ts

@AmintaCCCP AmintaCCCP merged commit 7bd77b9 into main Apr 10, 2026
5 checks passed
@AmintaCCCP AmintaCCCP deleted the fix-deepseek-reasoner-compat branch April 10, 2026 10:06
@AmintaCCCP
Copy link
Copy Markdown
Owner Author

This fix has been included in v0.3.0 release.

The DeepSeek Reasoner compatibility issue has been resolved by removing unsupported temperature and reasoning parameters from the request when using deepseek-reasoner model.

Thank you for the contribution!

🦞

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.

【BUG】思维链模型适配问题

2 participants