mirror of
https://github.com/HKUDS/DeepTutor.git
synced 2026-12-04 05:30:26 +08:00
Follow-up to #490. The PR inlined the "disable thinking for Gemini 2.5/3" gate in 5 places across 3 files. This commit collapses them to one registry and three thin call sites. Changes: * `services/llm/reasoning_params.py`: new `_PROVIDER_DEFAULT_OFF_PATTERNS` registry + `default_reasoning_effort_for(provider, model)` public helper. `build_openai_compatible_reasoning_kwargs` now consults the registry, so the openai-compat path (which lost its inline gate during the #490 merge conflict resolution) is restored via the helper. * `services/llm/executors.py` (sdk_complete + sdk_stream) and `services/llm/cloud_provider.py` (_openai_complete + _openai_stream) now call `default_reasoning_effort_for(...)` instead of inlining the ('gemini-2.5', 'gemini-3') startswith check. * Use substring (not startswith) match so `models/gemini-2.5-flash` is also covered — some OpenAI-compat clients prefix model ids with `models/`. * `services/config/loader.py:get_agent_params`: when a module's section is missing from the user's stale `agents.yaml`, fall back through `DEFAULT_AGENTS_SETTINGS` before the global `(0.5, 4096)` default. This lets the `capabilities.visualize` default (`max_tokens=16384` from #490) reach existing installs, not just fresh ones. * `capabilities/visualize.py`: hoist the duplicated lazy `from deeptutor.agents.visualize.models import ReviewResult` import from two branches into the top of `run()`. Tests: * `tests/services/llm/test_reasoning_params.py` — 17 new cases covering Gemini 2.5/3 + `models/` prefix + case-insensitivity + the legacy Gemini 1.5/2.0 / other-provider untouched paths + the explicit-override takes-precedence rule. * All 107 tests in `tests/services/llm/` still pass; 5 pre-existing `test_chat_params_config` failures (8192 vs 8000 drift) are unrelated. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>