Creator App Tests / PR Spam Gate (push) Skipped
Frontend Tests / PR Spam Gate (push) Skipped
NPM Format (website & console) / PR Spam Gate (push) Skipped
Pre-commit Checks / PR Spam Gate (push) Skipped
QwenPaw Creator Plugin Release / check-version (push) Canceled after 0s
QwenPaw Creator Plugin Release / upload-oss (push) Canceled after 0s
Tests / PR Spam Gate (push) Skipped
CodeQL / CodeQL (python) (push) Canceled after 0s
CodeQL / CodeQL (typescript) (push) Canceled after 0s
Creator App Tests / Creator Backend Tests (push) Canceled after 0s
Creator App Tests / Creator UI Build & Tests (push) Canceled after 0s
E2E Smoke Tests / Playwright UI Smoke (push) Canceled after 0s
Frontend Tests / Detect console changes (push) Canceled after 0s
NPM Format (website & console) / website format check (push) Canceled after 0s
NPM Format (website & console) / console format check (push) Canceled after 0s
Pre-commit Checks / Pre-commit (push) Canceled after 0s
QwenPaw Data Plugin Release / check-version (push) Canceled after 0s
Tests / Detect code changes (push) Canceled after 0s
Frontend Tests / Vitest Unit Tests (push) Canceled after 0s
Frontend Tests / Frontend Summary (push) Canceled after 0s
QwenPaw Data Plugin Release / upload-oss (push) Canceled after 0s
Tests / Maintainer Approval (push) Canceled after 0s
Tests / Unit Tests - py3.11 - macos-latest (push) Canceled after 0s
Tests / Unit Tests - py3.11 - ubuntu-latest (push) Canceled after 0s
Tests / Unit Tests - py3.13 - ubuntu-latest (push) Canceled after 0s
Tests / Unit Tests - py3.11 - windows-latest (push) Canceled after 0s
Tests / Contract Tests - py3.11 - macos-latest (push) Canceled after 0s
Tests / Contract Tests - py3.11 - ubuntu-latest (push) Canceled after 0s
Tests / Contract Tests - py3.13 - ubuntu-latest (push) Canceled after 0s
Tests / Contract Tests - py3.11 - windows-latest (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - macos-latest - p0 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - macos-latest - p1 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - macos-latest - p2 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - ubuntu-latest - fallback (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - ubuntu-latest - p0 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - ubuntu-latest - p1 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - ubuntu-latest - p2 (push) Canceled after 0s
Tests / Integrated Tests - py3.13 - ubuntu-latest - p0 (push) Canceled after 0s
Tests / Integrated Tests - py3.13 - ubuntu-latest - p1 (push) Canceled after 0s
Tests / Integrated Tests - py3.13 - ubuntu-latest - p2 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - windows-latest - p0 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - windows-latest - p1 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - windows-latest - p2 (push) Canceled after 0s
Tests / Coverage Report (push) Canceled after 0s
Tests / Test Summary (push) Canceled after 0s
58 lines
1.6 KiB
Python
58 lines
1.6 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""Tests for active-model context-window metadata."""
|
|
|
|
from types import SimpleNamespace
|
|
|
|
import pytest
|
|
from pydantic import ValidationError
|
|
|
|
from qwenpaw.app.routers.providers import (
|
|
ModelConfigRequest,
|
|
_active_models_info,
|
|
configure_model,
|
|
)
|
|
from qwenpaw.config.config import ModelSlotConfig
|
|
|
|
|
|
def test_active_models_info_uses_runtime_context_resolution():
|
|
provider = SimpleNamespace(get_context_size=lambda _model_id: 1_000_000)
|
|
manager = SimpleNamespace(get_provider=lambda _provider_id: provider)
|
|
slot = ModelSlotConfig(provider_id="dashscope", model="qwen3.7-max")
|
|
|
|
info = _active_models_info(manager, slot)
|
|
|
|
assert info.active_llm == slot
|
|
assert info.effective_max_input_length == 1_000_000
|
|
|
|
|
|
async def test_configure_model_only_forwards_submitted_fields() -> None:
|
|
captured = None
|
|
|
|
async def update_model_config(**kwargs):
|
|
nonlocal captured
|
|
captured = kwargs
|
|
return SimpleNamespace()
|
|
|
|
manager = SimpleNamespace(update_model_config=update_model_config)
|
|
|
|
await configure_model(
|
|
manager=manager,
|
|
provider_id="openai",
|
|
model_id="gpt-test",
|
|
body=ModelConfigRequest(
|
|
generate_kwargs={"max_tokens": 4096},
|
|
),
|
|
)
|
|
|
|
assert captured == {
|
|
"provider_id": "openai",
|
|
"model_id": "gpt-test",
|
|
"config": {"generate_kwargs": {"max_tokens": 4096}},
|
|
}
|
|
|
|
|
|
@pytest.mark.parametrize("value", [0, -1, 1.5, True])
|
|
def test_model_config_rejects_invalid_max_tokens(value: object) -> None:
|
|
with pytest.raises(ValidationError, match="max_tokens"):
|
|
ModelConfigRequest(generate_kwargs={"max_tokens": value})
|