Bỏ hai chế độ Off và Fallback ở ô định tuyến cạnh khung chat và ở mục Định
tuyến trong Cài đặt. Mặc định chuyển sang Auto.
- USER_ROUTING_MODES = ("auto", "manual"); giá trị off/fallback/lạ còn lưu trong
config hay project đều được hiểu là Auto (routing_mode_for,
project_routing_mode, set_*). Engine vẫn hiểu "off" khi truyền mode_override
tường minh.
- RoutingScheduler: định tuyến giờ luôn bật nên việc chấm điểm model định kỳ
luôn chạy; muốn tắt thì đặt reassess_interval_hours = 0.
- Cập nhật các test đang ghim hành vi "mặc định off".
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
43 lines
1.1 KiB
Python
43 lines
1.1 KiB
Python
"""Ô định tuyến chỉ còn Auto và Manual; giá trị off/fallback cũ hiện thành Auto."""
|
|
from __future__ import annotations
|
|
|
|
import os
|
|
|
|
import pytest
|
|
|
|
os.environ.setdefault("QT_QPA_PLATFORM", "offscreen")
|
|
pytest.importorskip("PySide6")
|
|
|
|
|
|
@pytest.fixture(scope="module")
|
|
def qt_app():
|
|
from PySide6.QtWidgets import QApplication
|
|
|
|
return QApplication.instance() or QApplication([])
|
|
|
|
|
|
def _toggle(stored: str):
|
|
from cowork_local.ui.routing_toggle import RoutingToggle
|
|
|
|
saved = []
|
|
t = RoutingToggle(None, "cowork", get_mode=lambda: stored, set_mode=saved.append)
|
|
return t, saved
|
|
|
|
|
|
def test_only_auto_and_manual_are_offered(qt_app):
|
|
t, _ = _toggle("auto")
|
|
items = [t._combo.itemData(i) for i in range(t._combo.count())]
|
|
assert items == ["auto", "manual"]
|
|
|
|
|
|
@pytest.mark.parametrize("stored", ["off", "fallback", "", "turbo"])
|
|
def test_legacy_values_show_as_auto(qt_app, stored):
|
|
t, _ = _toggle(stored)
|
|
assert t.current_mode() == "auto"
|
|
|
|
|
|
def test_choosing_manual_persists_it(qt_app):
|
|
t, saved = _toggle("auto")
|
|
t._combo.setCurrentIndex(t._combo.findData("manual"))
|
|
assert saved == ["manual"]
|