Private
Public Access
0
0

conductor(checkpoint): Phase 2 complete - Qwen via DashScope

Phase 2 of qwen_llama_grok_integration_20260606 ships Qwen support via
the Alibaba Cloud DashScope native SDK. 10 of 11 state tasks done
(t2.7 cancelled: no credentials_template.toml exists in the project;
t2.9 was completed in Phase 1's initial registry population).

Modules shipped:
- src/qwen_adapter.py (31 lines): build_dashscope_tools() (OpenAI shape
  -> DashScope shape), classify_dashscope_error() (5 exception classes
  -> ProviderError kinds: auth/network/quota)
- src/ai_client.py: state globals (_qwen_client, _qwen_history,
  _qwen_history_lock, _qwen_region), _ensure_qwen_client() (sets
  dashscope.base_http_api_url based on region: china vs international),
  _dashscope_call() + _dashscope_exception_from_response() +
  _extract_dashscope_tool_calls(), _send_qwen() (10-param signature
  matching _send_minimax), _list_qwen_models()
- src/models.py: 'qwen' added to PROVIDERS (centralized; gui_2.py and
  app_controller.py import from this list)
- src/cost_tracker.py: 7 Qwen pricing entries (regex-matched,
  USD per 1M tokens)

Tests shipped: tests/test_qwen_provider.py (55 lines, 5 tests, all passing)
Total new tests this phase: 5
Total tests in new modules: 30 (qwen + minimax + capabilities +
openai_compatible + cost_tracker + no_top_level_sdk_imports)

Verification:
- 30/30 tests pass in batch
- No regressions
- 4/4 audit scripts pass (audit_main_thread_imports, audit_weak_types,
  check_test_toml_paths, audit_no_models_config_io)

DashScope alignment (post-cleanup):
- Uses dashscope.common.error.AuthenticationError (real class in
  1.25.21) instead of the non-existent InvalidApiKey
- Removed the InvalidApiKey -> AuthenticationError monkey-patch
- TimeoutException -> network (not rate_limit)
- ServiceUnavailableError -> network (not quota)
- _ensure_qwen_client sets base_http_api_url per region (china vs
  international) per the latest DashScope API spec

Deviations from the plan:
- Test signature adapted from 12-param (plan) to 10-param (matching
  real _send_minimax) -- the plan's enable_tools / rag_engine params
  don't exist on _send_minimax
- PROVIDERS change is at src/models.py:56 (centralized), not in
  gui_2.py and app_controller.py (which import from models)
- t2.7 (credentials template) skipped: no template file exists;
  the user maintains their own credentials.toml directly

Phase 3 (Grok + Llama) is now unblocked. Local LLM support lands
in Phase 3 via Llama's Ollama backend (default base_url
http://localhost:11434/v1).
This commit is contained in:
2026-06-11 01:34:48 -04:00
parent 45d316a0bd
commit 0f2541a3a1

Diff Content Not Available