mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-09 04:40:45 +08:00
Update channel dispatch UX and harden sidecar startup behavior.
This aligns Weixin/WhatsApp with admin-managed model routing by adding channel/account-level specialist controls, improves OSS startup resilience by skipping missing sidecars gracefully, and refreshes runbook/readme guidance for the new default behavior and Weixin OpenAI-key silent handling. Made-with: Cursor
This commit is contained in:
parent
b1a0f94cd6
commit
5ab69e88d3
29 changed files with 1226 additions and 100 deletions
51
tests/test_channel_dispatch_defaults.py
Normal file
51
tests/test_channel_dispatch_defaults.py
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from oclaw.runtime.application.gateway.inbound_service import (
|
||||
_resolve_channel_dispatch,
|
||||
)
|
||||
|
||||
|
||||
class _DummyStore:
|
||||
def __init__(self, data: dict[str, str] | None = None) -> None:
|
||||
self._data = dict(data or {})
|
||||
|
||||
def get_setting(self, key: str) -> str:
|
||||
return str(self._data.get(key) or "")
|
||||
|
||||
|
||||
def test_channel_dispatch_defaults_to_expert_and_generalist() -> None:
|
||||
store = _DummyStore()
|
||||
interaction_mode, specialist = _resolve_channel_dispatch(store, channel="weixin", account=None)
|
||||
assert interaction_mode == "expert"
|
||||
assert specialist == "generalist"
|
||||
|
||||
|
||||
def test_channel_dispatch_uses_global_settings() -> None:
|
||||
store = _DummyStore(
|
||||
{
|
||||
"channel.dispatch.interaction_mode.whatsapp": "comprehensive",
|
||||
"channel.dispatch.specialist.whatsapp": "ops",
|
||||
}
|
||||
)
|
||||
interaction_mode, specialist = _resolve_channel_dispatch(store, channel="whatsapp", account=None)
|
||||
assert interaction_mode == "comprehensive"
|
||||
assert specialist == "ops"
|
||||
|
||||
|
||||
def test_channel_dispatch_account_config_overrides_global() -> None:
|
||||
store = _DummyStore(
|
||||
{
|
||||
"channel.dispatch.interaction_mode.weixin": "comprehensive",
|
||||
"channel.dispatch.specialist.weixin": "ops",
|
||||
}
|
||||
)
|
||||
account = {
|
||||
"config": {
|
||||
"interaction_mode": "expert",
|
||||
"specialist": "generalist",
|
||||
}
|
||||
}
|
||||
interaction_mode, specialist = _resolve_channel_dispatch(store, channel="weixin", account=account)
|
||||
assert interaction_mode == "expert"
|
||||
assert specialist == "generalist"
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue