fix(provider): default DeepSeek context limit to 1M tokens (#87)#181
Open
quangdang46 wants to merge 1 commit into
Open
fix(provider): default DeepSeek context limit to 1M tokens (#87)#181quangdang46 wants to merge 1 commit into
quangdang46 wants to merge 1 commit into
Conversation
DeepSeek's current generation (deepseek-v4 / deepseek-v4-flash and the deepseek-coder variants) advertises a 1M-token context window via its published rate-limit metadata, but `context_limit_for_model_with_provider_and_cache` in jcode-provider-core had no DeepSeek branch. Returning `None` made the usage overlay and compaction heuristics fall back to a smaller generic default until the dynamic /models cache happened to fill in. Add an explicit branch returning `Some(1_000_000)` for any model id starting with "deepseek". Cached/online catalog hits continue to take precedence (see the cached_context_limit hook just above). Test `context_limit_falls_back_to_1m_for_deepseek_models` covers deepseek-v4, deepseek-v4-flash, deepseek-chat, and the cache-precedence case. Ports the `src/provider/models.rs` portion of upstream PR 1jehuang#102 (the opencode setup_url hunk in the same upstream PR is NOT applied here — it conflicts with issue #80 / upstream PR #91 and will be ported there with the right fork-specific URL). Closes #87
1 task
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.
What
DeepSeek's current generation (deepseek-v4 / deepseek-v4-flash and the deepseek-coder variants) advertises a 1M-token context window.
context_limit_for_model_with_provider_and_cacheinjcode-provider-corehad no DeepSeek branch and returnedNone, making the usage overlay and compaction heuristics fall back to a smaller generic default until the dynamic/modelscache happened to fill in.This addresses issue #87: #87
Changes
model.starts_with("deepseek") -> Some(1_000_000)branch right after the gemini one. Cached/online catalog hits continue to take precedence via the existingcached_context_limithook.context_limit_falls_back_to_1m_for_deepseek_modelstest covering deepseek-v4, deepseek-v4-flash, deepseek-chat, and the cache-precedence case.Tests
Notes / scope deviation from upstream
Upstream PR 1jehuang#102 also rewrites the OPENCODE_PROFILE / OPENCODE_GO_PROFILE
setup_urlfromopencode.ai/docs/...to a jcode-docs URL. That hunk conflicts with issue #80 / upstream PR #91 (which also rewrites the same lines, with a different replacement URL). To keep this PR focused on a single concern, the opencode-setup-url change is intentionally NOT included here and will be ported separately for issue #80 with a fork-correct URL.