mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-09 16:30:47 +08:00
完善 MCP/会话上下文治理并补齐搜索与诊断能力。
补充历史压缩与会话诊断链路,强化 tool pairing 与空响应兜底观测;完善 Admin MCP 导入/绑定与相关前端展示;新增 web_search_fast/web_fetch_clean 及多项测试与文档更新,并同步技能安装与角色绑定策略改进。 Made-with: Cursor
This commit is contained in:
parent
df91434936
commit
ae44cbcad5
43 changed files with 3549 additions and 57 deletions
37
tests/test_direct_loop_empty_assistant_response.py
Normal file
37
tests/test_direct_loop_empty_assistant_response.py
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from types import SimpleNamespace
|
||||
|
||||
from oclaw.platform.persistence.sqlite_store import SqliteStore
|
||||
from oclaw.runtime.direct_loop import run_oclaw_direct_loop
|
||||
from oclaw.runtime.tools.base import ToolRegistry
|
||||
|
||||
|
||||
class _Model:
|
||||
base_url = ""
|
||||
thinking_mode_enabled = False
|
||||
|
||||
def chat(self, msgs, tools, on_token=None): # noqa: ANN001,ARG002
|
||||
return SimpleNamespace(content="", reasoning_content="", tool_calls=[])
|
||||
|
||||
|
||||
def test_direct_loop_persists_stub_on_empty_assistant(tmp_path) -> None: # noqa: ANN001
|
||||
db = tmp_path / "ops.sqlite"
|
||||
store = SqliteStore(str(db))
|
||||
sess = store.create_session("t")
|
||||
out = run_oclaw_direct_loop(
|
||||
store=store,
|
||||
session_id=sess.id,
|
||||
lang="zh",
|
||||
system_prompt="x",
|
||||
model=_Model(),
|
||||
tools=ToolRegistry([]),
|
||||
user_text="hi",
|
||||
persist_user_message=True,
|
||||
max_tool_rounds=1,
|
||||
)
|
||||
assert out.final_text
|
||||
rows = store.get_messages(session_id=sess.id, limit=10)
|
||||
assistant = [r for r in rows if getattr(r, "role", "") == "assistant"]
|
||||
assert any("空响应" in str(getattr(r, "content", "") or "") for r in assistant)
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue